How to Take Pictures of PCBs

While we’ve covered light box builds and other DIY photography solutions, general picture-snapping tips and tricks are a bit out of the purview of what we normally write about. Nevertheless, [Alain] just put up a great tutorial for taking pictures of PCBs. This is a great skill to have — no one cares about what you’ve built unless you have a picture of it — and the same techniques can be applied to other small bits and bobs of electronic equipment.

As with all matters of photography, light is important. [Alain] built a DIY light box using two cheap outdoor square LED panels and some scrap wood. There’s really nothing to this build: just build a box that holds soft, diffused light.

A camera is a little more complicated than a box, and here [Alain] is using an entry-level DSLR with a kit lens. The takeaway here is to set the aperture to the highest number (or smallest hole) possible while still keeping a reasonable shutter speed. This increases the depth of field and produces a picture where the board and the tops of components are in focus.

There are a few more tips for getting the best PCB pics possible including shooting in RAW for Aperture or Lightroom, getting a macro lens, and using a tripod. Like all things, there’s a law of diminishing returns, and even with a smartphone camera and a DIY light box, you can produce some fantastic pics of PCBs.

50 thoughts on “How to Take Pictures of PCBs

  1. If you’re struggling with depth of field, the there are tethering apps that can do focus stacking, which with a static scene like this (assuming your camera is on some sort of stand – a beanbag works well in experience) gives you infinite depth of field

  2. First advice of the blogger was to get an entry level DSLR. DSLRs usually have big a sensor. The smaller the sensor, the better the DoF (Depth of Field) for a macro/close-up, so if you have a choice, avoid a DSLR for this particular case.

        1. It’s not a ‘relationship’. They just got caught snogging behind the bike shed.

          Seriously, wiki-fiddlerland really isn’t the best source of information for more ‘nuanced’ subjects such as photography.

          Blogs and/or articles by professional photographers are a much better source. They have opinions, but unlike wiki-fiddlers, they actually do it for a living rather than just regurgitate a well masticated version of what others have written (another plagiarism sandwich Vicar?).

      1. Depth of field depends on the numerical aperture or f number. Both of these are basically the range of angles that the sensor is collecting. The rate of photons hitting the sensor is not important when determining DoF.

        At a given aperture size, a larger sensor will have a larger NA and smaller f# and therefore a shorter DoF. With a big sensor you have to close the aperture (reducing that range of collected angles) to get the same DoF on the same subject as with a small sensor. There’s a mess to get into concerning *effective* f#’s and crop factors and *effective* focal lengths when trying to sort this out with photography equipment. Then we could also go back and forth over the aberrations in DSLR kit lenses vs a cell phone camera lens (field flatness being an important one here).

        If you were doing this for real, you’d be using a telecentric lens to avoid parallax errors. For flat PCBs that is likely small a deviation, too.

        1. Mixing f# and aperture is confusing. f# is a ratio of focal length to diameter. When area is doubled or halved (amount of light is doubled or halved), the diameter is changed by a factor of sqrt(2). Keep doing that and you get the common f numbers.

          I agree about sensor size. I don’t see how sensor size can be involved in DoF.

          1. I thought it sounded odd, too.
            Then I remembered: distance from lens to subject is important, especially with macro photography.

            Having a smaller sensor gives a “zoom” effect, meaning objects appear closer & larger. Even on DSLRs [like my Nikon] there’s a crop / zoom difference between DX and FX [full 35mm] sensor size. Having a smaller sensor means the camera is farther away from the subject [for an image that fills the sensor] – which improves DOF.

          2. All this theory when simple experience would tell you that sensor size play a role.
            And you’d think that people with DSLR cameras would also have some experience with smaller sensor cameras.

    1. You are right in the sense that you don’t need to spend money on a DSLR because this application does not need small DOF. And compact cameras tend to come with a lens that can focus at a shorter distance than non macro DLSR lenses.
      On the other hand if other types of photography are of interest, it may not be the best option to get a compact.

      1. Long flexible tube with a camera and light on one end. Get a good one so at least the pictures worth looking at. Naturally does close-ups pretty well, and can get in areas a regular camera might not.

      2. “…we still talking about boards here?”.. last time they looked up my ends, with one of them thar endoscopes.. there was a disappointing lack of PCBs… looks like I’m not a true android after all. Its at times like this you wonder who your father really was.

  3. @gir a larger sensor has a small depth of field for the same aperture and focal length… which means with a given lens size you get *less* depth of field from a larger sensor.

  4. I shoot photos of my projects and some of the tricks that work for me:

    – never use flash. always use available light.
    – use a tripod and self-timer to avoid camera shake on exposure button press
    – in pshop, one key tool is the ‘shadow/highlight’ tool; it goes by various names but it compresses the dyn range so that the photo ‘fits’ in the light to dark screen or print range. usually I’ll lower highlights so it does not blow-out and I’ll raise the shadow detail so that things look a bit more even.
    – do ALL your editing at full res; also up-res to 16bits per color instead of 8 bits. do your editing at high color and full res, then scale down at the very end and always apply sharpening at the final resolution (unsharp mask).
    – to reduce color noise, use a plugin like noise-ninja or neatimage (for digicams, their sensors do tend to be noisy in chroma)

    final trick: light painting. pick a long shutter speed (go with f16 or something to force a long shutter time) and use a flashlight and ‘bounce it around’ (keep it moving, fast) and light up areas that your available light didn’t reach. try to use the same color of light as ambient (hard to do, though).

    1. One trick I’ve seen used to good effect – not with PCBs – is a ‘pipe-like’ diffuser with a circular ‘daylight’ fluorescent around the outside. Colour correction is done in post processing.

      It worked quite well until someone, naming no names, dropped and broke it :)

        1. lol. Alas no, t’was I.

          One of the photographers had plugged it into the bench next to the one he was working on. I walked in with a large box in my arms and caught the cable with my foot.

          There was quite a lot of shouting…

    2. Good note on the light painting! A high halogen flashlight (if you can even still get those?) and a gel swatchbook (rosco or lee) will help you nail down the color.
      I used the ‘never use a flash’ rule until I got a strobe. Best $150 I spent on photography. Flash on the camera points up and bounces off the ceiling, gets me some front / toplight, and the strobe is pointed away from the subject, bouncing off a nearby wall to get some nice soft keylight.

  5. Keep in mind most lensess peak sharpness/resolving capability is between f8-f11. Stop it down more and you’re getting into diffraction effects that reduce sharpness. This is really only critical if you need an image with excellent detail (like you need to read SMT markings, etc). A quick snap for a low res web posting won’t be high res anyway. As mentioned – really high res images with detail need focus stacking. We have microscopes at work for PCB photography that do the focus stacking and X-Y stepping automatically for us – and spit out a high res detailed PCB image fully processed.

  6. If you have white walls or ceiling around and want to get very good photos (but not extremely professional), i would suggest an external flash instead of a light box.
    And if you are trying to actually build something you will appreciate more being able to get good light without moving or interfering with your construction.

    1. +1 for using bounced flash. I use this all the time with excellent results.


      Shot with f/11, iso 400, 1/200ss, 430ex flash, canon 7D. I think the DoF is plenty at that setting. Lens: Sigma 18-50mm f/2.8 ex @ 50mm.

      I like grey backgrounds better than white ones, its easier on the eyes and exposure is a lot easier to get right. Dark objects also come out better, and white objects don’t disappear in the flood light. YMMV

  7. In order to flatten the perspective, I’ve always used maximum optical zoom, adjusting the distance to frame the shot. For context, I’m typically using old consumer digitals (e.g. powershot 1000as). I haven’t bothered with diffusers or a lightbox (opting to just throw several lower power lights at it, in addition to ambient), but the results of this seem pretty darn good; might have to give this a try, as I have some older boards I’d like to make high-res shots of.f

  8. For those not using fancy cameras, you can still achieve good results with appropriate setup.

    First off, proper light is everything. Don’t use a flash (usually), but make sure you’ve got some good even light. Watch out for reflections when lining up your shot.

    Second, for smaller objects, you typically don’t want a white background, since that can make darker parts disappear into blackness. Choose a neutral background (a piece of cardboard often works well).

    Make sure you choose an appropriate focus point, and hold the camera very still when pressing the shutter button. Preview your results before moving on to make sure you have the detail you need.

    When automatic settings don’t work well, you can either try to find the manual settings, or you can adjust the scene to compensate. Often the latter gives better results.

  9. Highly recommended book for this stuff: “Light Science and Magic: An Introduction to Photographic Lighting” by Hunter, Biver & Fuqua. Good, practical advice with plenty of examples, howtos, and explanations. Available from your usual internet mega distributor. (Wow. Already up to their 5th ed. Maybe I need to update my copy.) Google will happily point you to an online pdf of it too, but do Fil Hunter’s widow and yourself a favour and buy the hardcopy.

  10. Now all i need is a way to attach my camera to the microscope and still get nice pictures out of it. We sometimes get smoke detectors back from customers that they claim are faulty and set off the fire alarm regularly. Usually when we inspect the detectors under the microscope, you can see a lot of nasty, tiny little creatures (mites or something) crawling around. Would be nice to get a picture of them to send back to the customer and tell him to clean theyr premises better. Tryed to get pictures just with a camera and macro lens, but it’s really hard to see these tiny creatures without the microscope.

    1. This is a common misconception, and is naively incorrect. The image size on the sensor is determined by the lens, and remains the same, so will fill a greater fraction of the smaller sensor. Like putting a quarter pint of beer in a half-pint glass instead of a pint glass, you might feel you are getting a larger amount of beer, but that’s naive.

      And the object certainly doesn’t appear closer: the perspective remains exactly the same. independent of sensor size. The perspective and therefore the apparent size of the object is determined by the location of the entrance pupil of the lens, not the sensor size.

    1. Of course it does not: see the response to the exact same comment above.

      To say a smaller sensor makes objects appear closer is exactly the same as saying viewing objects through a toilet paper tube makes them look closer. It’s nonsense.

      Do not confuse cropping the image (or limiting the angle of view) with moving the object (or viewpoint). Maybe cute when a child does it, it’s naive if you’re older than four, and positively obtuse if one believes this when they’re old enough to vote.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s