Raspberry Pi based inspection camera - Page 1
Forum section: electronics / general

author: Leiothrix
author_rank: Regular Contributor
timestamp: October 04, 2024, 12:03:44 am
content: 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 itIt 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.

author: RoGeorge
author_rank: Super Contributor
timestamp: October 04, 2024, 07:54:50 am
content: Nice setup.

author: Bryn
author_rank: Regular Contributor
timestamp: October 04, 2024, 07:57:59 am
content: Quote from: RoGeorge on October 04, 2024, 07:54:50 amWas going to say the exact thing 😅

author: bostonman
author_rank: Super Contributor
timestamp: October 04, 2024, 02:15:45 pm
content: 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.

author: Leiothrix
author_rank: Regular Contributor
timestamp: October 05, 2024, 12:10:27 am
content: The list of parts is roughly:Raspberry Pi 3B+. It's what I had, I'm sure other variants will be fine too.Raspberry Pi HQ Camera20cm CSI cable for camera10-55mm lens with aperture control. The one I got washttps://www.aliexpress.com/item/1005006808578387.html?spm=a2g0o.order_list.order_list_main.76.18fb1802IPYBC8Arca-Swiss 120mm clamp to hold the rail to the shelfArca-Swiss 300mm railArca-Swiss 90 degree double clampArca-Swiss 115mm adjustable stageThe 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.

author: bostonman
author_rank: Super Contributor
timestamp: October 10, 2024, 06:16:04 pm
content: 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.

author: thm_w
author_rank: Super Contributor
timestamp: October 10, 2024, 07:46:52 pm
content: The raspberry pi hq cam is this one:https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/12MP-IMX477/It says IMX477, 1080p 30fps maxIs 50fps real?

author: Leiothrix
author_rank: Regular Contributor
timestamp: October 10, 2024, 08:18:04 pm
content: Quote from: bostonman on October 10, 2024, 06:16:04 pmThe 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.Quote from: thm_w on October 10, 2024, 07:46:52 pmThe 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:libcamera-hello --list-camerasAvailable cameras-----------------0 : imx477  (/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.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2024, 01:02:06 am
content: 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.

author: Leiothrix
author_rank: Regular Contributor
timestamp: October 11, 2024, 02:20:22 am
content: 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.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2024, 03:04:44 am
content: 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.

author: Leiothrix
author_rank: Regular Contributor
timestamp: October 11, 2024, 04:05:26 am
content: There isn't much to thisI 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:libcamera-hello --width 1980 --height 1020 --framerate 50 --viewfinder-mode 2028:1080:10 --hflip 1 --vflip 1 -t 0 --verbose 0You can use a different video mode to have a cropped video / digital zoom.Code:libcamera-hello --width 1980 --height 1020 --framerate 60 --viewfinder-mode 1332:990:10 --hflip 1 --vflip 1 -t 0 --verbose 0If 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.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2024, 12:19:17 pm
content: 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.