Light Up Belt
This project was something i was doing for class and is the first time I did anything that involved making something light up from scratch. Almost like making my own set of Christmas lights. Anyhow, it was a delight to do so I am just going to tell you guys how to make one like mine or even better.
Getting What You Need
Make sure you get everything that is on the list because we will be using all the items while creating this belt.
List of item must have:
one beltflora RGB smart Neopixel lights from adafuit
consolidated Electronic wire and cable: get four different colors of your choice so it can be easier to tall them apart when assembling everything together.
electrical tape
soldering wire and iron
shrinking tubes
wire cutters and strippers
Arduino that come with the cable to test codes and plug in to battery
portable battery that is a 5v with a usb port
hot glue gun and replaceable
breadboard
10k resistor
1k capacitor
Wires
cut 6 wires of 3 of the 4 colors, Which I am just going to name "A,B,C, and D". When cutting the wires cut them about half the length of your index finger. The reason why is because when soldering them on the the RGB LED lights and then hot gluing them on to the belt, you want it to bend nicely with out pulling any wires out from each other.
Soldering on Wires A,B, and C
after cutting the 6 wires we take them and strip each ends with the wire strippers. make sure to strip enough that will allow you to twist wire A With wire A, Wire B with Wire B, and Wire C with Wire C. what we will be doing with the first end of wire A is putting it through the Plus sign on the Rgb Led light and soldering it on. Then take B and put it through the minus sign on the RGB LED lights and solder that in as well. When soldering these wires in makes sure to have the arrows facing you. We take wire C and place it in to the arrow second arrow that is the one that should be closest to you. then solder it in. Now Repeat this step for all 20 RGB LED Lights.
Its Code Time
Okie Dokie after doing all of step 3, we want to make sure that the lights work. if they do not after installing this code make sure to check some of you connects and that all of your arrows were facing the right way.
make sure to have your power source when
this is the code for the photocell and for the lights to work on together.
#include
#ifdef __AVR__ #include #endif
#define PIN 6 int photoCell = A0; int photoCell_read;
// 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) // NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products) Adafruit_NeoPixel strip = Adafruit_NeoPixel(20, PIN, NEO_GRB + NEO_KHZ800);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across // pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input // and minimize distance between Arduino and first pixel. Avoid connecting // on a live circuit...if you must, connect GND first.
void setup() { // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket #if defined (__AVR_ATtiny85__) if (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif // End of trinket special code
Serial.begin(9600); strip.begin(); strip.show(); // Initialize all pixels to 'off' }
void loop() {
photoCell_read=analogRead(photoCell); Serial.println(photoCell_read); // Some example procedures showing how to display to the pixels: if(photoCell_read >= 800){
} else if(photoCell_read <= 799 && photoCell_read >= 400) { colorWipe(strip.Color(255, 0, 0), 50); // Red colorWipe(strip.Color(0, 255, 0), 50); // Green colorWipe(strip.Color(0, 0, 255), 50); // Blue colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW // Send a theater pixel chase in... theaterChase(strip.Color(0, 0, 0, 255), 50); // White RGBW theaterChase(strip.Color(127, 0, 0), 50); // Red theaterChase(strip.Color(0, 0, 127), 50); // Blue } else { theaterChaseRainbow(50); }}
// Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i
void rainbow(uint8_t wait) { uint16_t i, j;
for(j=0; j<256; j++) { for(i=0; i
// Slightly different, this makes the rainbow equally distributed throughout void rainbowCycle(uint8_t wait) { uint16_t i, j;
for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel for(i=0; i< strip.numPixels(); i++) { strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255)); } strip.show(); delay(wait); } }
//Theatre-style crawling lights. void theaterChase(uint32_t c, uint8_t wait) { for (int j=0; j<10; j++) { //do 10 cycles of chasing for (int q=0; q < 3; q++) { for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, c); //turn every third pixel on } strip.show();
delay(wait);
for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, 0); //turn every third pixel off } } } }
//Theatre-style crawling lights with rainbow effect void theaterChaseRainbow(uint8_t wait) { for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheel for (int q=0; q < 3; q++) { for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, Wheel( (i+j) % 255)); //turn every third pixel on } strip.show();
delay(wait);
for (uint16_t i=0; i < strip.numPixels(); i=i+3) { strip.setPixelColor(i+q, 0); //turn every third pixel off } } } }
// Input a value 0 to 255 to get a color value. // The colours are a transition r - g - b - back to r. uint32_t Wheel(byte WheelPos) { WheelPos = 255 - WheelPos; if(WheelPos < 85) { return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } if(WheelPos < 170) { WheelPos -= 85; return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } WheelPos -= 170; return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); }
Assemble
Okie Dokie once we have everything working and we are now going to put everything together. note when i was making my belt i used my soldering iron to burn holes through it faster. if you do this make sure to have a new tip handy for whenever you believe you will be soldering again. now once you created those holes you will now hot glue the lights in to each hole.