The lighting rig created here is suitable for a range of tasks where you want a diffuse light source.
A perfect diffuse light (also called ambient light in 3D graphics) comes from all angles and won't cast shadows or have strong bright reflections. Contrast this with a point light, like the sun that casts strong shadows and creates strong bright spots on reflective surfaces. If you've ever been on a skiing on a grey day, you will have experienced diffuse light and the lack of shadows cast in the all white snow makes it really hard to see the bumps.
When photographing indoors, you get an approximate point light when you use a flash gun, and a more diffuse light when you bounce lights off the walls.
Why You Might Want a Diffuse Light
Diffuse lights are great for when you want:
- No specular reflections (bright spots on shiny surfaces such as metal)
- No shadows
Look at the sample images of resistors (the black small rectangles). The two with a brighter red background I created and show strong shadows and specular reflections. Contrast with the last image which has much weaker shadows and no noticeable specular reflections.
Approximating a Diffuse Light
In this project, we're not going to create a perfectly diffuse light, but make something that looks similar. By placing lots and lots of point lights (LEDs) around the subject. Ideally we would place the lights all around the subject, but in this case I wanted to try leaving a lot of vertical clearance between the light and subject as in the long run it will be mounted on a moving platform. So we we will mount all of the LEDs on a flat board. A flat board will also be quicker and easier to make.
A common commercial, off-the-shelf option for SLR cameras is a "ring flash", which creates a ring of light around the lens to create a similar effect.
It would be very easy to extend this project to make a cube out of several boards to make the light come from all sides.
Time, Cost and Expertise
This project should only take a few hours once you have bought the materials. It requires a very basic knowledge of electronics, soldering skills and cutting with a sharp knife. Total cost for me was <£10, but a few pounds extra to include a 12V power supply may be needed.
Step 1: What You Need
- 5m tape of white LEDs with sticky back - ~£6 on eBay. I bought these in Day White.
- A3 sheet of white foam board (or A4 if making a slightly smaller version) - foam board with paper/card on the outside. Available on eBay or at art / craft shops. £1 per sheet.
- 12V power supply - to match the above LEDs, must be >1.5A. I used an old PC power supply.
- Soldering tools
- Some wire
For the power supply, it is safest to match its voltage and current rating to that of the whole tape of LEDs you bought, but if you only need a fraction of the LEDs, say half, then you only need that fraction of the rated current but the same voltage. In my case I needed 1.5A at 12V. It is safe to have more current (Amps), but not safe to have more voltage (V).
Step 2: Test Everything Works
When checking the wiring later, it is important to make sure that you haven't connected the + and - sides of the LEDs together. You can do this using a multimeter and using the diode check function. Place one test probe on the + side, and one on the - side, and then switch the probes round. My multimeter beeps for a correctly orientated diode (an LED is just a diode), but because of the way they are wired in the tape (three in series), it won't beep whichever way round you put the probes. If you always get a beep, whichever way round the probes are, then you have a short circuit, and it's time to check your wiring / soldering. If your multimeter doesn't have a diode test function, then you could use the resistor checking / ohm meter - if you get a low resistance, there's a short.
Given we haven't yet done anything to the LED strip, you could connect it straight to the power supply, but it's good to see what the correct readings from your multimeter should be. Later, it will be really important to stop you destroying your LED strip and maybe your power supply (I didn't follow this and blew a short strip of LEDs!).
Once you've checked the wiring, connect the +12V terminal of the power supply to the + side of the LED strip and the ground / 0V terminal of the power supply to the -ve terminal of the LED strip. Don't worry, if you wire them the wrong way round nothing will happen, so if it doesn't light up, change the terminals round.
Step 3: Design and Mark the Shape of Your Light
I decided that 25cm x 25cm was a good size based on how far away from the subject I wanted the light and my space constraints. An important consideration is that the LEDs come with specific breaks where you can cut them. In my case this was every 3rd LED. You want to make your board width slightly larger than a whole number of these sub-strips. So 25cm was partly about having 5x3 = 15 LEDs across.
I also decided to cut a small notch in the rectangle for my tripod to fit into. Okay, so this was added once I realised that it wasn't going to fit!
We're going to cut the shape into the white foam board, so mark the board with pencil (so you can rub it out!) and get ready to cut it. I used quite a lot of guide lines / markings that aren't going to be cut to make it easier to mark out the board accurately.
Step 4: Cut the Foam Board
Try to keep the cutting angle fairly shallow (maybe 45 degrees to the surface) and if you find the knife sticking you can cut the top layer of card first and then dig deeper on a second go to cut through to the bottom. I found cutting in two goes was good for the more tricky curves.
Step 5: Add the LED Strips
Remember that you need to cut the LED strip in the marked locations. This means that you won't fill the whole area around features like the circle in the middle. I could have added another small strip going at right angles to the right of the other strips around the hole to fill in the gap, but I got lazy!
We're going to connect all the +ve terminals to each other, and then all the -ve terminals to each other. We're trying to make it the same as if the strip hadn't been cut.
I decided to wire them so that all of the +ve connections were wired down one edge and all the -ve connections were wired down the other edge. This means that you can just use a long bare wire, rather than lots of small sections of wire. Make sure you stick all the LED strips with all the +ve terminals on the same side so that it's easy to check that you have wired it up correctly. Of course, when you break the strips to go around the holes, then you need to add in extra connections where those breaks are. It's easiest to see what I've done in the photograph.
I've split it up into two steps, but it's best to put down the first couple of strips, solder them and check that it works before sticking all of the strips on.
Step 6: Solder the LED Strips
It wasn't as easy as expected to solder the LED strips. Despite having specially marked solder pads, they have a thick layer of resistive lacquer on top that doesn't budge easily. I experimented with scratching the lacquer, using bigger solder blobs etc and the technique that I ended with was simply to apply heat with a moderate sized blob of solder for much longer than you normally would. Eventually the solder will descend through the lacquer to the copper beneath.
Test Test Test!
As you solder the board, keep checking your wiring using the multimeter and connecting the power supply. I found that I made a number of mistakes, and if you have wired everything up, it will be extremely difficult to find where you made the mistake.
I frazzled a small strip by not wiring it properly and then not testing properly.
If I was to improve the design, I would split the LED strips into blocks of a few of them, which get connected up only at the last minute. This would make it easier to locate the source of problems.
Step 7: Power It Up and Build a Stand
A neater version would create some nice terminals to connect the power supply, but I opted for the much simpler (and less robust) crocodile clips for the time being.
How you mount it will vary for your particular use case. It's very light, so you can suspend it with strings, tape, or in my case I bent a few hangers to make a quick and easy stand. As you can see, my camera and tripod work with it nicely.
Step 8: Evaluate the Results and Consider Improvements
If you look at the images of resistors taken from directly above, you will see that the shadows are virtually imperceptible, but there is a small amount of specular reflection on the edges of the black parts of the resistors and on one resistor in particular that doesn't lie flat. The text is clearly readable and the edges very clear on all, but the angled resistor. The background surface, which I changed to a small-pore foam, called Funky Foam (around 50p per sheet), also works well having virtually no white specular reflection. If we're really picky, looking at the silver legs of the square microchip, you can see black areas (reflections from the dark area beyond the light).
Images from the side (which aren't of such interest to me) show shadows under raised components, but generally are very good. You can see that the light is coming from all sides, reducing the shadow to a small area under the microchip.
Removing the specular reflections would probably best be done with a thin sheet of frosted plastic (or apparently white nylon sheet works) a few centimetres below the LEDs. But you could also increase the number of LEDs used and wrap them more around the sides of the subject. Some commercial light sources are dome shaped, and a similar effect might be possible using an plastic bowl.
Step 9: Bonus Step: Image Processing
To do the image processing, I am using SimpleCV and Python. SimpleCV (Simple Computer Vision) is built on top of the very popular OpenCV.
Install SimpleCV, save the red image of the resistors, then open up the SimpleCV console then type:
>>image = Image("resistor_image_from_instructables.jpg") #file or URL >>hue_dist_img = image.hueDistance(0) #How unlike red is the colour >>hue_dist_img.show()
You should see that the red background has now gone black and the resistors are white. We're successfully differentiating the resistors from the background.
And now for the more complete version, which actually finds the resistors.
>>image = Image("resistor_image_from_instructables.jpg") #file or URL >>hue_dist_img = image.hueDistance(0) #How unlike red is the colour >>resistor_zones_img = hue_dist_img.binarize() #turn into binary image >>resistor_zones_img = resistor_zones_img.erode().dilate() #remove specks of noise >>resistor_blobs = resistor_zones_img.invert().findBlobs() #segment image >>for b in resistor_blobs: >> print "Area = "+str( b.area())+ " Centroid = (%.1f, %.1f)" %b.centroid() >>resistor_blobs.show(width=3)#show the blobs, with a 3 pixel green border
The end result are "blobs". These contain information about the position of the items detected in the image.
These blobs could then be used for tasks such locate the text to read the value of the resistor automatically using OCR, to measure the size of the resistor or to command a robot to pick up the resistor.