Touch Brightness Bulbdial

Bulbdial clock with breadboard and multimeter
Let’s make it touch sensitive!

UPDATE: People keep asking about the breadboard setup. Fair enough. I’ll throw together a quick overview when I get home today.
UPDATE: here it is: http://www.alexwhittemore.com/?p=462

The Bulbdial clock from Evil Mad Scientist is probably the coolest clock idea I’ve ever seen. Even cooler are my parents, who got the kit for my birthday.  The basic idea is that three rings of LEDs cast shadows onto a clock face to form H/M/S hands, somewhat like a sundial, with the hands slowly animating around. A lot of thought clearly went into making this kit, and it’s very nicely done, but there’s a major drawback: I want to use it on my bed side table, where I usually keep a clock, but it’s too bright for me to fall asleep! Of course, that’s been thought of too: in the normal view mode, the three buttons at the bottom of the clock are brightness up, down, and “mute,” which turns off the LEDs entirely. But they’re hard to get to buried underneath the frame of the clock, and it makes muting the display cumbersome in the dark. Let’s fix that!

My general solution to the problem at hand is pretty simple: I want some kind of strip running across the top edge of the front plate of the case that, when touched, toggles the display on or off. My first thought jumped to a capacitive sensor: I know that I can find one or two parts on http://www.sparkfun.com/ to handle the heavy lifting, and I know they’re pretty reliable. Problems with this plan sprang up pretty quickly, though. First, the two parts available on sparkfun are pretty expensive. One SMD bare part is ~$12, and a different broken-out part is $24. Both are a bit more than I want to spend on this project. Second, looking at the schematic from the bottom of the first link above, there are no spare GPIO pins left on the ATMega on the clock! That’s sort of a deal breaker; I could use the hardware serial tx/rx lines, but then I lose the built-in serial functionality which I might want, and I want to be as unobtrusive as possible. Also, comments on those two parts mention that they can be difficult to set up with Arduino anyway, and I’m not especially good at programming micros, so even if there were GPIO pins left to use for software serial, that’d probably be a headache.

So sensor type option two is a resistive setup, which is not only substantially easier, it can even be made with all passive components bolted on to the existing design, as I’ll do first (although the drawbacks will become apparent quickly). So resistive sensor, method one:

copper foil tape
You use this to fasten pieces of stained glass into a pane by soldering.

In both cases, there need to be two conductive strips running along the top case edge in question to sense a finger’s resistance. Ideally I’d have used the kind of copper foil tape used in stained glass, like this stuff. It’s cheap, conductive, sticky-backed, and it’ll hold solder to fasten leads to: it’s INTENDED to fasten pieces of glass together by soldering. But I haven’t done stained glass in years, and I don’t happen to have any lying around. And I didn’t feel like waiting a day (I did this on a weekend) then driving 20 minutes to a supply store and back just to get a $5 roll of copper foil. Instead, I dropped by the hardware store and went with option two:

ace metal repair tape
Option two.

This is the stuff you repair muffler leaks and such with. It’s conductive, which, for my purposes, is pretty much the only hard requirement. It doesn’t hold solder at ALL, so fastening wires to it was a pain, but oh well. Maybe some day that I have time I’ll go get some copper foil, but not right now. I carefully cut two strips of it each about 3mm thick and 35cm long. That itself was a pain, but conveniently, at 5ft you have plenty to practice on. Once I cut those strips, I carefully laid them on the front and back edges of the top case edge such that there was a 1-2mm gap between them. They folded over the edges by a ways, but as uneven as they are, they still look fine.

conductive strips
Conductive strips running along the top edge of the case

I don’t have a great picture of the connections on the other side, but you can probably imagine. I peeled two wires off the side of some ribbon I had laying around and stripped the ends. I just electrical-taped those to the strips on one side near the bottom such that each wire contacts one side. Then I stripped the other ends, which are now our “sensor terminals.” The only other parts to worry about are headers soldered to the main clock board and a little detachable board soldered to the sensor which plugs into them.

And that does it for the “sensor” part – with no finger present, the wires have an open circuit between them, and when a finger is present, there’s some resistance, the value of which depends on an annoying number of variables.

Now, I had to pick a method to READ this sensor, so here’s what I did FIRST.

