Accelerometer-controlled LED Bike Helmet

13K97

Intro: 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

For the Helmet/Hat:
For the Circuit:
  • 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
  • Breadboard
  • 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.
Helpful tools:
  • Wire stripper/cutter
  • Scissors
  • Soldering iron and Solder
  • Needlenose pliers
  • Cutting tweezers
  • Hot glue gun and glue sticks
Spare parts:
  • accelerometer
  • 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:
https://www.instructables.com/id/Voltage-Regulator/
https://www.instructables.com/id/Improved-Simple-Adjustable-DC-Power-Supply/

Also, this Instructable points out that you can convert a cigarette car charger into a 5-12V power supply:
https://www.instructables.com/id/Programmable-LED-Umbrella/#step1

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 Arduino site has thorough documentation on how to connect LEDS to the Arduino via the Max7221. For this, you will need this subset of ingredients from Step 1:
  • The 24 LEDs (red, white, amber/blue)
  • Arduino microcontroller (which will supply power while connected to the computer)
  • Max 7221 chip
  • Capacitors
  • Resistors
  • Breadboard, jumper cables, alligator cables
  • Voltage regulator
  • Accelerometer
Arduino's Max72xx documentation has a great wiring schematic-- use it to build the circuit on the breadboard. Note that we only use 24 LEDs, so we'll only be wiring up the first three LED Matrix rows (locations [0,0] to [2,7]) from the schematic. You can also ignore the lower half of the schematic, which shows a second Max chip and an 8-digit LED display.

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
Before moving on to the next step, MAKE SURE THE CIRCUIT works to your liking. You may want to modify the program for fewer turn signal blinks, etc.

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

We're using serial and phone cables for a few reasons: to recycle old stuff, to keep things neat, and to use cabling that's flexible enough for a hat.

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

You will be soldering a lot in this step. Go slowly and test whenever you can!

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.
For the following steps, Use the PDF on this page ("24-LED-CircuitChart.pdf") to organize your pins and color-coded wires. Test after each of these steps!
  • 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.
The best for last:
  • 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

As I mentioned, testing is important after every step and sub-step.

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!

7 Comments

Very unique ...thanks for sharing.

Build_it_Bob

Yeah, but does the helmet actually work as a helmet?

Or...
Will it blend?
wow be cool to modfiy for my projects
couldnt you just use a tilt sensor?