Домой United States USA — software How To: Taking Pictures of PCBs

How To: Taking Pictures of PCBs

281
0
ПОДЕЛИТЬСЯ

I’ve started to develop a strange pleasure for taking pictures of PCBs and I wanted to share my experience. Sure, you can take pictures of PCBs with your smartphone and get nice results. However, if you want repeatable quality and acceptable color, you don…
I’ve been taking pictures of circuits as part of the (now defunct) Omzlo One Kickstarter and the new follow-up «Skware» CAN-bus IoT project we are building. I’ve started to develop a strange pleasure for taking pictures of PCBs and I thought I’d share my experience. Sure, you can take pictures of PCBs with your smartphone and get nice results. However, if you want repeatable quality and acceptable color, you don’t need to break the bank but you will need a bit more gear.
Editor’s Note:
Guest author Alain Pannetrat is a self-described digital electronic fanatic who is currently working on an open-source/open-hardware Arduino-compatible IoT platform based on CAN-bus. You can follow Alain at his website Omzlo.com as well as Twitter and Github .
My recommended setup has only 3 elements:
In fact, you don’t even need a DSLR. Any advanced point-and-shoot camera that has a zoom should work just as well. Warning: If you’re an advanced photographer with professional lighting, macro lens and a studio, this article might hurt your eyes.
Now we can walk through taking pictures of PCBs in 7 steps:
All those steps may sound like a lot of work, but once you establish your routine, it just takes a few seconds to make a shot and a few more minutes with GIMP before you can upload your new project picture to your favorite website.
To take pictures of PCBs or products in general, it’s good to have a diffused soft light source that comes from all directions uniformly. You want to reduce shadows as much as possible. A strong directional light will often create shadows, hiding details of your PCB, such as pins or components.
The solution is to use a light box, which is typically a box made of a white translucent material which is illuminated from the outside in order to give objects inside the box uniform lighting (see here for an example) . There are plenty of tutorials on the net for building a light box. Just Google «diy light box».
I built mine with 2 cheap outdoor square led panels and some scrap wood. The led panels produce diffused light and are placed on each side of a square box. The picture below shows the assembly almost finalized.
The led panels are directly plugged into the wall and can be switched on or off like a desk light. This setup is simple, solid, self-contained and easy to move around, which perfect in our small garage lab.
When taking pictures of PCBs, you typically have two options for a background: black or white. This is a matter of personal taste and style, but I found that there are minor pros and cons for each.
White backgrounds are ubiquitous in electronics: see SparkFun for example. The advantage of a white background is that it’s easy to remove later in GIMP to create a transparent background. You can then create a transparent PNG/GIF image of you PCB and merge it with an existing background on a web page. On the downside, a white background will be very sensitive to any projected shadow from your PCB. To avoid projected shadows, it’s best to avoid resting the PCB directly on the background: raise it on a small object, to create a distance with the background, as shown in the picture below.
Black or dark gray backgrounds give your picture a more specific style, check out Adafruit for example. They are less flexible in terms of integration in web pages. On the other hand, they are also more forgiving of shadows: you can directly rest your PCB on the background without much worry as shown on the picture below.
Most cameras today are quite smart and they will automatically calculate the correct exposure for your shot. Beware that in some cases, the use of a black or white background can confuse your camera. A white background can cause your PCB to look too dark, while a black background may cause your PCB to look too bright. If this is the case, you can typically set your camera to underexpose or overexpose the shot a little to correct the problem.
When taking a portrait of somebody with a camera, rather than getting close to the subject, it’s best to zoom as much as possible and step away as much as needed to frame the person’s face in the camera. This gives much more flattering results by reducing distortions. The same applies to taking pictures of PCBs.
The actual zoom focal length range of a camera is influenced by several factors including the sensor size and the optics of the zoom. A detailed discussion of focal length is beyond the scope of this blog entry: just zoom as much as possible! My DSLR has a zoom with a focal length that goes from 17mm to 50mm, on an APS-C sensor (equivalent to 26 to 75mm on a 35mm film frame) . I always zoom all the way to 50mm to take a picture of a PCB.
The picture below shows roughly the same picture taken with two different focal lengths. On the right, the picture is taken with a 12mm focal length, using a wide angle lens. On the left, the picture is taken with a 50mm focal length, using my zoom at maximum focal length. As you can see, the picture on the right has much more distortions: pin headers seem to be bending outwards.
You could argue that the picture on the left has still a bit of distortion, but I think it’s good enough for showcasing a PCB.
You want all of your PCB to appear in focus. The depth of field — the depth of what appears in focus on the picture — is controlled by the aperture on your camera. You want to reduce the aperture while maintaining a reasonable shutter speed. If it sounds gibberish to you, just look at your camera settings display:
You want the aperture number to be as high as possible: higher means a smaller aperture. But there is a link between speed and aperture: the smaller the apertures, the lower the speed. And when the speed gets too low, the camera will record the involuntary movement of the photographer, resulting in a blurry picture. As a rule of thumb, you don’t want to go much below a speed of 1/50th of a second.
The picture below shows the same picture with 2 different apertures:
While both pictures show the circuit board in good detail, the picture on the right has less depth of field. Some components such as the DC barrel jack or the bottom female headers are a bit blurry.
On DSLRs and advanced point and shoot, you can set the camera in a mode where you can control the aperture: it’s typically called mode «A». I usually pick an aperture between f/8 and f/11, which results in a speed between 1/50th and 1/100th of a second with my light box. Stronger lights will give you more flexibility.
Now you put you PCB in the light box, take a picture and view the corresponding JPEG file on your computer. In some cases, you might be surprised that the image has a strong color cast: it might look more yellowish or blueish than what you «saw» when you took the picture…
There are several reasons for this difference.

Continue reading...