The Arduino code for this project can be downloaded here https://github.com/samclippinger/lightbox
Almost all of the tweakable values are set using #define commands near the top. For example, if you want to change the chance of a starfield effect appearing, look for STARFIELD_CHANCE_PERCENT. The comments should help explain what each value does.
Wiring
Very little wiring is needed to make this project work. To start, the plugs on the ends of the LED strand are useless here, so go ahead and cut them off.
With only one of strand of LEDs, the "output" end isn't needed. I just folded the wires over and covered them in heatshrink. (I didn't want them to accidentally touch and short out some day.) If you want to make this project bigger and use more LEDs, you'll need to connect the strings and (if you have more than 50 LEDs) provide additional power mid-strand.
On the "input" end of the strand, the "serial data" and "serial clock" lines will need to connect to the Arduino. The wires in the LED strand are multi-strand, which makes them nicely flexible but very difficult to mash into a breadboard (or an Arduino). I solved problem this by splicing them to a short piece of 20 gauge solid-core copper wire, which fits easily into an Arduino hole. After twisting the wires together, I dribbled a bit of solder on the connection to hold it. As a last step, I covered each junction with heatshrink so no one can see how bad I am at soldering...
The 5V and ground lines were already each split into two lines, but I decided I needed three: two to the Arduino and one to the power jack. Again, heatshrink makes it look very professional.
On my LED strand:
- Red is the 5V line
- Blue is the ground line
- Yellow is "serial data"
- Green is "serial clock"
- Connect the 5V line to both the positive post on the power jack and the "Vin" hole on the Arduino.
- Connect the ground line to the negative post on the power jack and the two "GND" holes on the Arduino.
- Connect the "serial data input" line to the Arduino's digital pin 11
- Connect the "serial clock input" line to the Arduino's digital pin 13
Before you go any further, plug in the 5V power. Then connect the Arduino to your computer with a USB cable. (Don't plug in the USB first, or the Arduino will try to power the LEDs from the USB power, which could damage the Arduino.)
Use your computer to upload this project's code to the Arduino. If everything is wired correctly, you should see some of the LEDs light up and start to blink and/or fade between colors. The patterns won't be distinguishable while the LEDs are in a pile, but that's OK. If they light up, your wiring is correct.
Text editor powered by tinymce.