Category Archives: Photography

Macro Photography Using a Macro Coupler

Sometimes I want to take closeup photos of printed circuit boards to e.g. document broken or incorrectly assembled components. Given the small size of many components (like 0402 or even 0201), a high degree of magnification is often required. I have a 150 mm Sigma macro lens that can do 1:1 magnification from subject to detector, but this is not always good enough, so I was looking for another solution, preferably going up to a magnification of about 6:1 so that a 4 mm subject would fill up the view of my Nikon D300. Also, I did not want to spend too much on new equipment as this is something I do not do very often.

It turns out that there are a number of ways to make existing lenses more suited for macro photography, namely:

  • extension tubes (reduces minimum focus distance)
  • macro bellows (essentially long and adjustable extension tubes)
  • close-up lenses to put on the front of existing non-macro lenses
  • reversing rings to mount lenses backwards
  • macro couplers to mount one lens backwards in front of another

I did some quick calculations (using information from this page) and figured out that extension tubes or bellows would not give me much of additional magnification. They need to be very long to have much of an effect on long lenses and with shorter lenses the focus distance for large magnification becomes very small.

According to a formula on https://en.wikipedia.org/wiki/Close-up_filter, a close-up lens (or close-up filter as it is also called) needs to have a power of 20 diopters to give a 6:1 magnification on my 70-300 mm lens and 33 diopters on my 150 mm macro lens. The problem is that such strong close-up lenses seem to be rare and if they exist they are probably not very sharp.

To get magnification from mounting a single lens in reverse, the focal length needs to be short. From a 50 mm lens, the expected magnification is probably only about 1:1, so this did also not seem like a very good option.

The solution I opted for was instead to use a macro coupler to mount my 50 mm f/1.4 lens backwards in front of my 70-300 mm zoom. A 50 mm lens has a power measured in diopters of 1/(0.050 m) = 20 diopters, so it will act as a close-up lens that powerful, giving a magnification at the 300 mm setting of about (300/50):1 or 6:1.

Since the 50 mm lens has a 58 mm thread and the zoom has a 67 mm thread, I needed a step-up ring from 58 to 67 mm and a 67-67 mm macro coupler ring. I found inexpensive ones at a local Internet shop, http://kaffebrus.com/step-up-ringar-121.html and http://kaffebrus.com/adapterring-koppling-122.html. Total cost was 147 kr or about $18.

This is what it looked like when I used the rings to mount the short lens in backwards in front of the zoom lens on the camera:

50 mm lens in front of 70-300 mm lens.
50 mm lens in front of 70-300 mm lens.
50 mm lens in front of 70-300 mm lens.
50 mm lens in front of 70-300 mm lens.

DSC_6707_sm

One thing that immediately becomes apparent when looking into the viewfinder is how dark it is. This is due to the fact that the 50 mm lens goes to minimum aperture when it is not connected to a camera, so it lets in very little light. There is no aperture ring on this lens, but there is a small lever in the mount that one can manually pull to increase the aperture and I found that it is possible to put a piece of tape on the lever to fix it in a desired position. Small aperture is good to get maximum depth of field, but it can be hard to see the subject unless the lighting is very bright, so taping the lever to maximum aperture while composing the scene and then removing the tape before taking the shot might be a good idea.

Aperture lever
Aperture lever

The aperture of the zoom lens seems to not be very critical, but it should be open enough to not cause vignetting. Also, zooming out far away from 300 mm causes vignetting, so the setup is mostly useful at or close to 300 mm.

It is of course necessary to use a tripod and in order to get as sharp photos as possible, one needs to take every reasonable step to reduce vibrations, like using a remote shutter release cord and the mirror-up mode so that the mirror does not cause camera shake.

A future improvement would be to build a focusing rail and apply focus stacking to get a greater depth of field. Building a stepper motor controlled focusing rail could be a fun project.

Below are some test photos I have taken with the setup.