I looked first at the schematic surrounding the relevant switch, it’s simple enough.

schematic
We’re looking at that bottom switch, Z.

The three switches are all connected between GPIO pins in “read” mode and ground. That is, internally there’s a pull-up resistor to VDD and the micro is reading the voltage below it. I can use that. The way the digital “read” mode works is that, if the voltage at the pin is above some threshold, the microcontroller reads a “1” and if it’s below the threshold, it reads a “0”. In this case, since the switch is NO (normally open), a “1” corresponds to “not pressed,” meaning I need to momentarily “close” the switch, shorting the pin to ground to “press” it and get a “0.”

I used this threshold behavior to my advantage to reduce the part count to a single resistor. I selected a resistor to put in parallel with the switch such that the voltage at the microcontroller pin was just ove the threshold around 2.7v. In my case, that was somewhere between 35kΩ and 45kΩ. Then, the touch sensor is wired in parallel to that. When it’s touched, the resistance across it serves to decrease the resistance of the 35k-45k resistor, since the two are in parallel. Assuming you tuned the 35-45k resistor right (I used a 100k pot for testing), the resulting resistance drop will decrease the voltage at the pin until it’s just below the threshold to register a “0” and a button press.

finished method one
The finished product of method one

In practice this works, but it’s what you’d generously refer to as ghetto hackery. It doesn’t work all that well, and it’s a bad design for many reasons: First, the resistance presented by your hand on the sense strips is HIGHLY variable. I eventually settled on this method because, at the time that I was in my basement testing, it was a pretty hot and humid day out and my hands were a bit clammy. The salt on them from sweating on and off at an elevated rate all day combined with the moisture meant that the resistance at the sense strips was abnormally low, resulting in fairly accurate microcontroller response. I found over the course of the next few days that normal dry and clean hands had far too much resistance, even over such a short distance, to get a good response. I had to either press hard, or use my full hand (more surface area). The only reliable way to get a good press was to lick my finger before pressing: the saliva is much more conductive. That’s alright, but it doesn’t effectively solve the original problem, which is easily and quickly shutting the light off at night. Having to lick my finger is just about as cumbersome as picking up the clock, and much grosser.

original schematic
Method one schematic: V1 is the ~2.7v value with no finger present

Besides not functioning either well or predictably, another problem with the design is that you have a constant current flowing through both the fixed resister and the internal pull-up. By V=IR, with V= ~2.7v and R = ~39k, you get I = ~.000069A, or
~69µA constantly flowing from the internal supply to ground. Now, that’s not all that much, and it’s not as if I’m going to burn a resistor (even the little tiny one in the micro), but that’s still just wasting power. That much current could provide enough juice for 69 MSP430 microcontrollers in standby. In addition, holding the micro’s sense pin around the threshold voltage is probably just bad practice. The Arduino software seems to handle this nicely, but the micro is probably reading horrible noise on that pin from its internal comparator. All in all, it’s just bad.

So I decided to scrap the passive plan and try method two. I could have done something like get another microcontroller (I have a few MSP430 value line parts lying around now) and make essentially an ohm meter, using a GPIO pin to output 1 or 0 to the Arduino’s input (switch) pin. But that’d be unnecessarily complex. What I really wish is that I could somehow amplify the resistance of my finger. Wait, did somebody say “amplify”? Transistor time!

2n2222 and schematic
Everybody’s friend, the quad-2

Idea two is to not exactly to amplify the RESISTANCE of my finger, but at least to amplify the CURRENT that flows through it. Touching the sense strips means a small current flows through my finger as per V=IR. If I pipe that current into the base of a standard NPN transistor, I can amplify it. And I can make the amplified current flow between the internal IC pull-up resistor and ground. BINGO! This has the advantage, thanks to the huge current gain (β=200 for the spare 2n2222 I had), even with a really big resistance  on the sense strips (dry hands), that tiny current results in a relatively large current from collector to emitter of the transistor. A relatively high I flowing through a resistor of relatively high R (that is, the internal pull-up) is a relatively high voltage drop. If this current is high ENOUGH (.151mA, according to I = V/R = 5/33k), then the transistor is effectively a dead short to ground, which is exactly what the Arduino wants to register a “0” on that pin. And if it’s not .151mA, the voltage at the pin will probably at LEAST go below the threshold by an amount greater than in method 1.

