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.

2017 April 29

Santa Cruz Mini Maker Faire 2017

Today I spent about 10 hours on the 2017 Santa Cruz Mini Maker Faire.  The hours for the Faire were 10–5, but I spent some time setting up and tearing down afterwards, so I left the house around 8:30 a.m. and had the bike trailer unpacked and everything back in the house by about 6:30 p.m.  I figure that I spent only about 10 hours earlier on setup for this Faire: applying for the Faire, setting out all the displays and testing them at home, preparing new blurbs for my book and blog, making table signs telling people how to use the interactive parts of the display, blogging about the Faire, and doing load-in last night.  That is a lot less than last year, as I was able to reuse a lot of the design from last year.

Here is the table display I ended up with:

The bare corner at the front left was reserved for the students in my freshman design course who were coming to display their muscle-controlled robot arm, but they decided to set up in back (you can see one of the lead students in the background).

I had four interactive displays (from left to right):

  • A pair of function generators and an oscilloscope showing Lissajous figures.  I changed this from last year, as I did not use the FG085 function generator this year, but one of the function generators from the Analog Discovery 2.  I still used the Elenco FG500, despite the very low quality of its waveforms, because it has a knob that is easy for kids to turn, and is easy to reset if they mess it up (unlike the jamming buttons on the FG085).  I did not use the second function generator on the Analog Discovery 2, as I did not want kids playing with just a software interface (and a rather complicated one at that).  It might even be worthwhile for me to build a simple audio sine-wave oscillator with a single big knob over the summer, so that I can have something for kids to play with that is fairly robust and that can’t be easily set into a weird state.  I could even do two, just for Lissajous figures, though having one fixed oscillator worked well this time.  I had the Analog Discovery 2 oscilloscope showing on the laptop next to the old Kikusui CRT oscilloscope, showing both the waveforms and the XY plot, so that I could explain to adults what was happening with the Lissajous figures and about the differences between classic oscilloscopes and modern USB-based ones.
    A lot of people asked me about the Analog Discovery 2, which I was very enthusiastic about—Digilent should be giving me a commission! (They aren’t, although I’m sure I’m responsible for at least half a dozen sales for them, and a lot more if we go ahead with our plan to use them in place of bench equipment in my class next year.)
  • In front of the laptop showing the Lissajous figures, I had a standalone optical pulse monitor using the log-transimpedance amplifier and the TFT LCD display.  Using the log-transimpedance amplifier worked well, as did using a lego brick to block light to the sides and back of the phototransistor.  A lot of people have trouble holding their hands still enough to get good readings (particularly children), so it would be good to have some sort of clip instead of resting a finger over the phototransistor.  I’ve tried making clips in the past, but I’m not good at mechanical design, and I’ve always ended up with either a clamp that is too tight (cutting off circulation and getting no reading) or too loose (falling off).  Ideally, I’d want a pressure between systolic and diastolic pressure, so about 12kPa (90mmHg).  People did like the use of Lego as a support, though—it provided a familiar element in the strange world of electronics.
  • To the right of the pulse monitor was a pressure sensor.  I had a mechanical gauge and the electronic sensor both connected to a piece of soft silicone tubing taped to the table top.  Kids pressed on the tubing to get an increase in pressure, visible on the gauge (about 20–60 mmHg) and on graph PteroDAQ was running on the little laptop (which we refer to as the “Barbie” laptop, because of its color and small size).  I explained to kids that the tubing was like the tubing stretched across roads sometimes to count cars, with a pressure sensor that recorded each pulse as wheels compressed the tubing.  (For some of the old-timers, I reminded them of when gas stations used to use a similar system.)
    PteroDAQ worked well for this setup, running all day at 20 samples per second without a glitch.  The only problem was occasional display sleep from the laptop, fixable by touching the touch pad.
  • At the far right end of the table, I had a phototransistor which kids could shadow with their hands, with the result visible on another channel on PteroDAQ.  This was a last-minute change, as I was getting very unreliable results from the capacitive touch sensor when I tested it out last night.  The capacitive touch sensor worked fine at my house, but in the kindergarten room at Gateway I has a different electrical environment, and it would not work unless I grounded myself. Rather than fuss with the touch sensor, I made a new table sign and put in a light sensor instead.
    I might want to experiment this summer with different ways of making touch plates—trying to get one that doesn’t rely on the toucher being grounded.  My initial thought is that if I have two conductors that are not too close together, but which would both be close to a finger if the touch plate is touched, then I may be able to get more reliable sensing.  I could try some wire-and-tape prototypes and maybe make PC boards with different conductor layouts.  (OSH Park‘s pricing scheme would be good for such tiny boards).