Millimeter lines on the scale of a caliper. The field of view is about 4 mm wide.
Millimeter lines on the scale of a caliper. The field of view is about 4 mm wide.
Detail from a 100 kr bill.
Detail from a 100 kr bill.
An 0603 inductor and an 0402 capacitor.
An 0603 inductor and an 0402 capacitor.
An integrated circuit I made around 1995 as a project at the university. The technology is 0.8 µm CMOS.
An integrated circuit I made around 1995 as a project at the university. The technology is 0.8 µm CMOS.
Pins of a TQFP package, of which one is broken and another is damaged.
Pins of a TQFP package (0.5 mm pitch), of which one is broken and another is damaged.
Detail from a flower.
Detail from a flower.
Two 0603 resistors.
Two 0603 resistors.
A SOT23 component.
An SOT23 component.

 

Using an IR camera to locate hidden pipes

As a complement to the ad-hoc metal detector I described in the previous blog post, I wanted to have a look at the heat from the pipes of the hydronic heating system in the floors using an infra red camera before I started to drive screws through the floors. As luck would have it, I was able to borrow a thermal camera from a friend. The camera was a Flir E4 upgraded with a firmware hack to get a resolution of 320×240 pixles.

I did not know how well I would be able to see the pipes in the floor using this method, but as it turns out, the camera was very good at showing how the pipes were laid out. The picture below shows a typical example.

Heat from pipes in the floor.
Heat from pipes in the floor.

Before taking the picture, I had placed tape between the metal sheets (i.e. on top of the beams) in the floor, using the metal detector to guide me. Since the heat spreading metal sheets do not extend all the way to the walls and I knew the pipes would turn between the end of the sheets and the walls, I ended the tape strips where the sheets ended. The thermal image confirms that the pipes are straight where there is metal (and tape) and that they are bent and cross the beams where expected near the wall. The IR camera combines the picture from the IR sensor with contours derived from a picture from a visible-light camera and this helps identify the tape and other objects.

The picture below shows how a pipe crosses a beam when going into another room.

Pipes crossing a beam between rooms.
A pipe crossing a beam between rooms, right where the metal ends.

Here is a picture showing pipes along the walls and on both sides of an opening between two rooms.

Pipes at the boundary of two rooms.
Pipes at the boundary of two rooms.

The hydronic heating system is made up of several separate sections with their own thermostats. The picture below shows pipes from different sections having different temperatures.

Pipes with water of different temperature.
Pipes with water of different temperature.

The thermal contrast turned out to be very good on the wooden floor, but under the ceramic tiles at the entrance, the pipes were much harder to discern as shown below (not that this was of interest to me since it was the wooden floor that needed fixing). The reason for the difference is not entirely clear to me. Maybe the tiles conduct heat much better and spread the heat in a much more diffuse manner? Maybe it takes longer to heat up the tiles? Maybe the thermal coupling from the pipes to the tiles is lousy?

The pipes are not as easily seen under the ceramic floor tiles at the entrance (top) as they are under the wooden floor (bottom).
The pipes are not as easily seen under the ceramic floor tiles at the entrance (top) as they are under the wooden floor (bottom).

The thermal imaging also yielded some unexpected findings. A large part of one of the rooms lacked pipes, although the metal detector clearly showed that there were sheets of metal in the floor. This seems like a clear sign of cheating on behalf of the company that built the house, “Bygg OM AB“, in Linköping. They are probably also the ones who are responsible for the creaking floors.

Thermal image shows that pipes are missing from a large section of this room.
Thermal image shows that pipes are missing from a large section of this room.

In addition to the large area of missing pipes in one of the rooms, a smaller area with a metal sheet but without any pipes was found in a large closet at the entrance.

Random images

I could not resist playing a little with the camera and here is a selection of some random pictures I took:

The central heating unit.
The central heating unit.
Me
Myself (there is some parallax error between the thermal and the visible light pictures here due to a mismatch between the real distance to the subject and the distance setting of the camera)
A hot spot on the side of the freezer (and some heat around the stove).
A hot spot on the side of the freezer (and some residual heat around the stove).
A water meter.
A water meter.
A water tap after tapping hot water for a while.
A water tap after tapping hot water for a while.
A power drill with a hot drill bit and some newly drilled holes that are cooling off.
A power drill with a hot drill bit and some newly drilled holes in the floor that are cooling off.

Finding Components for the Lapse Pi

I have received a number of questions regarding some of the components of the Lapse Pi circuit I wrote about in a previous blog post. Here I will give some additional recommendations of what components to use and how to buy them.

Motor Drive NMOS Transistor

I used an NMOS transistor from the junk bin to drive the motor. The particular part I used is probably hard to find today, but fortunately, the requirements on this transistor are easily fulfilled by numerous modern parts.

So what are the requirements?

VGS(th): The transistor should be very well turned on when its gate-to-source voltage is whatever the Raspberry Pi can deliver. The GPIO outputs of the R Pi do not seem to have perfect documentation, but from what I have been able to piece together from various google searches, it seems like the outputs are pretty standard CMOS outputs and thus should deliver a voltage very close to the supply voltage when the output is high and no current flows out of the pin. Thus, we can count on the high output voltage to be pretty close to 3.3 V and thus we need to find a transistor whose threshold voltage (VGS(th)) is well below 3.3 V.

ID: The continuous drain current has to be a bit above the current that the motor consumes. Looking around for some suitable motors with gear boxes, it seems like one could expect a current around 50 mA to 300 mA. So a transistor that handles 1 A should be sufficient, although it is not too expensive to buy transistors that can handle significantly more current.

VDS: The supply voltage is nominally 12 V and we need a transistor that can withstand this voltage with some margin. It should have a drain-to-soruce voltage rating (VDS) of at least 20 V and preferably 30 V or more.

Depending on how you build the circuit (if you make your own PCB or build on stripboard like I did), you might prefer a surface mount or a through hole transistor. Most hobbyists who need the advice of this blog post probably prefer a through hole component.

Using the above criteria, it is quite easy to use the filtering functions of e.g. Digikey to find a bunch of suitable transistors. Here is how I would do it on Digikey:

  • Go to their front page and click on Product Index.
  • Under the heading “Discrete Semiconductor Products”, click on “FETs – single“.
  • Hold down the Ctrl key and click on Bulk, Cut Tape, Tray and Tube in the Packaging box. This eliminates some uninteresting (for us) packaging alternatives.
  • In the FET Type box, select “MOSFET N-Channel, Metal Oxide” and “MOSFET N-Channel, Schottky, Metal Oxide”.
  • In the Drain to Source Voltage box, click on 30V, hold down shift and click on 100V to select parts with this range of VDS. Parts outside this range is probably not of interest as they do either not fulfill our requirements or are highly overspecified and thus probably more expensive and/or worse in some other regard.
  • Tick the three boxes “In stock”, “Lead free” and “RoHS compliant.

The relevant part of the page should now look something like this:

Filtering of Digikey parts.
Filtering of Digikey parts.
  • Click “Apply filters”.
  • Still there are more than 3000 matches, so it would be nice to narrow the search further.
  • Select IDS between 1A and e.g. 30A (click on 1A, scroll to 30A, hold down shift and click on the 30A line)
  • Select VGS(th) between the minimum available and 2.5 V.
  • Select Through Hole in the Mounting Type box.

Now the selection should look like this:

Digikey-2

  • Click Apply Filters again.
  • Currently, this results in only 20 hits for me and now it is time to look through the alternatives.
  • I do this by sorting on price, lowest first, by clicking on the up-arrow in the Price column.

The first hit for me is a transistor called NTD5867 and looking at its datasheet it looks almost OK for this application. Below are some relevant plots. We can see that typically, a VGS of 2.8 V leads to a voltage drop of 0.5 V when the drain current is 2.5 A. For our currents which is about an order of magnitude smaller, the voltage drop should be negligible compared to the 12 V of the supply.

Some relevant plots from the datasheet of NTD5867.
Some relevant plots from the datasheet of NTD5867.

These are however typical plots and we are not guaranteed that the transistor will work like this. The VGS(th) specification in the “Electrical characteristics” table says that VGS(th) is typically 1.8 V (at 250 µA and 25 °C), but that it can be as high as 2.5 V. This difference of 0.7 V means that we might need 3.5 V to achieve  the behavior of the 2.8 V curve in the first plot above. And we do not have 3.5 V available to drive the transistor.

The second part in the Digikey results is NTD4906. Digikey says that this transistor has a VGS(th) of at most 2.2 V (compared to 2.5 V of the part above). Looking into the datasheet reveals a few other positive things, namely that that the difference between typical and maximum VGS(th) is 0.6 V and that it can conduct much more current at much less voltage drop at lower VGS than the previous part we looked at. Here are the plots for NTD4906:

Some relevant plots from the datasheet of NTD4906.
Some relevant plots from the datasheet of NTD4906.

At 2.4 V VGS it can typically conduct about 2 A with a voltage drop of 0.5 V, so if we add the 0.6 V difference between typical and maximum VGS(th), we get this performance at 3 V gate-source drive, which the R Pi can provide.

Based on the above, I would recommend NTD4906N as the transistor to use for this purpose, although there are of course many others that would fit the bill. If you are not shopping at Digikey, you can use the same criteria to try to find another suitable transistor that is available to you.

DC/DC PMOS Transistor

The process of finding a suitable PMOS transistor for the DC/DC converter is very similar to what I described above. Here the criteria are primarily: at least 2 A drain current, at least 30 V drain-source voltage and besides that we want good efficiency and thus prefer low gate charge/gate capacitance and an on-resistance that is low compared to the 0.27 Ω current sense resistor. Threshold voltage is not an issue here as we are driving the transistor with pretty much the full input voltage of nominally 12 V, but it is important that the transistor can tolerate this gate-source voltage.

After narrowing down the search criteria, the transistor FQU11P06 shows up and its datasheet shows no obvious drawbacks. It has an on-resistance of at most 0.185 Ω at 10 V gate-source voltage and a gate charge of 17 nC.

There are a few other and somewhat more expensive parts that have lower on-resistance and less gate charge, like STF10P6F6, but the minor efficiency improvement is probably not worth the higher price in this case. So FQU11P06 would be my recommendation in this case.

Shutter/Focus Transistor

Here we need a small-signal NMOS transistor with criteria very similar to the NMOS transistor for the motor drive, except that we do not need nearly as much current carrying capability. Oddly enough the selection of hole-mounted small-signal NMOS transistors turn out to be not that great. The part that I think looks best at Digikey is ZVNL110A.

The funny thing is that it is more expensive ($0.78) than the bigger NTD4906N ($0.57) we selected above, so if you do not mind the size, you could actually use NTD4906N here as well.

If you are OK with using a surface mount transistor, there are more options. BSS123 is widely available and seems to fit the bill, although there may be variations in the threshold voltage limits from different manufacturers, so check the datasheet for the part  you are about to buy.

DC/DC Inductor

The requirements on the inductor are primarily that the inductance shall be at least 220 µH and that the DC resistance shall be low to keep the efficiency high. And also that it shall be able to support enough peak current, which is probably around 1.5 A or so. The inductor I used has a resistance of 0.13 Ω, so this is a value to aim for to get the same or better efficiency.

Digikey does of course have a number of inductors that would do the job, but the one that seems to be least expensive is 2116-H-RC from Bourns. It is a toroid that has an inductance of 220 µH, a maximum current of 2.4 A and a maximum DC resistance of 0.12 Ω.

I hope the information in this blog post makes it easier to find suitable components for this project.