Low Power Electronics
I am building a set of strings of lights to illuminate a labyrinth. As someone walks the labyrinth, the strings of lights will light up ahead of them to show the way, and fade out behind them as they pass. Instead of doing the build from the ground up, I’m starting with solar-powered garden lights that charge during the day, and light a string of lights at night.
My initial thought was that this would be a pretty simple task. I’d rig each light with a Sharp IR ranger, poll the ranger, and light the lights when something got close enough. Once it passed, I’d set a timer based on how long it takes to walk a strand of lights, and then shut the lights off when the timer timed out.
Unfortunately, that idea went away when I got the solar light. The light uses a single 1.2V battery, and runs the LED strand by having a simple boost converter double that to pulses of around 2.5V at a high enough rate that the LEDs don’t look like they are pulsing. I figured I would get around that by rectifying the pulses using a voltage doubler, which would get me 5V for my microcontroller and sensor. Unfortunately, voltage doublers get you voltage at the expense of current. The Sharp IR rangers can eat around 20mA, and the microcontroller is another 15mA or so. With that amount of load, the voltage on the voltage doubler rapidly falls back to ~2V. The Sharp IR rangers don’t work at anything less than about 4 volts, so I couldn’t use them.
I decided that since I don’t need range measurement, just the presence or absence of something in the range of the detector, I could get by with lighting the area up with 38kHz modulated IR, and picking it up with an IR detector module like the ones used in TVs to receive the remote signal. The microcontroller can generate the modulation signal to drive the IR LED. I got the code to do it here, I think, but that site is down now. In practice, this works just fine. I used my Arduino to do a quick sketch of the detection circuitry, and got it to blink an LED.
Unfortunately, the IR detectors I have also don’t work with less than 5V. However, unlike the Sharp IR rangers, there are a bunch of manufacturers that make the TV remote receivers, and some of them operate down to 2.4V. I ordered some of these, and set up my microcontroller, IR LED, and remote receiver so I could blink an LED by sending a IR pulse.
That worked just fine on battery power, but running from the voltage doubler still drained the caps too fast. Powering the IR LED at reasonable brightness just took too much current. In order to let the capacitors in the voltage doubler recharge, I shortened the IR LED on time to a 10th of a second, and put the microcontroller in a very low power (i.e. it runs on microamps, rather than milliamps) sleep mode when it was not firing the LED. Since the circuit spends most of its time off, the IR detector is the main draw on the voltage doubler. So far, this seems to work. If I want to save even more power, I can power the IR detector from a pin of the microcontroller, and shut it down when the microcontroller goes down.
Soon, I’m going to test the full circuit. I’ll post about it if I have to make any wild and crazy hardware changes.
Conductive tape for biosignal acquisition
If you want to monitor electroencephalographic (EEG, electrical signals from the brain) or electromyographic (EMG, the electrical signals from moving muscles), you need to use electrodes to get the signal. The electrodes are generally not reusable and are kind of expensive. They usually run somewhere from $0.70 to $3.00 each, although the 3M Red Dot electrodes are much cheaper. The electrodes usually use a conductive gel surrounded by a ring of non-conductive adhesive, which makes them large and difficult to put close together.
It seems likely to me that you could use electrically conductive tape to improvise contacts of any size and shape. The adhesive probably isn’t tested for use on humans, and the conductive element is sometimes something that people have an allergy to, like nickel or silver, but it could be sufficient for self-experimentation for quick hacks. It would also be an order of magnitude cheaper
Conductive tape: http://www.tedpella.com/semmisc_html/semadhes.htm
Cheapo Red Dots: http://www.amazon.com/Red-Dot-Monitoring-Electrodes-Diaphoretic/dp/B000TBSAH0/ref=sr_1_1?s=industrial&ie=UTF8&qid=1336146625&sr=1-1
Unusual Data Visualization Tools
The Boston Marathon is visible in Google Maps’ traffic view. The road is closed for the runners, and the runners are going slow, at least relative to a car, so they show up as a huge traffic jam on the race route. All the other roads are in good shape because Race Day/Patriots’ Day is a state holiday, and so everyone is home from work. It probably also helps that it’s a gorgeous day out, and so no one wants to be in their car.
ToyBrain at the Maker Faire
I’ll be at the Cambridge Mini Maker Faire (details here, here, and here) this Friday, showing off my ToyBrain boards, LED art, and other oddities. Look for the guy with the unnatural red hair.
Chris Connors was kind enough to include my work from 2010 in his post about the Faire.
Touch and pressure sensing with the Arduino
A friend of mine is working on a device that requires multiple soft fabric pressure sensors over a volume approximately equivalent to a human arm. I have more Arduino experience than her, so I’m helping out with the electronic implementation details.
Our first attempt was to examine some commercial force-sensing resistors. These consist of a plastic layer with a pattern of interleaved contacts printed on it, and a layer of carbon-impregnated rubbery material over the contacts. The more pressure there is on the rubber, the more it touches the contacts and the lower its resistance becomes. These devices are very stable, yielding repeatable resistance measurements with repeated contacts. Unfortunately, they are of a fixed size, and cannot be cut or reshaped. They also are flexible, but not exactly soft.
After discarding that approach, we tried making our own force sensitive resistors out of the conductive foam from IC packaging. This works, but has a couple of problems. The first is that the resulting device doesn’t have a simple response to force. Its resistance goes down when pressed, and goes back up when released, but it doesn’t always return to the same values, and the resulting sensor data is noisy. We also don’t have a good source for a lot of IC packaging foam.
Most recently, we’ve tried making a pressure sensor based on a capacitor. The Arduino CapSense library provides a simple way to turn two pins of an Arduino into a capacitance sensor. One plate of the capacitor is a sheet of conductive material, the other plate is the user, and is effectively connected to ground (or at least “away” as charges can leave the circuit that way). The page notes that you can use the capacitive sensing pad, covered with an insulator, as a pressure sensor with an approximately logarithmic response.
However, it also notes that putting a ground plane under the touch sensor makes the results more stable. Instead of doing that, I put down the sensing plate, made of copper-coated nylon, two layers of soft interfacing (A sewing material kind of like a sheet of stuffed toy stuffing) and a ground plate made of silver-coated spandex over the interfacing. Pressing on the ground pad compresses the interfacing and brings the ground plate closer to the sensing plate, increasing the capacitance, and registering as pressure to the sensor. Because the upper/interactive surface is the ground plate, it shields the sensing plate, so the capacitive pressure sensor does not also act as a proximity sensor and trigger before it is touched.
I taped the bottom layer down to my desk, and hooked a clip lead to it. This lead goes to pin 2 of my Arduino.
Then I put two layers of interfacing on top.
Then I put the ground layer on top. This is connected to a clip lead that goes to a ground connection on the Arduino.
In the finished device, there will probably be a stuffed fabric tube with rings of conductive fabric around it as sensors, surrounded by a layer of interfacing, and then by a conductive grounded layer. There will also likely be an outer layer of fabric to protect and decorate the whole thing. In order to determine if this is a good way to build the thing, I intend to use the technique to make a stuffed toy that can detect squeezing.
This is the code I used to read the values from the sensor:
#include/* * CapitiveSense Library Demo Sketch * Paul Badger 2008 * Modified by Abe Shultz 2012 * Uses a high value resistor e.g. 10 megohm between send pin and receive pin * Resistor effects sensitivity, experiment with values, 50 kilohm - 50 megohm. * Larger resistor values yield larger sensor values. * Receive pin is the sensor pin - try different amounts of foil/metal on this pin * Best results are obtained if sensor foil and wire is covered with an insulator * such as paper or plastic sheet */ CapSense cs_4_2= CapSense(4,2); // 1 megohm resistor between pins 4 & 2, pin 2 is sensor pin void setup() { Serial.begin(9600); cs_4_2.reset_CS_AutoCal(); } void loop() { long start = millis(); long total1 = cs_4_2.capSense(30); Serial.print(millis() - start); // check on performance in milliseconds Serial.print("t"); // tab character for debug window spacing Serial.println(total1); // print sensor output 1 delay(10); // arbitrary delay to limit data to serial port }
Scooped?
Pololu makes a controller (called the “Baby Orangutan”) very similar to the one I am building. It has an Arduino-compatable microcontroller, 1A motor driver, and user IO lines. It is also cheap. However, there are a few things my design has that theirs does not.
The ToyBrain motor driver is replaceable. If you accidentally short the output pins and destroy the chip with overcurrent, you can remove it from the socket and replace it. The motor driver of the Baby Orangutan is a fairly fine-pitch SMD package, and so is difficult for the average user to desolder and replace.
Connections to the ToyBrain are also a bit more convenient than those on the Baby Orangutan. The ToyBrain has headers designed for servos, and headers for sensors that carry power for those sensors. The Baby Orangutan breaks all the pins out as single pins, leaving the user to deal with power wiring.
The ToyBrain uses the serial port for programming with a $5 FTDI cable available from multiple vendors. This means that it integrates very easily with the Arduino development environment, and it can send serial data back to an attached computer. The Baby Orangutan uses a USB to ICSP adapter to program the chip. It has the ability to send data back to a computer via serial, but it would require a second cable.
This post isn’t intended to slam Pololu. They make useful products with incredibly high quality. I know this because I buy their stuff. The point isn’t that my device is better, it’s that it’s different, in ways that make it better for me.
Counting Instances of Things
This is something I seem to do a lot. Most recently, I was trying to see how many nodes of each degree there were in a graph, but it could also be used for word counts and such.
#Run through a list and count occurrences of each item, #store them in a dictionary of items to counts def bin(list): bins = {} for item in list: if item in bins.keys(): bins[item] += 1 else: bins[item] = 1 return bins
The key thing here is not really the little bit of python glue code to do the counting. What is key is to learn to recognize things that you do more than once, and automate them. A folkloric axiom of computer programming is that you need to do something either exactly once, or an unknown number of times. If you have to do it once, then the program should do it once. If it’s the other case, then the program should determine how often to do it, and then do it.
For example, if the program trims the whitespace off the end of a text file, it should either do it once (which allows the user to call it in a shell script loop if they want to process any number of files), or do it to any number of files. The alternative, having it process some arbitrary number of files and then fail, has two problems. First, it adds complexity. The program now has to keep a counter, check it, and fail when it hits a certain value. Second, the program, which previously worked in an infinite number of cases (that is, it would process N files for all N such that N is a positive integer), now has an infinite number of failure cases (fail for all integers greater than M), and has gone from complete success to complete failure, via the most difficult route.
Gallery Plugin Get
[nggallery id=1]
Photos from the Rhode Island Min Maker Faire a couple of years ago.
Finds
For anyone who has ever wondered where I get my ideas from, I find them in the trash.
I recently found a hollow Styrofoam cube, with one open side. It’s about 14″ on each edge, with walls about 1.5″ thick. I can just barely see overhead lights through it, so I imagine it will light up well with colored LEDs in it.
Furniture building
Most of my projects are on hold until I get a place to work on them. My current lab is about 11′ x 12′, with a little storage room off to the side. It’s not big enough to store my tools and provide a useful workspace, so I’m improving it in two ways.
The first improvement is to cut down on stuff. I own a lot of things that I’m not using, and don’t even have any really clear plans to use, so I’m collecting all that junk and putting it in boxes. Some of it is going to friends who are worse hoarders have clearer plans for it than me. Anything that people don’t take is going to have a chance to get sold at the MIT Flea Market in April, and then is going to get thrown away. Once I’m done getting rid of stuff, I’m going to start tagging things when I use them, and get rid of the stuff that I don’t use for a year. I’m not going to be terribly strict about this, but I am going to give it a shot, and see how much of the stuff I actually want when it comes time to get rid of it.
The second improvement is to make a useful workspace. I used to have a large corner desk, which I used for all sorts of work. Since I didn’t have space for that in my current apartment, I got a smaller desk from a friend. It’s a cute desk, but it isn’t useful. The top has drawers that open over the desk area, so you can only get at the contents of the drawers if you don’t have anything on the desk. That doesn’t happen with desks I own. Aside from that, it’s too small to accommodate tools, a computer, and a project, and since many of my projects involve both a computer and tools, this is a problem.
To replace the useless desk, I’m building a new workbench. It’s a standing desk, with a 5’4″ x 3′ upper surface made of birch plywood. The underside will have some space for storage and my computer. Since the computer desk and the work desk will be consolidated into one workbench, I’ll be able to get rid of both my computer desk and my current workbench, and both the chairs in front of them, and the pads that protect the floors from the chairs. I’ll probably keep at least one of the chairs around, in case I need it in the future, but it won’t be in my lab.
The category of this entry “B Work” refers to work which is intended to accelerate the thing you really want to do, which is your “A work”. “C work” accelerates your acceleration, and so very little of it needs to be done in comparison to the other two.
Recent Comments