Sunday, January 29, 2012

Cycling turn signal gloves (or, ever so slightly less inconsequential blinking lights)

Building on the lessons learned in the making of the festivity gloves, I have completed my turn signal glove.  It's controlled manually by a single switch between the index and middle fingers (yes, I had to look up the names of the fingers on Wikipedia), and is really only convenient for turning left (unless you feel like contortion while riding).  The left-only limitation seemed reasonable to me, as I hug the curb out of terror while riding on the mean streets of Chicago, so I really only need to signal for lefts.

My professional ethics require me to state that this is not the first turning signal cycling glove; before getting started on this project, I did a quick Google search and found a guy who has built something slightly different.  His interface is an accelerometer, and is ostensibly compatible with the standard cycling hand signals. It looks cool, but he isn't selling them yet, and I already had an artistic vision in mind by the time I saw it, so mine is different enough to merit the necessary effort.  Also, I was interested in something that would be slightly water resistant (while the glove I made is not strictly water-resistant, everything other than the controller module is.  It would be relatively straightforward to water-resist that, too).

I wanted a glove-only turn signal approach (as opposed to something bike-mounted) because I ride a super-cheapo folding bike, and didn't want to deal with wires and whatnot having to cross the folding joints of the bike and getting repeatedly flexed and stretched.  Also, I wanted something that would easily transfer from bike to bike.  As an added bonus, always wearing a flashing glove gives you extra options for finding/guiding people in crowds.

In summary, here's an image of the completed gloves, followed by a video of them in action.




Oh, and if anybody knows somebody who knows somebody in the cycling accessory industry... let me know.

Hardware

All of the basic elements of the hardware are shown immediately below.  The black circle is one of the LED modules; below that is the switch module, next to the switch inside it.  Below that is the battery/controller module.  As before, for size and convenience reasons I am using the oh-so-beefy CR2450 watch cell for power.  The ATTINY85 is the controller; it's abilities are far more than what's necessary for this project, but it had just barely enough pins and I have some on hand.


In the interests of water-resistance, all of the exposed metal in the LED and switch modules are covered with two-part epoxy.  The switch was put inside a length of shrink wrap to allow it to be water-resisted without gumming up its delicate internal mechanisms.  Additionally, the controller module and connector are epoxy-coated.

For compactness, the ATTINY85, two dual FET switches for 'high-current' LED control and a switch and capacitor were superglued to the CR2450 watch cell snap and then epoxied for mechanical strength and a small amount of water-resistance.

The LEDs and switch are mounted on a rigid plastic to keep them oriented appropriately.  The plastic is from some binder dividers.  The wires are a very flexible stranded stainless steel insulated in white PTFE that I had laying around (I assume it was PTFE, judging by how impossible it was to strip, mechanically or with the iron tip.  I ended up burning the insulation off with a pentorch).

The wires were passed through the glove, along with a bunch of thread for mechanical stability.  I then gently pulled the glove inside-out, tied all of the sutures to keep the LEDs and switch on the glove, and then sutured the wires back to the wrist of the glove (the inside-out glove, assembled with extra slack in the leads to allow for testing, is shown directly below).


After turning the glove back out and testing the lights/switch, I shortened the leads and re-attached them to the module connector (shown below).  I then epoxied the connector and pentuple-sutured it three times to one of the heavy-stitched seams along the inside of the wrist.


The electronic design was similar to that used for by previous glove project, except that I needed to provide for more than two times as much current per channel.  I decided to go for the maximum current through each LED (30mA); for three in parallel, this far outstripped the 40mA limit on the ATTINY85 output pins.  To accomplish this, I picked some N-channel FETs (NTMD4840NR2G, the specs are way past what I needed here, but I picked these so I could buy a bunch and not have to worry about them being insufficient for future projects).  There is no resistor between the ATTINY pins and the gate of the FETs; the ATTINY outputs are going to be either all the way high or all the way low during normal operation, and the switch allows me to completely shut off power during 'abnormal' operation, so I saw no need for pull-down or gate-current-limiting resistors.

The switch pulls the relevant pin down to ground; an ATTINY internal pullup is enabled to keep the pin high otherwise.

To allow for easy programming and debugging, the connector has three extra pins (~Reset, MOSI and MISO).  SCK is the same pin as the switch.


Oh, and the parts for this project (excepting the glove, thread, needles, shrink wrap, two-part epoxy and plastic binder separators) are a subset of the Mouser order detailed in this document.

Software

The desired behavior for the lights was to go through wrist-to-fingertip flashing patterns (flashing the fingertip lights three times) so long as the switch was depressed.  This was to mimic the pattern you see on newer turn signals on emergency vehicles.  Additionally, the flash pattern should always be completely run before turning off (so no wiring the switch between the controller and the battery).

The software for this project was very simple (as you can imagine).  After power-on, the ports are set up and the outputs are set to low/off.  The device then sets up an interrupt on the switch and goes to sleep.

Upon switch-interrupt, the device wakes up and sets the lights to the first state in the hard-coded pattern (which so attractively flashes from wrist to fingertip, before flashing the fingertips three times before repeating).  It then resets a timer, un-sets the switch interrupt, and sets an interrupt on timer compare before going to sleep.

Upon waking up for the timer compare match, the pattern counter is incremented.  If the counter is less than the maximum, the new pattern is applied to the outputs and the device re-enters the sleep state.

If the counter is at the end of the pattern, it is reset to 0.  If the switch is still depressed, we continue on as we have (don't change any interrupts).  If, however, the switch is no longer depressed, we turn off the lights, un-set the timer interrupt, set the switch interrupt and go to sleep.

As I said, very simple.

Source and hex.

Lessons

I didn't learn too much on this project that was abstract-able past the limited scope of 'making gloves light up'.  The build went very well, and the device works nicely.  There are really only two things I would have changed (and likely will change on this glove):

1: If you have an interface whose ergonomics and function you aren't certain of, mock them up and test them out first.  The between-the-fingers switch has two marks against it; first, its base had to be narrow so as not to interfere with finger movement, and second, the heat-shrinking makes it more difficult to depress.  I've tried to add something to the switch to make it easier to depress, but it's still tough and often falls over.  Additionally, index-middle finger adduction is not a common task, and the muscles just don't have that much endurance.  I might end up making another switch and putting it between the thumb and the rest of the hand, or possibly replacing the switch with one that has a greater displacement distance or that is intrinsically water-resistant.

2: The controller module needs to be better attached inside the glove.  The controller connector is very well-connected, but I didn't want to directly suture in the controller module, to allow for ease of reprogramming.  However, this means that donning the glove is ever-so-slightly more involved that it aught to be (doffing is as easy as ever, though I have been babying the fingertips more than I used to).  Adding a felt panel might do the trick, allowing the hand to enter easily but still allowing the module to be removed easily.

Overall, I'm very happy with the way this turned out.  Hopefully it will make me slightly more visible on the street when crossing through traffic.  Additionally, it should really help when someone is trying to find me in a crowd.

No comments:

Post a Comment