Author Topic: Raspberry Pi based inspection camera  (Read 2196 times)

0 Members and 1 Guest are viewing this topic.

Offline LeiothrixTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: au
Raspberry Pi based inspection camera
« on: October 04, 2024, 12:03:44 am »
I saw Dave's recent mailbag video which had an inspection camera in it and figured I would show off what I have made as a much better alternative.

It is a Raspberry Pi 3B+ with the HQ camera and a 10-55mm lens.   The lens has focus, zoom and aperture controls, and it is on a vertical stage for extra adjustment.

It is mounted on some Arca-Swiss rails so it can slide out from the shelf to the working position and slide back when not in use.  The shelf is mounted on the wall so it doesn't shake at all when you bump the table like the ones mounted on a retort do.

The Pi boots up into the camera application and is on a read-only filesystem so it can just be powered on and off from the power switch.  One could write a quick Python script to save photos at a button press, but I haven't gotten around to it

It runs at 50fps and I don't have any trouble with motion blur or lag for soldering underneath it.  And as you can see from the ruler the working height is around 28cm, so very easy to work under.

The board pictured is 80mm x 20mm, and the components on the screen are 0805 and 0402.  The monitor itself is 24" 1080p.

The lighting could be a bit better, I plan on getting a pair of lights on goose necks and mounting them to the camera rail.  It could also do with an enclosure around the camera and to be generally neatened up a bit, but that's a job for the future.

Just figured I would share as it might inspire someone to do something similar.

 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6848
  • Country: ro
Re: Raspberry Pi based inspection camera
« Reply #1 on: October 04, 2024, 07:54:50 am »
Nice setup.  :-+

Offline Bryn

  • Regular Contributor
  • *
  • Posts: 195
  • Country: gb
    • mindsConnected
Re: Raspberry Pi based inspection camera
« Reply #2 on: October 04, 2024, 07:57:59 am »
Nice setup.  :-+
Was going to say the exact thing 😅
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2154
  • Country: us
Re: Raspberry Pi based inspection camera
« Reply #3 on: October 04, 2024, 02:15:45 pm »
That looks good.

Do you have a list of parts you used such as the camera and/or a link to where you got the idea from?

Saving photos would be great too. I don't know Python, but I think saving photos can come in handy.
 

Offline LeiothrixTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: au
Re: Raspberry Pi based inspection camera
« Reply #4 on: October 05, 2024, 12:10:27 am »
The list of parts is roughly:


The Arca-Swiss stuff is on Aliexpress as well, and I had some lying around from use with my camera.

The zoom range on the lens is perfect for what I want, and one can do digital zoom with the camera software as well.

I got the idea from looking at the preexisting digital microscopes like the one that was in the recent mailbag video.  I had also seen a couple of other projects but they were also using microscope lenses with terrible working distances.

I didn't like their working distance and didn't want to risk spending $300 or so on some electronics at something like Aliexpress.   I think this works better than most of them as it is much more flexible in what it can do and doesn't shake at all thanks to being wall mounted.

And thanks to the Pi being a general purpose computer with accessible GPIO ports you can easily make it have a user interface that does whatever you want it to do.
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2154
  • Country: us
Re: Raspberry Pi based inspection camera
« Reply #5 on: October 10, 2024, 06:16:04 pm »
How well is the picture when you zoom in?

My 30x microscope can handle tiny SMT parts without zooming in, so I'm curious if you can actually solder tiny SMT parts with this too.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 7353
  • Country: ca
  • Non-expert
Re: Raspberry Pi based inspection camera
« Reply #6 on: October 10, 2024, 07:46:52 pm »
The raspberry pi hq cam is this one: https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/12MP-IMX477/
It says IMX477, 1080p 30fps max

Is 50fps real?
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline LeiothrixTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: au
Re: Raspberry Pi based inspection camera
« Reply #7 on: October 10, 2024, 08:18:04 pm »
How well is the picture when you zoom in?

My 30x microscope can handle tiny SMT parts without zooming in, so I'm curious if you can actually solder tiny SMT parts with this too.

