Gas station without pumps

2017 September 27

Jig for drilling Lego bricks

Filed under: Circuits course — gasstationwithoutpumps @ 15:07
Tags: , , ,

For the pulse-monitor lab, I have students drill ⅛” holes through 1×2 black Lego bricks (see Lego as LED holder and Lego as LED holder revisited), to make holders for 3mm phototransistors and 3mm LEDs. I hauled my drill press up to campus in my bike trailer last year to have students drill their own bricks, but I was not happy with the plywood jig that I had put together at the last minute—it worked, but there was a tendency for the bricks to jack-knife when the drill press vice was closed, because I had a sliding piece to clamp the brick.

I redesigned the jig yesterday and came up with a much simpler and (I think) more reliable design:

This side view shows the jig cut out of a piece of polypropylene cutting board that had been retired from kitchen use as too beat up. The bottom edge is straight, and the top edge has a rectangular cutout exactly the width of a Lego brick. (The top edge is not flat, because it was cut from a part of the cutting board that had a handle.)

Here is a top view of the jig in the drill press vice. In classroom use, I’ll probably use some painters’ tape to hold the jig to the non-moving jaw of the vice.

To use the jig, open up the vice a little bit, snap the brick into place, and tighten the vice gently to hold the brick securely. The cutting board is just a little thinner than the height of the brick, so the clamping force of the vice is entirely on the brick.

I may add these photos to my book.

2016 October 11

Lego as LED holder revisited

Filed under: Circuits course — gasstationwithoutpumps @ 18:01
Tags: , , ,

In Lego as LED holder, I wrote

I think that the Lego bricks work about as well as the old trans-illumination wooden blocks that I’ve been using for a few years, and they are certainly much easier to make, requiring only drilling two ⅛” holes.

I’ll want to play around with different illumination, also.  Lots of cis-illumination pulse monitor kits seem to use green LEDs, for example.  Do those work better?

Since then, I’ve played around with a couple of different approaches for using Lego.  The first, and most obvious, move was to use separate bricks for the LED and the phototransistor. If the phototransistor brick is clicked onto the top of the LED brick, then there is the ABS of the brick top between them, and very little light leakage.  I tried both 1×1 and 1×2 bricks, which cost about the same at about 3¢ each on the used market.

Because I was too lazy to wire leads onto all my different LEDs, I also tried just sticking the LED in the breadboard and resting my finger on the bricks—it isn’t very sturdy, but for quick testing it is not bad:

The LED can support the bricks, if you don't press too hard.

The LED can support the bricks, if you don’t press too hard.

I tried using several different LEDs. I got good results with 700nm and 607nm peak LEDs, but nothing but DC drift with green (565nm) LEDs. I would have tried a yellow LED, but I only had ones in 5mm packages, which is too big even for the axle holes, so the poor results there may have been due to mechanical, rather than optical difficulties (some signal was visible).

Here are the results with a 700nm red LED:

There is a lot of DC drift, but the underlying 3–4mV signal is clear.

There is a lot of DC drift, but the underlying 3–4mV signal is clear.

So, I have (at least) three choices for how to do cis illumination with Lego bricks, all of which I like better than using wooden blocks:

I can drill off-center holes in Lego Technic bricks, or centered holes in 1×1 or 1×2 bricks.

I can drill off-center holes in Lego Technic bricks, or centered holes in 1×1 or 1×2 bricks.

Drilling the bricks is very easy, and it would be even easier, if I made a jig that aligned the brick, rather than having to fiddle with the drill-press vice. I might even have the students drill their own bricks. I did not put Lego bricks on the parts list, but if I have to buy $5 worth of Lego bricks for this Winter’s class, it is no big deal.

2016 October 9

Lego as LED holder

Filed under: Circuits course,Uncategorized — gasstationwithoutpumps @ 15:00
Tags: , , ,

In Pulse monitor using log amplifier, I talked about the problems I was having with using wooden blocks for holding an LED and phototransistor side-by-side, because the wood was too transparent, and the rather clumsy test I made using electrical tape:

By cutting between the two 3mm holes I could put black electrical tape to block the short-circuiting light path.

By cutting between the two 3mm holes I could put black electrical tape to block the short-circuiting light path.

I suggested in that post that I would buy a chunk of black ABS plastic for $10 and try making the finger cradles out of that. I realized later that I already have some black ABS plastic, in the form of Lego bricks. If I could use them, that would save me a lot of trouble, and provide a more easily duplicated block for others to use.

I ended up trying a black 1×2 Technic brick (which would cost about 1¢–3¢ each on Bricklink), drilling two ⅛” (~3mm) holes in the faces on either side of the axle hole. The axle hole in the Technic brick provides a light barrier between the two optoelectronic components:

