User Tools

Site Tools


projects:neopixel-backpack

NeoPixel BackPack


Hardware

  1. 1* Backpack
  2. 1* esp8266
  3. 2* WS2812B IP67 (75 Led long, or the length you need)
  4. wire to connect esp8266 and WS2812B
  5. heat shrink tube
  6. 1* Generic Plastic Case (LxHxB)
  7. 1* Battery Pack
  8. 1* USB cable to connect esp8266 with battery pack

Assembly

IN PROGRESS


Current Arduino Code

#include <Adafruit_NeoPixel.h>
#define PIN 15
#define LED_AMOUNT 72
#define PIXEL_SPEED 100

Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_AMOUNT, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show();
}

void loop() {
  TestFun(20, 0, 0, 0, 20, 0);
  for (int a=0; a<2; a++) {
    SnakeFun(20, 20, 0, 20 , 0, 20);
  }
  MaxFun(20, 20, 0, 20 ,0, 20);
  for (int a=0; a<2; a++) {
    SnakeFun(20, 0, 20, 20 , 20, 0);
  }
  MaxFun(20, 0, 20, 20 , 20, 0);
}

void TestFun(int MAIN_COLOR_RED, int MAIN_COLOR_GREEN, int MAIN_COLOR_BLUE, int SEC_COLOR_RED, int SEC_COLOR_GREEN, 
int SEC_COLOR_BLUE) {
}

void SnakeFun(int MAIN_COLOR_RED, int MAIN_COLOR_GREEN, int MAIN_COLOR_BLUE, int SEC_COLOR_RED, int SEC_COLOR_GREEN, int SEC_COLOR_BLUE) {
  int RAD_LED_AMOUNT = random(12,LED_AMOUNT+1);
  int RAD_MAIN_LENGTH = random(2,10); 
  for (int i=0; i<=RAD_LED_AMOUNT; i++) {
    setPixel(i-RAD_MAIN_LENGTH-2, 0, 0, 0);
    setPixel(i-RAD_MAIN_LENGTH-1, SEC_COLOR_RED, SEC_COLOR_GREEN, SEC_COLOR_BLUE);
    setPixel(i-1, MAIN_COLOR_RED, MAIN_COLOR_GREEN, MAIN_COLOR_BLUE);
    setPixel(i, SEC_COLOR_RED, SEC_COLOR_GREEN, SEC_COLOR_BLUE);
    showStrip();
  delay(PIXEL_SPEED);
  }
  for (int i=RAD_LED_AMOUNT; i>=0; i--) {
    setPixel(i-RAD_MAIN_LENGTH-2, SEC_COLOR_RED, SEC_COLOR_GREEN, SEC_COLOR_BLUE);
    setPixel(i-RAD_MAIN_LENGTH-1, MAIN_COLOR_RED, MAIN_COLOR_GREEN, MAIN_COLOR_BLUE);
    setPixel(i-1, SEC_COLOR_RED, SEC_COLOR_GREEN, SEC_COLOR_BLUE);
    setPixel(i, 0, 0, 0);
    showStrip();
  delay(PIXEL_SPEED);
  }
}

void MaxFun(int MAIN_COLOR_RED, int MAIN_COLOR_GREEN, int MAIN_COLOR_BLUE, int SEC_COLOR_RED, int SEC_COLOR_GREEN, int SEC_COLOR_BLUE) {
  int RAD_LED_AMOUNT = random(12,LED_AMOUNT+1);
  int RAD_MAIN_LENGTH = random(2,10); 
  for (int i=0; i<=RAD_LED_AMOUNT; i++) {
    setPixel(i-1, MAIN_COLOR_RED, MAIN_COLOR_GREEN, MAIN_COLOR_BLUE);
    setPixel(i, SEC_COLOR_RED, SEC_COLOR_GREEN, SEC_COLOR_BLUE);
    showStrip();
  delay(PIXEL_SPEED);
  }
  for (int i=RAD_LED_AMOUNT; i>=0; i--) {
    setPixel(i-1, SEC_COLOR_RED, SEC_COLOR_GREEN, SEC_COLOR_BLUE);
    setPixel(i, 0, 0, 0);
    showStrip();
  delay(PIXEL_SPEED);
  }
}

void setPixel(int Pixel, int MAIN_COLOR_RED, int MAIN_COLOR_GREEN, int MAIN_COLOR_BLUE) {
   strip.setPixelColor(Pixel, strip.Color(MAIN_COLOR_RED, MAIN_COLOR_GREEN, MAIN_COLOR_BLUE));
}

void showStrip() {
   strip.show();
}

Result

Current status:

Only one LED stripe on the backside.
Plan is do have two, starting at the below middle and over the shoulder to the front.

Battery and esp8266 are placed in the bottom next to the rain cover.

projects/neopixel-backpack.txt · Last modified: 2019/12/05 14:27 by seven