Introduction: LED Light-up Hoodie
For this project you'll need the following:
Soft potentiometer by Plug&Wear
Adafruit GEMMA
Sewable NeoPixels - For this project I also used NeoPixels from Adafruit
3-ply stainless conductive thread
3xAAA battery pack
Sewing needles
Plain thread
Scissors
Clear Nail Polish(Optional)
Step 1: Sketch Out Your Circuit
This step sounds trivial if you have worked with circuits and electronics before, but it can be really helpful to visualize the outline of how your project is going to work.
This sketch shows exactly how the circuit should work and how the flow of it works.
We can see where ground is and how each component should work with each other.
Step 2: Begin Sewing!
This process may be easier said than done.
You want to place you Gemma Board (You can use a Sparkfun Lilypad as well) somewhere safe and discreet. I placed mine on the inside of the jacket.
I began by sewing in the potentiometer. The top and the bottom and the "slider" that attaches to the Gemma board. From there I began to sew in my first neopixel!
Step 3: Sewing the Neopixels
This step was a bit tricky. The theory behind it is to create the connections. A piece of advice is to connect each neopixel individually and troubleshoot as you go. Often times what happens if all neopixels are sewn in at once is the circuit breaks somewhere, and finding where it breaks can be difficult and time-consuming to fix. It is always easier to check as you go!
Step 4: Troubleshooting Is Important!!
THIS IS A GOOD EXAMPLE OF NOT TROUBLESHOOTING!
I did this too quickly and found that one of my neopixels was not connecting the way I wanted them to! With a little bit of extra time I was able to get the neopixel working again!
Step 5: Time for CODE!
By default the neopixels light up white! In order to get the color changing and to change the brightness we have to implement the code!
Here is the sample code that I was able to use for it. Gemma boards run under Arduino software! Make sure you have this!
#include
#define PIN 1 // Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
int sensorPin = 1; // select the input pin for the potentiometer (analog 1 is digital 2)
int sensorValue = 0; // variable to store the value coming from the sensor
int colorValue = 0;
void setup() { // Set internal pullup resistor for sensor pin (analog 1 is digital 2)
pinMode(1, INPUT_PULLUP);
strip.begin();
strip.setBrightness(40); //adjust brightness here
strip.show(); // Initialize all pixels to 'off' }
void loop() { // read the value from the sensor:
sensorValue = analogRead(sensorPin);
colorValue = map(sensorValue, 0, 1024, 0, 255); //map sensor values from 0-124 to 0-255
for (int i = 0; i strip.setPixelColor(i, Wheel(colorValue)); //use Wheel function to set color } strip.show(); }
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) { return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); } else if(WheelPos < 170) { WheelPos -= 85; return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } else { WheelPos -= 170; return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } }
Step 6: Ta-Da!
You are done! And now with a switch of a button you can have the lights turn on and with the slider on your potentiometer you can control what color you want your neopixels to shine!