I used the innovative switch project to create a signaling mechanism for bikers. Traffic safety would be greatly improved if bikers had the same communication devices that an automobile has: brake lights and turn signals.
I had 4 actions I wanted to signal:
- Brake lightly
- Brake hard
- Turn right
- Turn left
I decided to translate “brake lightly” as a half-brightness of one LED when only one hand was braking, and full brightness with two LEDs if both hands are braking.
I began by writing the code. I set up a circuit with 4 inputs and 4 LED outputs, 2 red LEDs for the brake lights, 2 green LEDs for the turn signals. Because I wanted half brightness in the brake lights, I used analogWrite with the red LEDs. I wanted the turn signals to blink, so I used digitalWrite with delay. I used a series of if statements to declare the different states of the LEDs depending on the conditions read from the 4 inputs. Here’s the code:
Access the live text of my code here.
I tested it all at my desk just touching wires and troubleshot a few errors.
Then I headed over to use Josh’s bike (thanks Josh!) to test it all out installed. I mounted my Arduino board to the middle of the handlebars with some gaffers tape.
I set up the brake lights such that the lights would turn on when the brake was pulled, because that broke the circuit between the tips of the brake.
I set up the turn signals so that a simple piece of fabric on a glove, or a ribbon around the palm would create a bridge and close the circuit. That way, there are no wires connected to the person, and everything could be hardwired to the bike handlebars.
2 red LEDs
2 green LEDs
4 10K Ohm resistors
4 560 Ohm resistors
a bunch of wires
Here’s the demo!
Next step is to make my hand straps a bit more attractive and draw up my circuit diagrams!
This prototype uses LEDs on the Arduino Uno board, but in the final manifestation, the LEDs would be mounted to the bicycle itself, and all the wiring would be built into the handlebars. Obviously it is also not ideal for the board to be mounted to the middle of the handlebars and connected to the computer… but one step at a time!