My kids like those chemoluminescent sticks but they last only for one evening. So I thought of making something similar from LEDs. Taking WS2812B LEDs allows even to add effects. The idea was to have a device to which I can plug a LED strip of any length (within limits) without having to reflash it.
After the first prototype was running I build some kind of belts which my kids could wear. (They do and they like it!) I had also seen an umbrella somewhere on Adafruit's website. So this was my second use for it. These first prototypes used an arduino nano clone and the circuit on perfboard.
Files
WSController.sch
Schematic of the main PCB
x-kicad-schematic -
15.23 kB -
11/27/2019 at 19:46
The software makes use of the neopixel library to address individual LEDs at the beginning. Afterwards some of the many effects of the WS2812FX library are used. The mcu checks the battery voltage (via internal reference) and shuts down if it drops below a threshold. If the mode switch is pressed after the last available effect, it will also shut down the device. The code is on github.
There are two switches in the circuit - one as a latching switch (SW 2) to switch it on and the other as a mode switch (SW 1).
The latching switch circuit : that's Q2, Q3 and SW2. Pushing SW2 puts the gate of Q3 high. This connects the overall ground GND to PWRGND which is the battery ground. Thus the mcu gets a supply voltage and will pull the base of Q2 low. This will keep the gate of Q3 high. SW2 can be released and is not used anymore.
At the beginning the gate of Q1 will be low. So all current for the LED strip will flow through R2. The mcu now lights LEDs from the start to a defined maximum number (for the moment 200) - one at a time and measures the voltage drop at R2. From this it's easy to find out the number of connected LEDs. Afterwards the gate of Q1 is set high and R2 is shorted by Q2.
The MOSFETs Q1 and Q3 are obviously over-dimensioned. However, the IRLU024N/IRLR024N is the standard MOSFET which I use in my projects : first it's a logic level MOSFET and second it's reasonably priced. So as long I do not need hundreds of them I see no point in flipping through data sheets for hours just to save a few cents.
I build the device into electrical tubing (25mm diameter) which makes a housing which is stable and can be carried around easily, is just big enough to hold a 18650 cell and is very cheap. I added an off-the-shelf LiPo charging board and some cable with a robust connector. For the prototypes the lid (with the USB connector for charging) was manually cut from acrylic and the other end I just sealed with silicone. The circuit for a latching switch, a mode switch and to determine the length of the LED strip was build on perfboard and connected to an arduino nano clone.
Assembly of the PCB is straight forward. To program the mcu I used a modified AVR-ISP-adapter: I had butt-coupled and soldered pogo-pins to a 6pin pin header together with some additional pin-headers for meachnical stability. The mcu can the programmed e.g. from the Arduino software using an external programmer (don't forget to first burn a bootloader to set the fuses of the mcu - the bootloader will be deleted again when the program itself is flashed).