NeoPixel Christmas Lights!
Super (relatively) fast build for Neopixel Christmas lights!
Neopixels are very easy to use, and great as a garland on your Christmas tree!
If you're creative enough, you can design your own light patterns for your Christmas tree with a little bit of programming!
WARNING: Thar be dragons ahead! If you're dealing with a lot of current, triple check your circuit, and make sure there aren't any shorts! Always practice safety! :)
Gather Your Materials!
The essentials!
- Particle Photon
- 5 Male to Female jumper cables
- Power Supply (5V 4A)
- Neopixel strip
The tools!
- Electric tape
- Soldering iron
- Solder
- Hot glue gun (optional)
NOTE: When thinking about how many Neopixels to power, take the number of Neopixels there are and multiply it by 80ma.
On a strip, there are 144 Neopixels to power * 80 ma, which is the maximum current draw.
This means if turn on our strip at maximum brightness, our strip will draw 11.5A!! Very dangerous!
So long as we don't draw too much current in our programming, we can settle for a 4A power supply.
Wiring the Neopixels!
Now we're going to solder on some wires to one end of the Neopixel strip.
Note the direction of the arrow! That is the direction of data!
When connecting one Neopixel strip the next, always make sure you connect the DATA OUT end to the DATA IN end of a strip!
Strip three wires and solder them to each pad.
The negative sign is Ground.
The middle pad is DATA IN/DATA OUT.
The positive sign is VCC.
Be very careful when soldering the wires to the copper pads!
They're tiny, so be very patient!
Wiring/Soldering Power and Ground
The next step is to ensure the Neopixel and the Photon are wired to 5V and Ground properly.
1. Take the Male and Female end of the jumper wires together and cut off each of their headers.
2. Strip a generous amount of insulation, and twist them together.
WARNING: Be sure to unplug the power supply when modifying any of the wires!
3. Cut off the barrel plug of the power supply, and strip some insulation off the wire. Be sure to separate the two wires!
4. Identify which of the two wires is the hot end. (Generally, the hot end is marked with a minus sign. You can also identify which is positive and negative using a multimeter.)
5. Twist the twisted jumper wires around the stripped hot end of the power supply.
6. Solder this joint and be sure to wrap it with electrical tape.
7. Repeat these steps for the Ground wire.
Wiring the Photon
Connect the 5V power and GND female jumper wire to the VIN and GND pins, respectively, on the Photon.
Also, connect the DATA IN female jumper wire from the Neopixel strip to pin D6 on the Photon.
Programming the Photon Pt. 1
The Particle Photon is an amazing piece of hardware, and incredibly easy to program!
First thing's first, plug in the power supply to power your Photon.
Download the "Particle Photon" app on the Play store or the App store.
You'll need to do a bit of setup, but register for a Particle account on the app by clicking "I don't have an account."
Once logged in, be sure to add your Photon by clicking the blue "+" button on the bottom right corner and following the resulting steps.
Programming the Photon Pt. 2
Go to https://build.particle.io and login with your newly made Particle account.
Next, click on the bookmark icon on the black menu bar on the left.
Type in "FastLED" under the "Community Libraries" text box and click on the "FastLED" library in the resulting list.
You might be a bit overwhelmed with the huge library that pops up! It's alright, we can ignore most of them.
Find the file called "DemoReel100.ino" and click the blue button called "Use this Example" when you scroll down on this menu.
Quick description: FastLED is one of the best LED libraries, supporting many cool LED functions while supporting many many different LEDs. Kudos to the FastLED developers!!
Defining Your Settings
After loading up the example sketch for FastLED, we need to define some settings for our code.
1. Ensure that the DATA_PIN is set to 6.
2. Ensure that the NUM_LEDS is set to the number of LEDS that you want to control.
3. Ensure that the brightness is well below 255, preferably below 125.
Go ahead and flash your device by clicking the lightning icon in the top left corner.
You should be able to see a number of patterns being displayed on your Neopixel strip.
All the patterns can be found in this list.
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
1. Write // before these two lines of code in the loop() function.
gPatterns[gCurrentPatternNumber]();
EVERY_N_SECONDS( 10 ) { nextPattern(); } // change patterns periodically.
2. Write the pattern you've chosen from the list specified above with ();
3. Enjoy!!