I also had my laptop displaying my book; some quarter-page blurbs with URLs for my book, PteroDAQ, and this blog; my 20-LED strobe; my desk lamp; and a PanaVise displaying one of the amplifier prototyping boards.

I’d like to think of a more exciting project for kids to play with next year—perhaps something I could build over the summer.  Readers, any suggestions?

In addition to my display, some of the freshmen from my freshman design seminar class demonstrated their EMG-controlled robot arm (which uses the MeArm kit):

The students built a MeArm from a kit, then programmed a Teensy board to respond to muscle signals amplified by amplifiers designed by other students in the class. The combined project had two channels: one for controlling the forward-backward position of the arm (using the biceps), the other for controlling the gripper (using muscles in the forearm). With practice, people could pick up a light object with the robot arm.

The scheduling of the Mini Maker Faire was not ideal this year, as it conflicted with the Tech Challenge, Santa Cruz County Math contest, the California Invention Convention, and the Gem and Mineral Show, all of which draw from the same audience as the Mini Maker Faire.

The Faire seemed to be reasonably well attended (rather slow for the first hour and half, but picking up considerably in the afternoon).  There was plenty of room for more exhibitors, so I think that organizers need to do a bit more outreach to encourage people to apply.  It would probably help if they were quicker responding to applicants (it took them over three months to respond to my application, and then only after I nudged them).

Some obvious holes in the lineup: The Museum of Art and History did not have a display, but I saw Nina Simons there, and she said that MAH definitely plans to do it next year, but the Abbott Square renovation is taking up all their time this year.   The fashionTEENS fashion show was April 21, just over a week ago, so it would have been good to get some of them to show their fashions again: either on mannequins or as a mini-show on the stage.  It might be good to get some of Santa Cruz’s luthiers or fine woodworkers to show—we have a lot of top-notch ones, and many do show stuff at Open Studios. The only displays from UCSC were mine and the Formula Slug electric race car team.

Of the local fab labs, Cabrillo College Fab Lab and Idea Fab Labs were present, but The Fábrica and the Bike Church were not.  I thought that Cabrillo did a great job of exhibiting, but Idea Fab Labs was a little too static—only the sand table was interactive.

It might be good to have Zun Zun present their Basura Batucada show (entirely on instruments made from recycled materials) and have a booth on making such instruments.  It might be hard to get Zun Zun to volunteer, but they used to be very cheap to hire (I hired them to give a show at my son’s kindergarten class 15 years ago—they were very cheap then, but I don’t know what their prices are now).

One problem my wife noted was the lack of signs on the outside of classrooms, so that people would know what was inside.  The tiny signs that the Faire provided (I think—I didn’t get one) were too small to be of any use.  It may be enough to tell makers to bring a poster-sized sign to mount.  I had my cloth banner behind my table, but a lot of the displays were hard to identify.  Instructions or information mounted on tables would also have been good—again these would have to be provided by the makers.  I did not see people carrying maps this year—they can also be helpful in getting people to find things that were tucked away in odd corners.  Not many people made it back to the second kindergarten room where FabMo and the Lace Museum activities were.

Update 2017 May 1: It turns out that there were some things I missed at the Faire.  The principal of Gateway sent me email:

… we did have 4 of the Fashion Teens exhibit their creations on the stage at 11:30—might be cool to have them put those on mannequins and have a booth next year. Also we had two more UCSC projects—Jim Whitehead and the Generative Art Studio, and Project AWEsome from the School of Engineering. We would LOVE to have more UCSC-related projects …

 

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.

Next Page »