Twitter Snow Globe
I was keen for this project to look like a shop-bought Christmas decoration. I also wanted to build something that would have twitter connectivity and respond to tweets or comments mentioning me.
In the end I decided to build a twitter enabled, Raspberry Pi powered snow globe.
If you would like to build your own I have included the parts and steps needed below.
- Empty Snow Globe with gold LED spring (Amazon)
- Raspberry Pi Zero (W)
- Unicorn pHAT from Pimoroni
- Automation pHAT from Pimoroni
- Pico HAT hacker from Pimoroni
- Breakaway header pins
I 3D printed a house to go inside the Snow Globe. I used Christmas House by Mathi_ on Thingiverse and scaled it to fit inside the dome of the snow globe.
The snow globe was preassembled so I had to carefully take off the dome and using a pair of pliers remove the batter component from the base to put the Pi inside.
Step 1: Get your pHATs ready
- Solder male GPIO header onto the Raspberry Pi Zero
- Place the Pico HAT hacker onto the male header and solder the following GPIO pins (GPIO18, 5V power and Ground). Take care that the solder doesn't wick up the pin as it will stop the Automation HAT from sitting on top.
- Solder male header pins onto the following pins on the header extender (this will be used to connect to the Unicorn pHAT - GPIO18, 5V and Ground
- Solder male header pins onto pins (GPIO18, 5V and Ground) on the Unicorn pHAT. There is no need to solder a full header on all the pins as we are only using 3!
- Solder a female header onto the automation pHAT and the connecting pins.
- Place the automation hat onto of the PiZero header
- Use 3 female to female jumper cables to connect the following pins from the header extender to the unicorn pHAT
Step 2: Connecting the LED string to the automation pHAT
- In the snow dome was a length of golden LED string. This is essentially two pieces of insulated wire with mini LEDs soldered along it and then covered in hot glue. I decided to split the length in half and cut randomly in the middle. Before you can connect the LEDs up you will need to remove the insulation. I simply held the ends in a lighter flame for a second or two to burn it off (take care!!!). You will need to also join the end of the shortened string to make the complete circuit.
- Connect the positive wires from both strings to 3.3V on the automation pHAT. The two remaining ground wires can then be attached to output 1 and 2
Step 3: Download the following 5 files from GitHub here
- twitter-monitor.py (Python2 - reads and monitors twitter and records key words in log.txt)
- christmas.py (Python3 - reads log.txt and then controls the unicorn pHAT and automation pHAT)
- log.txt (caches the keywords monitored from Twitter)
- status (stores the last time a mention occurred)
- launcher.ssh (launcher file - don't forget to chmod +x)
Step 4: Set up your twitter developer account.
- The Twitter monitor uses Twython - there is an excellent guide here on the Raspberry Pi website to follow
- Add the relevant details to twitter-monitor.py
The default effect is snow with warm firelight. If the following keywords are tagged in the tweet you will see:
snow: White base with snow effects
party: disco lights with snow effects
Christmas: gold base with snow effects