Introduction: Neopixel Ring Motorcycle Helmet
This instructable is on how to modify a motorcycle helmet ( or any helmet for that matter ) with a neopixel ring using a Lilypad Arduino and a sound sensor.
DISCLAIMER: This modification could violate safety laws in your area. If you live in an area where a helmet it required, do not drill into your helmet. If you live in a "no helmet" area, then it is up to you. This is purely for looks.
You will need a helmet with a removable shell. You will need a neopixel ring (adafruit) and some sort of arduino board and a sound sensor. If you get a Lilypad Main board you will need a power distribution board. The battery plugs into this board and powers the rest of the components.
You will also need these supplies:
Wire, solid is easiest to solder with.
Wire strippers.
Soldering Iron and solder.
Hot glue gun.
Clear 2 part epoxy.
Drill
1/8th inch drill bit.
Step 1: Programming
This has a great starting block for neopixel programming.
Use the wire diagram to see how all the boards talk to eachother.
I added a segment of code to control the light pattern by the sound sensor. I mapped the sound sensor value down from 1-1024 to 1-255.
I am setting my value to go through the light patterns while I am at idle, and to stop when I am riding down the road.
Keep in mind that this was adapted from a goggle project so the names might be somewhat confusing, but the code works well.
Here is the rest of my code.
#include "Adafruit_NeoPixel.h"
#include "segment_models.h"
#include "segment_views.h"
#include "themes.h"
int sensorValue = A0;
int mappedValue;
// Initialize
#define PIN 6
#define LED_COUNT 16
#define LEFT_EYE_START 0
#define RIGHT_EYE_START 16
#define LEDS_PER_EYE 16
#define THEME_SWITCH_DELAY 5000 // Milliseconds
Adafruit_NeoPixel led_strip = Adafruit_NeoPixel (LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);
// Create containers for sections of your LED strands/circles.
StripView left_eye = StripView (led_strip, LEFT_EYE_START, LEDS_PER_EYE);
StripView right_eye = StripView (led_strip, RIGHT_EYE_START, LEDS_PER_EYE);
StripView both_eyes = StripView (led_strip, LEFT_EYE_START, LEDS_PER_EYE * 2);
void setup ()
{
Serial.begin(9600);
pinMode (A0, INPUT);
// Aways give your project a safe boot delay so you can re-upload code when:
// - it uses too much current when your LEDs are too bright
// - the serial doesn't respond because of some timing issue
delay(3000);
led_strip.begin ();
}
// Main Loop
void loop() {
// strip.setPixelColor();
sensorValue = analogRead(A0);
Serial.print("sensorValue :");
Serial.println(sensorValue);
mappedValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print(" map to 0 - 255 :");
Serial.println(mappedValue);
if (mappedValue < 30 && mappedValue >=1)
{
// Switch themes every {x} seconds
Theme::switch_every (THEME_SWITCH_DELAY);
left_eye.clear ();
// Update the spots
left_eye.update ();
// Draw the spots.
left_eye.draw ();
led_strip.show ();
}
if (mappedValue <255 && mappedValue >=31)
{
left_eye.clear ();
led_strip.show();
}
}
Attachments
Step 2: Layout the Hardware
Layout where you would like the hardware to go.
Draw an outline around the board.
Label the ports of each board to show orientation of the board.
Step 3: Remove Material
I used my soldering iron to melt the material away. It worked very well. You could also use a drill, dremel or plain old exacto knife. Just get the material out of the way.
Step 4: Route Wires
Cut the wires to proper length. ( leave a cm or so extra just for safe measures )
Strip each end and solder wires to correct port.
Once you have all the wires the correct length and soldered to the correct port hot glue all the hardware and wires down securely.
Step 5: Drill
It is important to measure precisely. I did not get the holes above the LEDs perfectly but you still get a good effect.
Use a 1/8th inch drill bit. An larger and you risk all the holes cracking into eachother. Any smaller and not enough light is seen.
Step 6: Fill Drill Holes With Epoxy
Fill each hole with clear epoxy. This will provide waterproofing and diffuse the light nicely.
I used JB Welds ClearWeld quick setting epoxy. It is the clearest epoxy I have found yet.