The Google Trends Powered Christmas Tree

About the project

Want to know how trendy Christmas is? Find out with this Google trends powered Christmas tree! Party mode included.

Items used in this project

Hardware components

Mini External USB Stereo Speaker Mini External USB Stereo Speaker x 1
Raspberry Pi 3 Model B Raspberry Pi 3 Model B x 1
Adafruit Flora RGB Neopixel LEDs- Pack of 4 Adafruit Flora RGB Neopixel LEDs- Pack of 4 x 2
SparkFun Big Red Dome Button SparkFun Big Red Dome Button x 1
Pipe Cleaner Pipe Cleaner x 1

Software apps and online services

Google Trends Google Trends
Raspberry Pi Raspbian Raspberry Pi Raspbian

Hand tools and fabrication machines

3D Printer (generic) 3D Printer (generic) x 1

Story

Project Video

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 at the end.

Box with light

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.

Soldered WiresHardware - 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.

Working

To give this tree some extra oempf, we're going to connect it to Google Trends.

Google Trends Data

The full code is included in the section "Code", 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.

Party Mode!

Finished Project

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!

CAD, enclosures and custom parts

GiftBox

Go to download

GiftLid

Go to download

Code

Code

Credits

Photo of 8BitsAndAByte

8BitsAndAByte

We’re Dane & Nicole, two makers that create tremendously terrible tech, which we happily share with you on our channel! https://www.youtube.com/c/8bitsandabyte

   

Leave your feedback...