Introduction: Accelerometer-controlled LED Bike Helmet
If you cycle for fun, exercise, commuting, or compulsion, it's important to be well-lit and visible at night. Keeping the helmet lit is a good option because it gives your head extra protection. This helmet, the next in our Lumenhattio project series, has accelerometer-controlled turn signals--just tilt your head right when you're turning right on your bike, and tilt your head left when turning left.
Please note: some of the pictures in this how-to aren't of the best quality. Get in touch with us if you need a clearer picture for any of the steps!
Step 1: Ingredients
- a 2-ft square piece of 1/2" thick sponge neoprene, sponge vinyl, or sponge foam
- non-adhesive grip shelf liner
- bike helmet
- dressmaker's pins
- 1/4" elastic braid
- a few thick hair nets (optional)
- metallic contact paper (optional)
- thread and sewing needle (optional)
- Voltage Regulator (see notes in Step 3) with snap battery connector
- Two AA batteries
- One 2x AA battery holder with "snaps"
- Arduino microcontroller with USB connector/cable (A Lilypad is used in this example)
- ADXL3xx accelerometer (again, a Lilypad version is used in this example)
- Six white 10mm LEDs for front lights
- Six red 10mm LEDs for back lights
- Twelve yellow and/or blue LEDs for right and left turn signals
- One Max7221 driver chip. You can order samples of this chip from the Maxim site.
- One 24-pin chip holder (for the Max chip)
- One 8-pin mini-DIN Serial cable, about 2 feet long
- One 4-wire phone cable, about 2 feet long
- Electrical wire
- One 30 kOhm resistor (or resistors to add to 30 kOhm)
- One 10 microF and one 100 nanoF capacitor
- About 50 jumper cables
- About 30 Alligator clip cables
- 5 small prototyping boards. I used 4 square boards for the LEDS and 1 circular board for the Max chip.
- Wire stripper/cutter
- Soldering iron and Solder
- Needlenose pliers
- Cutting tweezers
- Hot glue gun and glue sticks
- Max7221 chips (I blew a couple chips and ended up using 3 total)
- 9V battery (This was what actually blew the chips, I guess my voltage regulator is not the best)
Step 2: Make the Hat(s)
Make two hats using the PDF below. The first hat should be made from the 1/2" foam-- use the elastic braid to sew it together. The second hat, which is optional but helpful, should be made from the non-adhesive shelf grip liner. This second hat helps keep the foam hat on the helmet without any glue, keeping your original helmet intact.
After downloading the PDF below, you can adjust the pattern to fit your helmet.
Step 3: Build or Obtain Voltage Regulator / Power Supply
I built a bunch of voltage regulators years ago for a class, but I can't find my wiring diagram. Have no fear! You can easily build a voltage regulator (with power supply) using one of these existing Instructables:
Also, this Instructable points out that you can convert a cigarette car charger into a 5-12V power supply:
Step 4: Load the Arduino Sketch
Load the Arduino sketch (PDE file below) onto your microcontroller. You will need to obtain the LedControl library to drive the Max chip.
This sketch has some "TROUBLESHOOTING" code that you can uncomment in case there are issues with the circuit. This bit of code is basically the default pin-13 LED blinking light.
The sketch also outputs accelerometer data to the serial window in Arduino software, also useful for troubleshooting.
Step 5: Breadboard the Circuit
- The 24 LEDs (red, white, amber/blue)
- Arduino microcontroller (which will supply power while connected to the computer)
- Max 7221 chip
- Breadboard, jumper cables, alligator cables
- Voltage regulator
In addition to the wiring in the schematic above, you will need to connect the accelerometer to the Arudino. The Arduino site also has a good discussion of the ADXL3xx accelerometer. We only output data from the x-axis (left and right tilting), so you will connect the accelerometer's
- X-pin to the Arduino's A0 (analog zero) pin
- + pin to Power
- - pin to Ground
Step 6: From Breadboard to Protoboards
Once your breadboarded circuit makes you happy, start building the Max7221 and LEDS onto small prototyping boards. These boards will eventually be mounted on the foam hat.
If you have a spare Max chip and spare LEDs, use them! This way you can keep the breadboarded circuitry intact, just in case you run into trouble and need to refer back to your breadboard circuit.
Be sure to put the Max chip into a chip holder, then place the chip holder into the board. This will come in handy in case the Max chip dies and you need to replace it.
Solder down the 4 corners of the chip holders it stays in place.
Solder down one pin of each LED so it stays in place. Don't cut anything just yet.
Step 7: Prep the Serials and Phone Cables
Cut the 8-pin Serial cable into four pieces of equal length. Strip about 4 inches from the end of each piece, revealing the 8 wires inside. There will also be some free wire and metallic wrapper inside-- you can cut those away. Strip about 1 inch from each colored wire, revealing the raw metallic threads inside.
The 4 lengths of serial cable will be used to connect each LED protoboard (front, back, right left) to the Max7221 protoboard.
Next, cut the phone cable into four pieces of equal length. On the end of each length, separate the wires about 4 inches down. Strip about 1 inch from each wire, revealing the raw metallic thread.
The 4 lengths of phone cable will be used to connect
- the Max7221 protoboard to the Arduino
- the Max7221 protoboard to the voltage regulator
- the Arduino to the voltage regulator
- the Arduino to the accelerometer
Step 8: Slowly Solder the Circuit
Also, pins 14-23 on the Max chip will get very crowded with connections-- be sure to space the components out as much as possible, particularly the resistor(s) connected to pin 18. Solder small jumper wires if necessary.
Solder the ends of a prepped phone cable to connect the Arduino to the voltage regulator. Only two wires will be used in this connection, so you can snip the two hanging wires at either end of the cable.
Solder the resistors and capacitor to the Max protoboard.
Solder the ends of a prepped phone cable to connect the Max protoboard (pins 4,9, 18, and 19) to the voltage regulator. Only two wires will be used in this connection, so you can snip the two hanging wires at either end of the cable.
Solder the ends of a prepped phone cable to connect the Max protoboard (pins 1, 12, 13) to the Arduino (pins 12, 10, 11). Only three wires will be used in this connection, so you can snip the one hanging wires at either end of the cable.
- Solder the ends of the 4 prepped serial cables to the Max protoboard. Use the PDF on this page ("24-LED-CircuitChart.pdf") to organize your pins and color-coded wires. With the cables that connect to the front and back boards, the black wire is not used-- you can snip the black wires on these two cable.
- Solder the serial cable that is connected from the Max protoboard to go to the "front" LED protoboard.
- Solder the serial cable that is connected from the Max protoboard to go to the "back" LED protoboard.
- Solder the serial cable that is connected from the Max protoboard to go to the "right" LED protoboard.
- Solder the serial cable that is connected from the Max protoboard to go to the "left" LED protoboard.
- Solder the ends of a prepped phone cable to connect the Arduino Arduino (pins A0, +, -) to the accelerometer (pins X, +, -). Only three wires will be used in this connection, so you can snip the two hanging wires at either end of the cable.
Step 9: Test and Troubleshoot
Bits of trouble encountered:
We blew a couple Max chips in the process by connecting a 9V battery to the voltage regulator, so we downsized to using 2 AA batteries, which work much better.
After soldering the LED board, the whole circuit stopped working altogether. After ascertaining that the Arduino still worked (blink that pin 13 LED to test), we checked all the connections from the Max chip to the power supply (pins 4, 9, 18, and 19). This got the circuit on again, though it wasn't working correctly.
To get the circuit working correctly, we labeled each LED with the Max pin number to which it is connected. (You'll see an example of this in the third picture below.) We took notes on which lights weren't working right, and which pins were the issue. We had a lot of issues with pin 17, for two reasons: it has a lot of incoming connections, and it's right next to pin 18, which has a lot of connected resistors.
- As we pointed out, it is very crowded from pin 14 to pin 23 on the Max chip, and you will likely have trouble with lights connected to these pins. We had to cheat a little and use tape and hot glue to separate the connections between pins.
Step 10: Prep Circuit for Hat Mounting
We wanted to mount the circuit on the hat in a secure yet non-permanent way, thus allowing for circuit removal, improvement, and repairs. The circuit also had to have enough ventilation space to prevent overheating.
We ended up making a foam "cozy," or cushion, for each board of the circuit:
- the Max board
- the Front LED board
- the Back LED board
- the right LED board
- the left LED board
- the voltage regulator
- the Arduino
The accelerometer was so small that we didn't cushion it.
Construction pictures of the Max board "cozy" are below. A bit of hot glue was used. As you'll see in the next step, each cushion has 2 layers of foam.
Once each board had a custom cushing, we pinned each board to its cushion.
Step 11: Mount Circuit on Hat
Pins and glue were used to attach each cushion to the hat. Pieces of non-adhesive grip shelf liner, which was also used to make the interface hat between the helmet and foam hat, were used to neaten up all the cables.
Step 12: Place Hat on Helmet
Now connect the battery and try placing the hat on the helmet. Then try the helmet on!
Make any needed adjustments.
It might look bulky, but it's not heavy. For real!
Step 13: Prettify/Protect and Enjoy!
To protect the circuit and secure it even more to the hat and helmet, place a few hair nets (sometimes referred to as a snood) over the hat.
To protect the circuit from rain and add some light reflectivity, wrap the hat in strips of metallic contact paper. The hair nets will ensure that the contact paper doesn't stick to the circuit.
Your helmet is now ready to take for a spin!