May 29, 2014

DIY USB soldering microscope

I've been looking for a decent and cheap USB microscope for SMT soldering. Many of these 50-100$ Chinese microscopes have quite poor working distance, resolution and image quality so I thought to try make one by myself.

A webcam should work quite nicely as a camera sensor because they should work almost everywhere without fiddling with drivers or viewing programs. Logitech C270 is quite inexpensive and it have 1280x920 resolution. A bit of googling also revealed that it doesn't have any too fancy autofocus features that could cause problems later. Estimating the delay between camera and monitor from internet reviews was quite hard but it seems to be in tolerable level.

The lens is maybe the most critical part of the system because it defines the working distance and the amount of light that gets to image sensor. I came across the 50mm F1.4 CCTV lens from dx.com which seemed to be quite good for this project. 50mm may not sound like much enough for proper zoom level but this 50mm is with 2/3" image sensor. If the sensor is smaller, also the effective focal length gets greater because of cropping factor. I estimated that it should correspond something like couple of hundreds millimeters focal length with C270's image sensor. Minimum focus distance of this lens is ~30cm. It's a bit too long but focusing range can be modified by moving the sensor closer or further away from lens. The lens have adjustment rings for aperture and focus so finding the best configuration shouldn't be too hard. The lens package contained a threaded macro adapter so now theres also complete lens mount for my camera casing.

Click to enlarge

After taking apart the webcam and checking that everything works as planned, I got small black plastic case from local electronics store, drilled coule of holes, glued macro adapter to it's place and installed 1/4" tripod threads to case.

3. 85x55x30mm WCAH2855 plastic case

Total: ~ 63€ / 86$

Image quality, depth of field and delay is certainly good enough for typical hobbyist-level SMT soldering but I found that I'm still using bare eye for soldering because it's just more handy unless parts are 0402's or smaller. For after inspection and troubleshooting this is very useful. And if not else, it's still quite nice toy!

Click to enlarge
I've tried couple of softwares that are capable of showing webcam view. VLC had horrible delay, VirtualDub works fine but it doesn't allow real time effects like flipping the image horizontally and vertically (handy if the object is between you and camera as in the picure above). Open Broadcaster Software have also webcam input and it allows real time image flipping so I ended up using it in preview mode.

Edit 1: VirtualDub manages also real time effects! See instructions in comments below.

Edit 2: As one of the readers pointed out in the comments section, I forgot to mention that removing or covering the green led on the PCB might improve the image quality (reduces the amount of unwanted scattered light inside the box).  


 *A few glitches in video are caused by recording software, not the camera itself.