The photo above is zoomed in as far as the lens can go.  The components on the right are 0402 and I soldered those just fine.

You can zoom further with software, or you could also just get a longer lens.


Is 50fps real?

The frame rate depends on the video mode and it can go up to 240fps.  Unfortunately the Pi doesn't have all of the data lanes so can't run at the full data rate of the camera.

The video modes available on my system are:

Code: [Select]
libcamera-hello --list-cameras

Available cameras
-----------------
0 : imx477 [4056x3040] (/base/soc/i2c0mux/i2c@1/imx477@1a)
    Modes: 'SRGGB10_CSI2P' : 1332x990 [120.05 fps - (696, 528)/2664x1980 crop]
           'SRGGB12_CSI2P' : 2028x1080 [50.03 fps - (0, 440)/4056x2160 crop]
                             2028x1520 [40.01 fps - (0, 0)/4056x3040 crop]
                             4056x3040 [10.00 fps - (0, 0)/4056x3040 crop]

My photo above is using the 2028x1080x50fps mode.
 
The following users thanked this post: thm_w

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2154
  • Country: us
Re: Raspberry Pi based inspection camera
« Reply #8 on: October 11, 2024, 01:02:06 am »
I've wanted something like this for a while because sometimes it's easier than staring into a scope, or, one time I had to use hot air and needed to stare into the microscope while holding the hot air pencil, etc...

This is why I asked how well it handles zooming in on tiny components like surface mount ICs.
 

Offline LeiothrixTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: au
Re: Raspberry Pi based inspection camera
« Reply #9 on: October 11, 2024, 02:20:22 am »
I didn't have any problem making that board by hand.  It is displayed on a 24" monitor, I think that the little parts are probably appear bigger in real life than they do in a photo.  And one could of course use a bigger monitor.

I placed the components with tweezers, and I've reworked a bit of it with an iron or hot air as well.  The working distance is around 28cm so there is plenty of room to move your hands or tools.

Digital zoom works pretty well, it is a pretty good quality camera.  I need better lighting to make the most of it though.

I don't have a longer lens to test with, but there is no reason you couldn't put a longer lens on it.
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2154
  • Country: us
Re: Raspberry Pi based inspection camera
« Reply #10 on: October 11, 2024, 03:04:44 am »
I might buy the parts and build this.

Can you post the code for the Pi?

Taking a video doesn't seem like something I'd need, but taking pictures may come in handy as I've tried taking photos through my microscope lens which isn't easy.
 

Offline LeiothrixTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: au
Re: Raspberry Pi based inspection camera
« Reply #11 on: October 11, 2024, 04:05:26 am »
There isn't much to this  :)  I just set it to boot up a shell script.

Make sure you don't run this inside X as the performance is terrible.

You may or may not need the hflip/vflip options depending on the orientation of your camera.

Code: [Select]
libcamera-hello --width 1980 --height 1020 --framerate 50 --viewfinder-mode 2028:1080:10 --hflip 1 --vflip 1 -t 0 --verbose 0

You can use a different video mode to have a cropped video / digital zoom.
Code: [Select]
libcamera-hello --width 1980 --height 1020 --framerate 60 --viewfinder-mode 1332:990:10 --hflip 1 --vflip 1 -t 0 --verbose 0


If you want to take screenshots in reaction to a button press or do anything else fancy that would be a Python script.  I haven't done that as I haven't had the need, but from a quick google around it is pretty simple.

You can also just take a screenshot with the libcamera commands at the shell.

I've got my Pi's filesystem set to read-only and to boot straight into libcamera so I can just use the power button to turn it on and off.
 

Offline bostonman

  • Super Contributor
  • ***
  • Posts: 2154
  • Country: us
Re: Raspberry Pi based inspection camera
« Reply #12 on: October 11, 2024, 12:19:17 pm »
Keep in mind, I don't know Python and very little about the Pi.

I mainly know about programming it, however, I've never actually gone through programming one. At the moment I'm working on another project that requires a Pi, but I have the code to burn onto the Pi; just haven't had a chance to start the project.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf