The topper is the most important decoration of a Christmas tree. There are numerous types of toppers, but IoT toppers... Well that's a quite new thing and I built one. Here's how you can build one, too.
At first you will need some cool decoration to work with. I bought a polystyrene star in a paper shop, but if you've got a 3D printer your possibilities are endless.
I painted the star yellow with a marker and dug holes for the LEDs with a needle. You can find where to dig the holes using the "IDs of the LEDs" picture in the Schematics section. Place the LEDs in the holes and start soldering them together based on the "circuit schematics" that I provided. Polystyrene is heat sensitive, so partly pull out the LED when you solder it and be fast. When it is required create bridges with insulating tapes.
My circuit diagram is possibly not optimal, so if you've got any better idea go with it. The wires next to the LEDs are connections to the + and - lines (4-4). At this point you've got to do two things: solder the wires onto the female headers bottom and hot glue them onto the back of the star. I soldered the positive lines to the top part and the negative lines to the bottom part of the headers.
You have to connect 220Ω resistors to either the + or - lines to complete the circuits. You can build them onto the star but I used external resistors. I soldered a couple of male headers and 4 resistors together and I got this:
This project uses Blynk. If you don't know Blynk click here for more info.
Download the Blynk app from the Google Play or Apple's App Store and login. Unfortunately Blynk gives you only 2000 energy (?) for free and a button costs 200 so you either buy some more energy or decrease the functionality of the star. A third option is you modify my project for example by using next/previous buttons instead of selecting the lighting modes directly. If you stay with option one or you've got more than 2000 energy, this is what you need to make to control the star in Blynk:
You will need 3 types of modules here, a Value Display ("Lighting mode", input: V0), a Slider ("Speed", output: V1, Range: 40-1, but you can change the range if you wish) and Buttons. All buttons are set to PUSH, their labels are their Lighting mode IDs (see the second picture on top of this text) and their names are:
- V2 - Simple on
- V3 - Flashing
- V4 - Fading
- V5 - Off
- V6 - Running in
- V7 - Running out
- V8 - Fading in
- V9 - Fading out
- V10 - Inverse fading in
- V11 - Inverse fading out
- V12 - Run around CW (CW = Clockwise)
- V13 - Run around CCW ( CCW = Counterclockwise)
- V14 - Fade around CW 1
- V15 - Fade around CCW 1
- V16 - Fade around CW 2
- V17 - Fade around CCW 2
When you create the Blynk project, you will get an authorization token. You will need that later when you upload the code into the MKR1000.
After that, all you need to do is connect the star to the Arduino MKR1000 like this:
- P4 line -> Arduino D2
- P3 line -> Arduino D3
- P2 line -> Arduino D4
- P1 line -> Arduino D5
- N4 line -> Arduino D6
- N3 line -> Arduino D7
- N2 line -> Arduino D8
- N1 line -> Arduino D9
Upload my code to your MKR1000 (fill the SSID, password and authorization variables with proper values. Auth is the string that I mentioned when you created the project in Blynk) and now all you have to do is put your topper on your Christmas tree and hide the wires.
I'll write some words about the code, too. The star display works like a Matrix display or a 2/3/4 digit 7 segment display, except it is in a star shape. My code handles the LEDs accordingly. The star has 4 groups of LEDs, and there are 4 LEDs in each group. The "plot" array in the code contains the 256 step long program for display update. When you push a button in Blynk, the proper Blynk function executes in the MCU that overwrites the plot array and thus it changes what the MKR1000 displays. This is a simple code, but it is also quite long, so feel free to ask, if something is not clear.
If you are here sometime around December in any year then I wish you a Merry Christmas and Happy New Year! If not then I just simply thank you for being interested in my project!