76 comments:

  1. I'll try it , i'm going in the same idea but for faster response i'll go with the c920 USB 3.0 full HD model.. For the lens i'll try your advice altough my first plan was to be using projector lens.. Thanks. Keep going..

    ReplyDelete
    Replies
    1. Nice :) Let us know how your "hi-fi" version compares to C270 image quality! I think that the adjustable aperture of this lens is quite significant feature because with it you can find the best compromise between field of view and brightness of image.

      Delete
    2. i 've try a very low cost version ;)

      low cost webcam (10years old)
      very old lens kit (25mm lens)
      kind of http://www.danstacuve.org/wp-content/uploads/2014/03/2013-10-28-17.22.37-2.jpg
      pvc tube
      http://i2.cdscdn.com/pdt2/5/7/5/1/700x700/sil5060012957575/rw/bobine-soudure-etain-20g.jpg


      + some ingeniousness of course ^^

      i've magnitude as good as yours(but of course worse image quality< my webcam is awfull, 640x480max resolution :p)

      thx

      Delete
  2. Thanks for a very nice article.

    I have a C270, which i have removed the board and lens from. I also have a 50mm lens that looks the same as yours, but I can't seem to focus on anything. How close is your lens to the sensor?

    Regards,

    Les

    ReplyDelete
    Replies
    1. The distance between lens and sensor is something like 25-35mm. Small difference shouldn't make it impossible to focus, but it should affect to min and max focus distance. Make sure that your case doesn't let excess light to sensor, use relatively small aperture if configurable and make sure that the sensor is relatively close to the center of lens.

      Delete
    2. Thanks for the reply. I was just testing on the bench, which is probably where I was going wrong.

      I have now got something working in a case but it needs work. Any particular settings you suggest on the software side?

      Regards,

      Les

      Delete
    3. VirtualDub is the best I've found (if real time flipping/rotating not needed). It allows also adjusting the framerate. Slower FPS = brighter and less noisy image, faster FPS = darker image but better motion response. Logitech drivers also have some brightness/gain/contrast settings. I prefer fixed colour settings and auto brightness control..

      Delete
  3. Thanks for the tips. FYI you can flip in VirtualDub.

    Choose Video>Filter chain>Filter list and add the flip filters. Next Video>Filter chain>Enable. Finally make sure Video>Preview acceleration is not turned off.

    Regards,

    Les

    ReplyDelete
    Replies
    1. Thanks Pointy! It really seems to work. More of that watching mode should be "preview" instead of "overlay" from video menu.

      Delete
  4. Thanx for pointing in right direction.
    Already started to make soldering microscope, bought Logitech C315, very quality holder but now have problem with CCTV lens.
    Ordered and paid from DX.com , but....do not have it on stock (it`s not mentioned before order!). For restocking already waiting 10 days...can You recommend some other CCTV lens for this purpose from DX.com with same or even better characteristics?

    ReplyDelete
    Replies
    1. It's not uncommon that DX sends you e-mail that they still doesn't have the item and if you want to change it.. and the item ships in a few days after that. Especially if the stock status of item is still "Ships within 7-10 business days" etc. instead of "Sold out". If you want to change it, I think that any ~2/3" (sensor size), 25-75mm lens with adjustable focus distance control ring are more or less appropriate. Aperture control and relatively short minimum focus distance (<50cm) would be also quite nice.

      Delete
  5. Do you have a Twain driver for the camera? If the answer is Yes, so you can download a program which is used for another camera .. It is downloadable and a great tool for microscopes.
    Search for ToupView

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. If you need lenses i can recomend this Dutch guy
    http://www.marktplaats.nl/a/audio-tv-en-foto/fotografie-lenzen-en-objectieven/m950458290-macro-zoomlens-c-mount-aansluiting.html?c=4dc4183dfac1254e7aa85845826d5acd&previousPage=mympBuyer
    He is selling lenses that where part of reading aids for visually impaired.

    ReplyDelete
  8. I did it. Here is the result. Thanks
    https://www.youtube.com/watch?v=GpA9r31mSs0

    ReplyDelete
    Replies
    1. Thanks for posting the videos! Seems very decent quality! :)

      Delete
  9. Another movie:
    https://www.youtube.com/watch?v=A20cyCnVsLU
    Logitech C270 webcam - The webcam i bought in a local store for = U$ 25
    http://pt.aliexpress.com/item/Black-camera-lens-50mm-f1-4-CCTV-Lens-for-Nikon-1-C-Mount-to-Nikon-1/2043358927.html

    ReplyDelete
    Replies
    1. Hey Reginaldo! What stand for microscope do you use?

      Delete
  10. Hi,
    Awesome project! I wonder if a lens like the one bellow could give even better results (better magnification; also varifocal):
    http://www.ebay.com/itm/8X-100X-55mm-290mm-C-mount-Zoom-Glass-Lens-for-Industry-Lab-Microscope-Camera/310782394650
    It might have a lot of vignetting though, I guess (I'm still digging for the datasheet). I'd appreciate some feedback on this. Thank you in advance.

    ReplyDelete
    Replies
    1. Hard to say based on that info. Aperture and focus rings are nice but I don't know if that have them. At least some microscope lenses have fixed focus and you are supposed to move whole microscope head. Works as long as the mechanism moves firmly only in up-down direction (your object doesn't get lost easily while trying to move whole camera). Couldn't see the sensor size of the camera, where you are supposed to install that lens but at least most webcams have so small sensor that I wouldn't believe that vignette could be a big problem.

      Delete
  11. I've been looking for a decent and cheap USB microscope for SMT ... cmicroscope.blogspot.com

    ReplyDelete
  12. And you can adjust the picture close far away, or fixed only on video?

    ReplyDelete
  13. I found a cheap zoom lens: http://www.amazon.co.uk/Tamron-55-200mm-4-5-6-MACRO-Canon/dp/B000CE8IVM
    Will the zoom? To see and adjust the range of SMD soldering process on the screen?

    ReplyDelete
    Replies
    1. Don't know about DSLR lenses. Someone should try :) At least this doesn't seem to have manual aperture ring. The depth of field could be quite bad if it's all the time at max F/4 aperture. Zoom should work, but again, don't know if that top one is manual focus ring, and if it's "mechanical" and works without camera attached. At least quite many Nikon lenses have mechanical focus ring.

      Delete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Thank you for the great information. I am wondering if I could modify and use my GoPro Hero 4 silver camera imaging sensor for the same purpose.

    Best Regards,
    Aashish Shrestha

    ReplyDelete
    Replies
    1. I guess, should work with any camera with live view if bypassing the auto focus mechanism doesn't cause error messages / prevent booting up. But I think that for the same price you could get a lot better options for this purpose.

      Delete
    2. Thank you very much for the prompt response Petteri!!!
      I was up all night yesterday looking to modify my GoPro 3+ and I came across this back-bone.ca website where they sell the mods for $150 parts only and the lenses are like $200-$400.

      By the way why was the 50mm F1.4 CCTV lens chosen and not other lenses?

      Delete
    3. Short min. focus distance, variable aperture, and 50mm focal length combined with the sensor size of the C270 webcam gave adequate zoom level (smaller sensor gives greater zoom with the same focal length).

      Delete
    4. Thank you. Here is the calculation I have done for a GoPro Hero 3+ camera which has 1/2.3" image sensor given,
      Working distance=300mm
      Object size or length of the board= 150mm

      Converting 1/2.3" to mm=11.041mm

      Apply it to this equation,
      Focal Length= (working distance x image sensor size)/(object size + image sensor size)
      =20.56mm

      So I will be using a C-mount lens with approximate 20.56mm focal length.

      Please let me know what are your thoughts on this...
      I will be using the set up if usable repairing smartphones, laptops motherboards.

      Cheers,

      Delete
  16. Petteri: You rock, eli jäbä rokaa. Great project! Managed to find an old 50mm Nikon lens from way back when. Manual focus and aperture. Going to get a C270 next. Tried the project with an old VGA-webcam, but the quality was not good enough.

    ReplyDelete
    Replies
    1. Thanks! Have you tried it already with the C270? How was it?

      Delete
  17. This comment has been removed by the author.

    ReplyDelete
  18. when i remove the logitec lens i get nothing looks like my 50mmf1.4 lens is doing nothinhg, but with logitech small lens on, i atleast get a magnified picture but even in that case get sharp picture only from about 50mm away

    ReplyDelete
    Replies
    1. That should be fixed by adjusting the lens-sensor distance. A couple of cm should be fine, but even small variations can change the "working distance" quite much. Make sure that the lens is centered to the sensor and there is no light leaks in your camera box. Remove the logitech lens because it impairs the image quality.

      Delete
    2. Thanks for reply. I was trying with logitech C310 before, model C270 in on the way, Shall update with final result within couple of days time.
      Thank You..

      Delete
    3. Hi guys, i was making the mistake of expecting it work without the mounting box. I was holding the camera sensor in hand and lens in front and was getting no image at all.
      when i placed camera inside the box, at about 22mm from lens, ensuring no light leak, adjusted shutter to minimum possible aperture, working distance about 230mm , tried to focus the lens........... I got good results
      I am loving the working distance part of it and yet the clarity.
      Thank You Thank You

      Delete
  19. Did anyone tried Aliexpress lens? http://pt.aliexpress.com/item/Black-camera-lens-50mm-f1-4-CCTV-Lens-for-Nikon-1-C-Mount-to-Nikon-1/2043358927.html

    ReplyDelete
  20. Finally I have found something which helped me. Appreciate it!
    Nikon microscope

    ReplyDelete
  21. Recently found decent lens to be used with CS-mount cameras. Check this review for sample photos. Focus distance is 10cm! http://kurokesu.com/main/2016/07/19/review-microscope-lens-for-smd-inspection/

    ReplyDelete
  22. What do you think of this kit?
    http://lukse.lt/uzrasai/2013-07-modifying-logitech-c920-to-for-cs-lenses/

    I've been looking for an alternative kit to the microscoft life cam camera
    http://www.diyinhk.com/shop/usb-microscope-1080p-for-smt-soldering/51-lifecam-studio-1080p-microscope-lens-mod-kit.html

    ReplyDelete
    Replies
    1. Hi Ben. Microsoft life cam is pretty old one and does not provide quality picture. That's why I have chosen C920 as a base camera for rework kit. Also made my own Kurokesu C1. Fell free to ask if you have any questions.

      Delete
  23. Hello, very interesting project! I have a Logitech c310 and I will try it with this lens, but it's for 4/3" is it a Problem? http://www.ebay.de/itm/191944445899

    ReplyDelete
    Replies
    1. I think that the 4/3" format lens shouldn't be a problem :) You'll get just more magnification since your sensor is using smaller part of the image circle than full 4/3" sensor. Although the sensor sizes aren't 2/3" and 4/3" in the picture, the principle is the same https://cdn.photographylife.com/wp-content/uploads/2014/06/Sensor_vs_Size.jpg

      Delete
  24. Thanks for your answer! ...and of course there isn't a macro lens Adapter. Is it necessary for the whole function? Thanks in advance!

    ReplyDelete
  25. ... because you wrote: "The lens package contained a threaded macro adapter so now theres also complete lens mount for my camera casing." And "...glued macro adapter to it's place and installed 1/4" tripod threads to case."
    Just to be sure ;-)

    ReplyDelete
    Replies
    1. I used the lens adapter only as a threads/mount for the lens, so I didn't have to glue the whole lens to the plastic casing permanently. You can certainly do the same thing without the adapter, if you have something to keep the lens in right place

      Delete
  26. I'm planning on using a C920 and I think this is the same lens.

    https://www.amazon.com/Fotasy-L5014-Panasonic-Olympus-Cameras/dp/B007SGGMU6/ref=sr_1_7?ie=UTF8&qid=1473083710&sr=8-7&keywords=50mm+C+lens+mount

    Of course more expensive than DX but prime shipping is quick.....

    Any reason why this combination wouldn't work fine? Advice?

    Very interesting post!

    ReplyDelete
    Replies
    1. Thanks! Looks very similar as mine / should work just as well :) If you can get one with a lens adapter and similar price, you'd have also a handy lens mount to be glued to your plastic case. But of course you can improvise the lens mount even without the threaded metal ring.

      Delete
    2. I'm going to try one of these C920 kits. These aluminum cases look pretty sweet. Has anyone here tried them? (Sorry Saulius you don't count!) :)

      Delete
    3. Link included this time. :)

      http://www.kurokesu.com/shop/diy_kits/KITC920

      Delete
  27. Hi Petteri Liikkanen, Thanks for intresting tips.

    I’m looking for built something like this.

    I’ve found the Microsoft Lifecam Hd 5000 used for 10€. Do you think I can use it for the project?

    And what about an Fujian 35mm f1.7? Is a good lens for this?

    https://pt.aliexpress.com/item/Fujian-35mm-f1-7-C-Mount-CCTV-Len-for-GH1-GF1-NEX-3-5-E-mount/32371737917.html?spm=2114.02010208.3.1.s9rbmL&ws_ab_test=searchweb201556_0,searchweb201602_4_10057_10056_10065_10068_10055_10054_10069_301_10059_10033_10058_10032_10073_10017_10070_10060_10061_10052_10062_10053_10050_10051,searchweb201603_4&btsid=5907582d-6983-40c3-ae25-4339dfb084ed

    People talk very well about this lens. http://www.getdpi.com/forum/sony/34246-nex7-fujian-35mm-1-7-a.html

    Thanks for the idea.

    ReplyDelete
  28. Hi there,

    For pictures of a C920 modification using the aluminum Kurokesu case and Nikon lenses, please see my blog post below.

    http://www.techtravels.org/?page_id=1799

    Thanks and let me know what you think!
    Keith

    ReplyDelete
    Replies
    1. Looks really nice! Not bad idea to use high quality Nikon lenses if already having a DSLR & gear.

      Delete
  29. Can anyone add the actual step-by-step photos? So we can see lense mounting, setup, etc?

    ReplyDelete
  30. Good job! I loved it and continue your passion.

    By the way, For more interesting and good quality of 3D printing, metallurgical microscope, and industrial inspection microscope.

    Visit our website : https://www.bioimager.com

    ReplyDelete
  31. Please I need answer: If distance between ccd sensor and lens is increase then working distance is increase or decrease?

    ReplyDelete
    Replies
    1. If you increase the lens-sensor distance, then the min & max focusing distances comes closer to the camera and you get greater magnification. But as a disadvantage, the amount of light decreases and you need higher digital gain (=noise) or larger aperture (=shallow depth of field) https://www.youtube.com/watch?v=dNeTFbJ9YVw

      Delete
  32. Thanks but I do not understand exactly. Magnification is not important. Working distance is when you soldering, you need space between PCB board and lens to put some tools. So again, simple question: for greater working distance
    1. increase distance between sensor and lens for few millimeters
    2. decrease distance between sensor and lens few millimeters

    Thanks

    ReplyDelete
  33. I just finished this project using a HP 3100, HD widescreen & 50mm lens. Working distance is 8" to 10". Works good but the clarity is not quite what I want but close. Not sure if its the webcam. I just purchased a used Logitech 920. Has anyone completed this project using the C920 ?

    ReplyDelete
  34. Scroll up a few comments and see my link to my C920 implementation.

    ReplyDelete
  35. I just built the project using the Logitech C270 webcam. I have a green colored LED attached to the board near the sensor that's emitting. Should this be blocked out? I have a decent image but it looks washed out. Could the LED be the cause?

    ReplyDelete
    Replies
    1. Might be, try to cover it with tape or take it off? Obviously also the case should be light-proof and the lens should be centered properly. Large apertures (like f/1.4) will narrow the depth of field but depending on the lens, it can also cause "washed out" look

      Delete
    2. I have used all the components in the BOM you provided. You hadn't mentioned the LED on the board so I was unclear if it was on your build? Perhaps the LED was a revision. It would make sense that LED is making light inside the box. Thanks for the quick reply. I will cover it an post back.

      Delete
    3. Thanks for the correction! Just checked out my C270 PCB and noticed that I forgot to mention that I removed the led, or actually the current limiting resistor next to it. Added an "edit" section to the blog post :)

      Delete
    4. Hey Petteri I found a lens locally here: http://www.ebay.com/itm/2-3-Television-TV-Lens-CCTV-Lens-for-C-Mount-Camera-50mm-F1-4-in-Black-/361919293418?hash=item54441227ea:g:q7UAAOSwXYtYuen4
      But it doesn't include the macro ring to use as mount in the case. What size thread should I look for on the ring? Thanks

      Delete
    5. I'd find just a C-mount adapter from ebay. https://en.wikipedia.org/wiki/C_mount " The thread is nominally 1.000 inch (25.4 mm) in diameter, with 32 threads per inch, designated as "1-32 UN 2A" in the ANSI B1.1 standard for unified screw threads."

      Delete
    6. So you're saying any C-mount adapter would work? Also take a look at this below:
      https://www.amazon.com/SainSonic-50mm-CCTV-Cine-Lens/dp/B00CWQD86S/ref=sr_1_fkmr0_1?ie=UTF8&qid=1490118278&sr=8-1-fkmr0&keywords=50mm+F1.4+C+Mount+CCTV+Lens+Set+w%2F+Macro+Ring+for+MILC
      Any idea if this has a image sensor and what size that would be? Not mentioned. It's really cheap at $25 on Amazon and was wondering if it'd fit.

      Delete
    7. OK bought the 50mm lens it's exactly like yours so it should be the 2/3, got the M4/3 C mount ring, got the black box and am using the Logitech C615 1080p webcam. Hop it will all work out.

      Delete
  36. Hello Petteri I forgot to ask, in your opinion what magnification does the lens provide when it's compared to a lets say stereo microscope. A decent one has x45 zoom magnification at only 4" distance. Did you ever think to compare?

    ReplyDelete
    Replies
    1. Yes I was lucky and found a bargain Leica M3Z Wild stereo microscope (6.5-40x zoom) after writing this blogpost. I think, the zoom level of my C270 mscope is something between the min and max zoom range of the Leica. I'd say that the magnification of the digital mscope is just perfect for 0603/QFP soldering, not too high (shaking and finding the correct position from the PCB becomes a problem) and too low (can't see components or solder bridges properly). But of course this cannot be compared to Leica stereo microscope especially when doing thing on "live". Leica wins 100-0. I use very rarely the max 40x zoom on the Leica because it's just too much unless you are doing 0201 / 01005 stuff.

      Delete
  37. thank you for posting this idea


    I'm looking for this lens on eBay and there is a lot I've found this one :
    Look at this on eBay http://www.ebay.co.uk/itm/172540127750

    is it the same please?? I'm so confused

    ReplyDelete
    Replies
    1. Lens and the specs looks very similar, so I believe, it's the same lens / should be fine. Although that doesn't have the threaded ring with it, but shouldn't be a problem if you have some mounting mechanish for it

      Delete
  38. Hello,

    You probably knows the crappy chinese 500x, 1000x "microscope usb". It all use a 0.3mp camera sensor.
    I would like to know, what will happen if I remove the lens of this usb microscope and put a better lens, like yours ?
    Do you think I will be able to have more distance between board and microscope for soldering ?
    Thanks for your opinion,
    Leonardo

    ReplyDelete
  39. As we know soldering is little bit more difficult especially when working with SMT devices. But now the technique changes due to change in technology and we shift to Digital microscopic world which works well for PCB's soldering and this have a great manual focus that will usually work from a couple distances.

    ReplyDelete