Who does not like flashing toys. Some time ago I created Led Staff a stick with led lights where each LED can be individually programmed using bluetooth creating unlimited number of beutiful patterns. The instruction on how to build it is as follows.
Materials:
1 x Atmega 328P-PU
1x 5V Micro USB 18650 Lithium Battery Charging Board Protection
1x 18650 Batery
1x HC-05 Wireless Bluetooth RF Transceiver
2m Led Strip WS2812B Ditigal RGB Pixel 5050
1x On-Off switch
2x 22nf capacitator
1x 16 MHz crystal
1 x resistor 2,2K ohm
2 x resistor 10K ohm
1x metal rod 1,5m, 6mm
1x Plexiglass tube outer diameter 30/2 mm
2x End caps for tubes fi 30
Items needed for etching PCB
Scheme for the entire construction with the PCB is as follows::
Like many created by me project based on Atmega 328 module base for this construction is Breduino about which more can be read here httpss://www.arduino.cc/en/Main/Standalone
To Atmega we have connected two modules. They are individualy programable Led Strip 5050 and HC-05 module for bluetooth comunication. Everything posible to turn on and off with on-off switch.
Depending on which type of led staff we want to make we need to buy appropriate led strips. On the market we can find several types of Led Strips. Tapes are divided mainly depending on the number of LEDs per m (normaly 30/60/120/144 per meter), kind of used LEDs (3528,5050,5630 itp. The numbers correspond to the size of the LEDs for example, led 3528 is Led with dimensions of 3,5×2,8 millimeter), refresh rate (Mhz), whether leds are individually programmable or programmed are only whole bands, color (one color, RGB), voltage (5V, 12V).
In case of this project has been used tape which have 60 LEDs per meter WS2812B driver, RGB Leds 5050 5V individually addressable. On eBay you can find them for about 13 USD per meter. If we want to save money, we can install a single-color Led Strip they are much cheaper, but we cant program leds indiwidualy making them preety boring and they typically run on 12V. Drivers WS2812 should be sufficient for most applications, except if you would like to have a Led staff giving effect Persistence of Vision (Pixel Staff), unfortunately, for this purpose refresh rate it is too small and it would be necessary to invest in more expensive Led strip with LPD8806 drivers (about 30 USD per meter and we probably won’t find the tapes with more than 60 LEDs / meter). However, if we invest in better Led strip the rest of the structure remains unchanged.
The tape has the three outputs they are 5V, grounding and data output. In the case of 5V and grounding solution should be obvious. The data is connected to one of the Arduino outputs in my case this is the output 15.
Another module is a Bluetooth module. Personally, I recommend HC-05 is a cheap unit that can be bought on e-bay for about 3-5 dollars, but for such price we have to modify and conigure it a bit as. For this purpose I would refer to another instruction which is worth reading https://makezine.com/projects/diy-arduino-bluetooth-programming-shield/
As last step we add on-off button and power source. Ready scheme we are etching using these instructions: https://binaryalchemist.pl/jak-wytrawic-plytke-drukowana/
This way, we ghave ready PCB and we only need to assemble the staff. As a base we use metal rod with a length of 1.5 m and a diameter of 6 mm. To separate the metal from the cables, PCB and Leds and improve its appearance it is worth to wrap with heat-insulating tape. At its center we placed PCB which can be immobilize with the insulating tape. Then on both ends lets install LED strips. Led Strips are divided into 4 sections of 30 LEDs each, connected by cables. Power comes from battery 18650. To charge stick enjoyable and efficent its best to prepare a small battery compartment and use the module “18650 Lithium Battery Charging Board”. Connecting module with batery is very simple and thanks to it we can quickly and easily recharge the batteries without unscrewing whole staff. On-Off switch finds itselfs in one of the plugs. The whole is put into Plexiglas tube with outer diameter 30/2 mm
Each LED is possible for individual programming so you can create a virtually infinite number of effects. Source code looks like this, but first lets download the following Library httpss://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation:
#include
#define PIN 11
Adafruit_NeoPixel strip = Adafruit_NeoPixel(108, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show();
}
void loop() {
colorWipe(strip.Color(255, 0, 0), 50);
colorWipe(strip.Color(0, 255, 0), 50);
colorWipe(strip.Color(0, 0, 255), 50);
theaterChase(strip.Color(127, 127, 127), 50);
theaterChase(strip.Color(127, 0, 0), 50);
theaterChase(strip.Color( 0, 0, 127), 50);
rainbow(20);
rainbowCycle(10);
rainbow(10);
rainbowCycle(5);
theaterChaseRainbow(50);
feuerfrei(strip.Color(40,0, 0), strip.Color(0, 0, 255),100,20);
}
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}
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);
}
}
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 (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, c); //turn every third pixel on
}
strip.show();
delay(wait);
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}
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 (int 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 (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off
}
}
}
}
void feuerfrei(uint32_t c, uint32_t c2, uint32_t repete, uint8_t wait) {
for (int rep = 0; rep < repete; rep++) {
int e = random(0, 27);
int f = random(28, 54);
int g = random(55, 81);
int h = random(82, 108);
for (int i = 0; i < 27; i++) {
for (int no = 0; no < 108; no++) {
strip.setPixelColor(no, c);
//strip.setPixelColor(no, strip.Color(0, 255, 0));
}
if (e + i < 27) { strip.setPixelColor(e + i, c2); } if (e - i >= 0) {
strip.setPixelColor(e - i, c2);
}
if (f + i < 54) { strip.setPixelColor(f + i, c2); } if (f - i >= 27) {
strip.setPixelColor(f - i, c2);
}
if (g + i < 81) { strip.setPixelColor(g + i, c2); } if (g - i >= 54) {
strip.setPixelColor(g - i, c2);
}
if (h + i < 108) { strip.setPixelColor(h + i, c2); } if (h - i >= 81) {
strip.setPixelColor(h - i, c2);
}
strip.show();
delay(wait);
}
}
}
void nieustraszony(uint32_t c, uint8_t wait){
int val;
int val2;
int val3;
for(uint16_t i=0; i<15; i++) {
val = 29-i;
val2=30+i;
val3=59-i;
strip.setPixelColor(i, c);
strip.setPixelColor(val, c);
strip.setPixelColor(val2, c);
strip.setPixelColor(val3, c);
for(uint16_t j=0; j<60; j++) { if(i!=j&&j!=val&&j!=val2&&j!=val3){ strip.setPixelColor(j, strip.Color(0,0,0)); } } strip.show(); delay(wait); } for(uint16_t i=15; i>1; i--) {
val = 31-i;
val2=61-i;
val3=28+i;
strip.setPixelColor(i, c);
strip.setPixelColor(val, c);
strip.setPixelColor(val2, c);
strip.setPixelColor(val3, c);
for(uint16_t j=0; j<60; j++) {
if(i!=j&&j!=val&&j!=val2&&j!=val3){
strip.setPixelColor(j, strip.Color(0,0,0));
}
}
strip.show();
delay(wait);
}
}
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
}
The finished project is as follows:




Interesting references:
Eagle schematics
Source code