Introduction: The Google Trends Powered Christmas Tree
Want to know how trendy Christmas is? Find out with this Google trends powered Christmas tree! Party mode included.
- Raspberry Pi 3b+
- 8x Adafruit NeoPixel
- USB Speaker
- Soldering Equipment
- Pipe Cleaner
- 3D Printer
Step 1: Project Video
Step 2: Lights - 3D Print
The first step is to create a container for each light.
We've 3D designed some gift boxes (see above) and printed them with transparent filament. This filament is perfect because it diffuses the light perfectly and gives off the perfect holiday vibe.
We printed eight of them, but you can create as many as you need.
The STL file is attached to this step.
Step 3: Lights - Hardware
With the containers printed, we can move on to the electronics.
We're using Adafruit Neopixels as lights. These are very bright, support a lot of colors and have great documentation.
They are not quite ready to use out of the box, we still need to solder the necessary wires.
Depending on the amount of lights this can take some time, a perfect moment for some coffee.
It's important to not connect them to each other just yet, we first need to put them in their gift boxes.
Step 4: Hardware - Assembly
Now both our containers and lights are ready for assembly.
We've left some holes in the lid of each box, these we can use the loop through a led (see above).
Once all the boxes and light are completed we can solder them to each other to create a light string
Connect your light string to the Raspberry Pi and you can test out the lights.
Once we checked that everything works, we can glue the boxes and the lids together.
Wrapping some colorful pipe cleaner around the wire between each gift box adds some extra jolliness.
Step 5: Google Trends Connection
To give this tree some extra oempf, we're going to connect it to Google Trends.
The full code is included in the last step "Part Mode", but to give you an overview, we've used Python with some extra packages:
And the logic is as followed:
- Every hour, fetch the popularity of the search term 'Christmas'
- We get back a number between 0 (not popular) and 100 (popular)
- The speed of the lights is calculated based on this number
This results in our tree changing color quickly if the search term is popular, and slowly when it's not popular.
A small note, we used different threads (ledControlThread and trendDataThread) to make sure that each action doesn't hinder the other.
For example, the lights keep going while we fetch the Google Trends data, without threading he would wait for the API call to finished and only then continue.
Step 6: Party Mode!
Because a Christmas tree is a bit of a year long thing, a party mode is a necessity.
This extra feature will need some extra hardware, to be precise, a button and USB speaker.
Once attached to the Pi you can start looking for a fitting song, we chose for "Complicate ya" by Otis McDonald.
We also need to add some logic to our existing script:
- Check if button is pushed
- If so, play the audio filed specified and make the lights change color super fast.
- Once audio is done, return to normal
This logic has its own thread, just like the others and the full script is also attached to this step.
All that's left to do is hang everything in a tree, and enjoy the jolly data visualization, and most importantly the party mode!
Participated in the
Make it Glow Contest