new finished product
Now it looks like this. I also added headers for the sensor such that it’s totally modular. You know, in case I decide to change my mind again.

So the part count is now up to a single transistor instead of a single resistor, and it’s already much more reliable. The only thing is that it’s usually pretty bad to put the full VDD directly onto a BJT’s (Bipolar Junction Transistor’s) base, because then you can get nasty side effects and it’s not good for the transistor. The finger will always be a great enough base resistance, but in the case that the sensor is shorted with some kind of metal, I added a real base resistor of 1kΩ in series with the sensor. It won’t decrease the small current substantially, and we have plenty of headroom. You can’t really see it in the image to the right, but the board is now about the same size and includes female headers to plug into the clock, as well as headers to plug into the sensor. I didn’t do that originally, but now I can take the board out totally. I also had to add VDD to the mix, since there are now active components. That’s the little red jumper that goes from the wall plug jack to the center pin on my header which was previously unused.

schematics before and after
The new schematic on bottom and the old one on top.

So there you have it. A simple little one-or-two part mod to make darkening my clock easier, and a whole boatload of ideas about how to implement a resistive touch sensor. Here’s a video, for fun (it was made with design one, but you probably won’t notice a difference since my hands were sweaty at the time and it worked fine :).

Bulbdial touch mod from Alex Whittemore on Vimeo.

8 Comments

  1. cmholm
    August 13, 2010

    Excellent idea. My wife and I have taken to the low-tech method of throwing hand towels over all of the glowing LEDs in the bedroom, but a dimmer is superior, decor-wise!

    You seem to have a bread board that folds up into a portfolio, if I’m seeing it correctly. Got a DIY or catalog link?

  2. August 13, 2010

    Conveniently the clock, already includes a mute function, just not an easily accessible one!

    And I only one up you slightly re:towels. My method of choice for for glowing LEDs in the bedroom is electrical tape or duct tape :). Although that’s only on fixed items. I am forced to just throw a towel over the two (BLINDINGLY bright) LEDs on my laptop when it’s asleep and charging.

    And no, I don’t have a DIY link for the breadboard. It’s just a few normal breadboards interlocked together (they include notches for it) and then stuck to a plastic clipboard. The only fancy part is that I soldered a wire to each power rail of each individual board (so 12 total, 3 boards by 4 rails per board) and then added banana terminals/binding posts to the clip. There’s a grid of male headers for connecting individual rails to individual binding posts.

    It’s probably a bit overkill, but it’s also really convenient. Maybe I’ll do a writeup at some point.

  3. August 14, 2010

    […] Touch Brightness Bulbdial « alexwhittemore.com One SMD bare part is ~$12, and a different broken-out part is $24. Both are a bit more than I want to spend on this project. Second, looking at the schematic from the bottom of the first link above, there are no spare GPIO pins left on the . part count to a single resistor. I selected a resistor to put in parallel with the switch such that the voltage at the microcontroller pin was just ove the threshold around 2.7v. In my case, that was somewhere between 35kΩ and 45kΩ. […]

  4. […] Touch Brightness Bulbdial via HaD. Alex writes – The Bulbdial clock from Evil Mad Scientist is probably the coolest clock idea I’ve ever seen. Even cooler are my parents, who got the kit for my birthday.  The basic idea is that three rings of LEDs cast shadows onto a clock face to form H/M/S hands, somewhat like a sundial, with the hands slowly animating around. A lot of thought clearly went into making this kit, and it’s very nicely done, but there’s a major drawback: I want to use it on my bed side table, where I usually keep a clock, but it’s too bright for me to fall asleep! Of course, that’s been thought of too: in the normal view mode, the three buttons at the bottom of the clock are brightness up, down, and “mute,” which turns off the LEDs entirely. But they’re hard to get to buried underneath the frame of the clock, and it makes muting the display cumbersome in the dark. Let’s fix that! […]

  5. […] been getting great use out of my modded Evil Mad Scientist Laboratories Bulbdial clock (you might remember, I modded it with a touch sensitive strip to turn the display on and off), but it's been having […]

Leave a Reply

Your email address will not be published. Required fields are marked *