Sparkling Arduino Xmas Star
So I appreciate it is a bit late for starting a Christmas project this year. But maybe you already have everything you need, and maybe you are not going to go anywhere this year: Then maybe, just maybe you want to try this little project. Parts list is below, so check for yourselves!
It's a pentagram type star of 20 LEDs in different colors that suit the season.
And as it is Arduino driven, you can get creative with your lighting patterns: I'll provide a few options for you to start with so you find your own inspiration. Then share!
Supplies
The Light:
- 10 green 3mm LEDs
- 5 red 3mm LEDs
- 5 yellow 3mm LEDs
- 1 white 3mm
- 5 220 Ohm resistors
The Control:
- 1 Arduino Uno (or compatible)
- 1 Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685 (or compatible)
The Other Stuff:
- a suitably sized breadboard (I used an 830 pin board with power supply lines on each side)
- 5V power supply
- bunch of jumper wires
- 20+1 18AWG wires for the LEDs and GND
First: Draw / Print / Punch or Drill Your Star!
If your not good at drawing (as I admit, I am; so had to use www.wikipedia.org): Find a pentagram on any free image site, scale it to about 8cm (3 1/8") across and print it.
To conveniently solder your LEDs together you may either punch holes in a cardboard at each tip of your star and each intersection plus one in the center. Or you transfer the positions to a thin piece of plywood and drill 3mm (1/8") holes as shown in the photo.
Solder Time
Choose any position for your green, yellow and red LEDs. I decided to have a white one in the center, but you may use any color. My star is a rather random mix, but an orderly manner of arranging the colors will of course work just as well!
Next, bend the cathodes of each LED in a 90° angle. Make sure to bend them all the same direction which will make soldering easier later. The cathode is the shorter wire of each LED or the flat side of the housing.
Position each LED in the corresponding hole and solder all cathodes together to form the star shape as seen in the photos. Caution: Make sure not to short cathode and anode (longer leg / round side).
...and More Soldering!
Once your star is finished, you'll need to attach a wire to each LED anode (remember: long leg, round side...). For my star y chose green and white wires, mostly because I happened to have them. Also attach one wire in a different color to the cathode (i.e. at any point on the star you built in the previous step); I used a black wire (not very merry, but black is so traditionally used for GND, I couldn't help it).
For convenience, find a way to organize your wires in some order that makes sense to you. Especially:
- Keep the (-) / cathode wire apart
- Identify the (white) center LED
- separate the 5 LEDs that are located on the intersections of the pentagram ("inner" LEDs)
Putting Things Together
After soldering your beautiful star (which I'm sure will look better than mine: You will be very careful to keep it in great shape!), it's time to connect everything. Sorry I don't do FRITZING, so I'll try and explain. An overview is in the first picture, and the next steps are shown correspondingly.
On the Breadboard
- Insert your 5V supply. Make sure supply (+) is in the breadboard (+) position!
- place the 16 channel PWM board on the breadboard in a convenient position
- place 5 220 Ohm resistors conveniently next to each other
From Arduino to Breadboard
- Connect Arduino GND to breadboard (-)
- Connect Arduino SCL to PWM board SCL and SDA to SDA
- Connect one jumper from Arduino pins 3, 4, 5, 6, 7 o one side of each resistor
From PWM Breakout to Breadboard
- 16 jumper wires go from the PWM output on the breakout to 16 consecutive rows on the breadboard
- GND is connected to (-) on the breadboard power strips
- VCC is connected to (+) on the breadboard ower strips
- as we will use just small LEDs, I don't use the V+ connection
"Star" Connections
- The (black!) cathode wire is connected to (-) on the breadboard
- the (white) center LED is connected to PWM pin 15
- the 5 "inner" LEDs are connected to the other end of the resistors
- the remaining 15 LEDs are connected to PWM pins 0 thru 14 accordingly
Other Stuff
- You'll need to power up your breadboard
- ...and connect the Arduino to your PC using a standard USB cable
Programming Time
Time to get creative and put YOUR sparkle to the project.
My example files are based on the Adafruit_PWMServoDriver library which I found is easy to use (and nicely documented).
All of them start by invoking the libraries, defining the required variables (and I may have missed cleaning this up in the later examples!)
In the SETUP section, you'll see the PWM breakout being initialized and a serial port opened (which I used for some debugging... my programming style is mostly copy-paste-try-fail-try-repeat!) as well as defining the 5 pins for the "inner LEDs as OUTPUT.
Finally in the LOOP I'll let LEDs blink randomly, or chase around, or have groups of them going on and off. Try them out, see what they do for yourself: That's what Christmas presents are about, no? Being surprised! Hope you enjoy!
BTW: Some samples are on my instagram (@nicnowak) like this one here:
What's Next: Things You Want to Try
Hope you have enjoyed this INSTRUCTABLE so far. If so, here are a few ideas what you could do to make it more fun:
Use BIGGER LEDs! 5mm, 8mm. Just don't forget they'll likely need more power so you want to attach a separate power supply to V+ on the PWM board and connect the LEDs accordingly.
Use MORE LEDs! As the PWM board is I2C based, you can chain multiple boards (up to 62!) and have many many LEDs. Complex star shapes are possible, maybe even a 3D shape would be an option?
Use DIFFERENT COLORS! Of course red, gold and green are kind of the typical Christmas theme, but blue and white seem like an interesting option.
Create a STAR SHAPED HOUSING! Visible wires are not what everyone considers aesthetically appealing (well: I do...), so a plywood or plastic case to cover the star can add Christmas spirit. Can you 3D print it? Yes you can!!(I can't...)
Use a DIFFUSOR! Bare LEDs have a very small focus area. Using some diffusor material like semi transparent paper or translucid plastic will smoothen the lights.
Create CRAZY LIGHT EFFECTS! Or make it more festive: It's up to you.
Add CONTROLS! At the end of the day, your Arduino can do much more than just 21 LEDs. Include switches to toggle between light patterns. Make it sound sensitive. Make it shine when the sun goes down.
Finally...
As you may have noticed, my components are "compatible" boards. They do fine, are cheap, and readily available on many outlets.
However, if you can afford it, support the creators that bring all these to us:
www.adafruit.com / https://learn.adafruit.com/16-channel-pwm-servo-dr...
Videos of the Finished Project. Ejoy!
Some are filmed with just the bare LEDs while on the others I used plain white paper to diffuse the light.
Which do you like better?