Introduction: No-solder Fireflies / Lightning Bugs
I wanted to add LED fireflies (lightning bugs where I grew up) to my yard for Halloween, and decided to make some with LED strands and an Arduino. There are many projects like this, but most require soldering and circuitry. Those are great, but I decided to see if it can all be done with no soldering to make them super simple to create.
I also wrote the code to easily manage any number of fireflies that can blink realistically.
The basic approach is to use WS2811 LED strands since they are already waterproof. They are popular for holiday lighting, and the combination of the WS2811 chip and 5050 LED in these is essentially a chunkier version of the WS2812b or "Neopixels" in Adafruit parlance. Their other advantage is that only one data line is needed for any number of LEDs.
Powering these is very simple - a mini USB wire to any USB power block or battery. They do not use much power and can last a long time on a USB battery.
Step 1: Parts
The parts list is intentionally simple:
- An Arduino. I used an Arduino Nano since they are less expensive and smaller. They have almost the same specs as an Arduino Uno. The ones in the link above have the pins soldered on and come with micro USB wires. You will need a mini USB cable, and some come with the Nanos linked above.
- Arduino Nano Terminal Shield. This is the trick for no-solder - you can use a screwdriver to attach the wires. If you want to solder three wires instead, you can skip this and order Arduino Nano boards with the pins not attached so you can solder directly to the Nano board.
- LEDs. I used WS2811 strands, which are programmed just like WS2812b LED strips. They are waterproof, and I got some with black wires to make them less visible in the plants. They also come with green wires. They come with 50 LEDs per strand, and they have connectors so you can daisy chain them. I am using 100-200 LEDs, so 2 to 4 of these strands. I am powering them from the Arduino 5v regulator for simplicity.
- Battery. I powered mine with any USB battery, but you can also plug it in to any USB source.
- Basic Battery
- Bigger Battery
- Huge Battery - probably overkill
Those last two are great for robots and LED lighting since they have both 5v and 12v outputs.
- JST connector - these come with the LED strands, but just in case, these are the ones needed.
Step 2: Assembly
Assembly is very simple.
Plug the Arduino Nano into the terminal shield. Make sure the pins are correct based on the labels - it can be plugged in backwards.
Use the spare JST connector that comes with the LEDs. Connect the 5v and Gnd to those pins on the Arduino. Connect the data line to pin 6 (can be changed in the code if you want).
The LED strands come with power wires that are stripped and tinned. Those could short out your battery, so cut them off or tape them up (or use heat shrink tubing if you have it). I cut off the tinned tips and cut one shorter than the other to prevent them from touching.
Now you can plug the strand into the Arduino.
Number of LEDs and Power
Each of the 5050 LEDs in the strand can use 60mA when fully on. Since there are three LEDs (Red/Green/Blue) and each can have a value of 0-256 (in the code), fully on would be 256 + 256 + 256 = 768 for the Red, Green, and Blue intensity. In my code, I am using 50 for Red, 50 for Green, and 0 for Blue, so each on LED would consume approximately 60mA * 100 / 768 = 7.8125mA per LED when they are on.
The key is how many LEDs would be on at the same time. My code currently just turns them on at some very low random odds - 5/10,000. In practice I have only seen a few on at a time, but theoretically they could all go on at once. I could add code to cap the number on at one time, but the odds are very remote. The number on is partly dependent on the number of LEDs, and the odds are computed for each LED, so as LEDs are added, more LEDs would light up.
The Arduino 5v regulator can source about 500mA, and some is used for the Arduino itself, so maybe about 450mA is available. At 7.8mA per LED, that allows about 57 LEDs on at the same time, and even when an LED is on, it is mostly fading up or down, using even less power. So, practically, the Arduino USB power adapter is fine for a lot of LEDs.
Number of LEDs and Arduino Memory
When compiling, the program with 100 LEDs, the Arduino IDE reported that 21% of the DRAM was being used (mostly for the LED status array), for 300 LEDs, it was 60%. So, a few strands is fine. If you need a lot more LEDs, you could just keep a list of the LEDs that are actually on - would be much more efficient, but with that many strands, you will also run into power issues - voltage drop, and would need techniques like power injection. I have used that in other Instructables, but is beyond the scope of this quick project. At 100-200 LEDs, there is plenty of DRAM and power.
Step 3: Program the Arduino
The attached sketch will blink the LEDs like fireflies. The code is commented a bit, but the main thing is setting the number of LEDs to how many you are using.
Step 4: Location, Power, Weatherproofing
This project is powered by the USB port on the Arduino, so any USB power source can be used. For a more permanent display, you can use a USB wall adapter.
If the project is going to be outside for any length of time, it should be waterproofed. A waterproof electronics box or even a food container is fine.
Participated in the
Halloween Contest 2019