View of the Lego Technic brick from the bottom, showing the light barrier between the two optoelectronic parts. The bottom needs to be covered (with another brick or electrical tape), and the optoelectronic components need to be taped in place.

View of the Lego Technic brick from the bottom, showing the light barrier between the two optoelectronic parts.
The bottom needs to be covered (with another brick or electrical tape), and the optoelectronic components need to be taped in place.

View of the drilled Lego Technic brick, showing the optoelectronic components.

View of the drilled Lego Technic brick, showing the optoelectronic components.

I had hoped to be able to insert the 3mm LED and phototransistor from the bottom of the brick, but there was not enough clearance to do so easily, so I inserted them from the opposite face of the brick.

I tried recording the light levels with the front face taped over with black electrical tape, and with a finger covering it. The difference in voltage was large, indicating that the light through the finger was much more than the light leakage around the axle-hole light barrier. I was using an LTR-4206 phototransistor and a 1N914 diode followed by a unity-gain buffer.

I got around 394mV with the finger and 275–284mV with the holes taped. The variation on any given recording run with the holes taped was only about 0.3mV, but different runs, with different amounts of sunlight falling on the brick gave different levels. The minimum difference between the finger and the taped block is about 110mV, which translates to a 19.8dB difference in light (or a factor of 9.8).

But I was not able to get a pulse measurement with cis IR illumination.  I could get a signal of about 1mV peak-to-peak with ambient (shaded sunlight) illumination, which corresponds to about 0.18dB, or 2% fluctuation in finger opacity, but that depended critically on the pressure on my fingertip—if it wasn’t just right, I got no visible pulse signal, just noise.  I could get a bit more consistent results by putting the Lego block between my index and middle fingers and using a rubber band to clamp the fingers together.  If the squeeze was just tight enough to throb, then I got fairly clean results, and I could get them fairly consistently, but I’m not sure whether others will be able to get similarly consistent results.

I also tried taping up the block with no IR illumination, to measure the dark current.  I got 67mV, which should correspond to about 10nA, which is pretty good, since the spec for the LTR-4206 phototransistor give the max dark current as 100nA.

Bottom line: I think that the Lego bricks work about as well as the old trans-illumination wooden blocks that I’ve been using for a few years, and they are certainly much easier to make, requiring only drilling two ⅛” holes.

I’ll want to play around with different illumination, also.  Lots of cis-illumination pulse monitor kits seem to use green LEDs, for example.  Do those work better?

2016 October 2

Pulse monitor using log amplifier

I am currently rewriting the optical pulse monitor lab for my Applied Electronics for Bioengineers book, because I’ve moved it earlier in the course, and because I need to remove the calculation of how big the signal should be, which never worked out very well.  There were way too many assumptions in the calculation, and it turned out to be much easier and more accurate to “try it and see” than to do the calculations.

I always do the labs (often several times in different ways) while writing the lab chapters, so I’ve been playing with pulse monitors again.  I’ve decided that I will definitely have the students do a logarithmic transformation of the photocurrent to voltage, as that eliminates the need to guess a resistance value for the first-stage amplifier.  The amplifier can be designed in two stages, with the first one doing the logarithmic conversion and the second one providing sufficient gain over the desired frequency range (where “sufficient” gain is determined by measuring the output of the first stage).

In Using 4¢ diode for log-transimpedance, I talked about using a 1N914 diode as the feedback element of a transimpedance amplifier to get an output voltage as (roughly) the log of the input current.  There are actually two circuits that are subtly different ways to convert the log of current to voltage:

Two circuits that convert the logarithm of light intensity to voltage.

Two circuits that convert the logarithm of light intensity to voltage.

One of the exercises in the book is to compare the circuits (particularly looking at the constraints on what Vref can be in each).

Because I’d not played with it before, I tried using the unity-gain buffer design this weekend, to make sure the circuit worked and to see whether a single-stage amplifier provided enough signal to record with PteroDAQ using the 16-bit ADCs in the Teensy boards. I was also interested in trying out a new design for holding the phototransistor, so that students could experiment with ambient-light pulse monitors and cisillumination, where the illuminating LED is on the same side of the finger as the phototransistor.  In previous years we have always used transillumination, shining the light through the finger, but most wearables use a cisillumination design, because it is mechanically simpler and much cheaper to make.

I played around with a couple of different ways to make a finger cradle and ended up with the following design:

This is cut from a scrap of some softwood (pine? fir?), with a 1" diameter hole for the finger, a ¼" hole at right angles for the wires, and two ⅛" holes between them for the 3mm LED and phototransistor.

This is cut from a scrap of some softwood (pine? fir?), with a 1″ diameter hole for the finger, a ¼” hole at right angles for the wires, and two ⅛” holes between them for the 3mm LED and phototransistor.

The finger cradle worked great for ambient light, but when I tried using it for cisillumination, I could not get it to work—I had plenty of photocurrent, and if I modulated the LED the photocurrent was modulated, but I never saw a fluctuation that corresponded to the pulse in my finger. It turned out that the problem was that the wood is too transparent—I was getting so much light through the wood, that the fluctuation in what was returned from my finger was a tiny fraction of the total light—too small to be visible above the noise floor.

I mentioned this problem to my wife, who suggested I use black electrical tape. I’m not sure she quite understood the problem, since the wood was solid between the LED and phototransistor, but her solution was a good one—I just needed to put the tape in the middle of the block of wood!

By cutting between the two 3mm holes I could put black electrical tape to block the short-circuiting light path.

By cutting between the two 3mm holes I could put black electrical tape to block the short-circuiting light path.

With this design I could get small but recordable signals with either ambient light or cisillumination:

Response of first stage amplifier with an LED desk lamp shining through my left thumb.

Response of first stage amplifier with an LED desk lamp shining through my left thumb.

Output of first stage using an IR emitter on the same side of the left thumb as the phototransistor.

Output of first stage using an IR emitter on the same side of the left thumb as the phototransistor.

Both the plots above are a little misleading, as they were sampled at 60Hz, to alias out any 60Hz or 120Hz interference. With steady bright light from my LED desk lamp, I got similar plots even at 600 Hz, but with compact fluorescent illumination, the signal was buried in 120 Hz interference:

With 600 Hz sampling, it is easy to see the effect of modulated light.

With 600 Hz sampling, it is easy to see the effect of modulated light.

I don’t particularly like the electrical tape and wood approach to making the finger cradle—it is a bit fragile, and the tape needs to be replaced frequently.  Furthermore, ambient light reaches the phototransistor through the sides and ends of the block, unless the whole thing is wrapped in electrical tape. I think that I’ll buy a chunk of black ABS plastic and try making the whole thing out of it. I can probably get a dozen finger cradles out of a 1′ length of plastic, if I don’t mess anything up (and if all my drills work with ABS—I’ve never worked with ABS as anything but Lego bricks).  Another alternative is to go to the hardware store and see how thick the black ABS couplers are—I might be able to make a finger cradle by cutting one in half lengthwise, if the wall thickness is at least 6mm.  I’d still have to add something to keep it from rolling around.

In the past, I’ve thought about using pulsed light to make pulse monitor measurements that are less sensitive to fluctuations in ambient light. The idea is that I would make a measurement with the LED off, turn the LED on, wait a little while for the sensor to settle, then make another measurement. The difference between the measurements would be due just to the LED light, if the ambient light is changing slowly enough not to be very different between the measurements. I’m not sure that this is a good idea (the large change in light level means that there would have to be less analog amplification than for steady illumination, for example), but I was curious how long the on-pulse would have to be to get good measurements.

I hooked the IR emitter up to a hysteresis oscillator, to get nice sharp square waves, then recorded the output of the amplifier with my Bitscope USB oscilloscope. I used the differential probe to get an extra gain of 5 and AC coupling. I recorded 1156 traces, then used my retriggering and averaging program to superimpose and average the pulses. I ended up with between 2300 and 3500 pulses being averaged (depending where on the waveform you look).

The circuit responds fairly quickly to a rising edge, roughly like having an RC time constant of 84.5µs.

The circuit responds fairly quickly to a rising edge, roughly like having an RC time constant of 84.5µs.

The response to a falling edge is slower, roughly like an RC time constant of 207.8µs.

The response to a falling edge is slower, roughly like an RC time constant of 207.8µs.

The response to rising and falling edges is quite different, because of the nonlinear nature of the diode. When we are charging the parasitic capacitance, we have a fairly large photocurrent to do it with, but when we are discharging, the current gets quite small as the voltage across the diode drops. With a linear system, response to a positive step and negative step would be identical, except for the sign.

Both response times are fast enough that the shape we were seeing for the pulse waveforms is due to changes in the opacity of the finger, not due to distortion or filtering in the amplifier.  There is a sudden increase in opacity, followed by a gradual recovery as the blood flows through the capillaries and veins out of the thumb.

If I were to try the difference between LED-on and LED-off measurement, I’d want to have the LED on for at least 400µs, then off for at least 1ms.  (I’d probably do on for 400µs, then off until the next 1/60s tick, making a 2.4% duty cycle for the LED.)

Note also that the 50mV swing here is much larger than the 3mV swing that I got from pulse measurements, so gain would have to be limited to avoid clipping.

%d bloggers like this: