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
I was recently chatting to a friend who was telling me how he was going to use a unicorn hat to make a nightlight that changed colour for his kids. I have had a long love of all things blinky and especially those which come from Pimorini so it got me thinking about my own similar project using the blinkt.
I looked on thingiverse.com for a suitable size case and came across a lovely little spiderman lamp housing which I thought would be perfect for this project.
I decided that rather than making a simple lamp which came on and off I wanted to do something that would use the WIFI capability of the PiZero W and then used the colour of the Blinkt to display real world information back to me.
Some of my ideas were:
- Weather monitor which changed colour from blue to red depending on the outside temperature
- Weather monitor which changed colour when its was sunny and wet
- A news scraper that changed colour when a braking news items came onto the BBC News site
- A twitter feed that changed colour if I got a mention / RT
In the end I went for the last option. I liked the idea of using the Spider-Man logo to represent the spidey senses of spiderman which would tingle when I got a RT/mention.
The coding of the Blinkt was really easy as the libraries and documentation from Pimoroni are very clear and easy to follow.
I tried the twitter example code and after generating key codes etc for a new Twitter app I could not get it to work. All I would get was 401 errors everytime the code was run. I did a little bit of digging and discovered that this was quite a common occurrence so had to look for a different approach to how I was going to search twitter.
I settled on twython and installed the libraries.
It was fairly simple to generate the relevant key codes and I was able to read the last tweet that I was mentioned in (or a RT)
I then wanted a simple way of changing the colour in response to this.
I decided that I would use the time stamp of the last tweet mentioning me as the trigger for any notifications.
When the script starts up the time stamp of the last tweet is saved to a file. After a certain amount of time the new time stamp is obtained and compared to the time stamp on file. If it is the same - no new tweets have been discovered and the script checks again in another 30 seconds. If the date stamp is different it triggers an event, updates the date stamp in the file and changes the light to green.
I was initially quite pleased with the effect but eventually decided to change the way the colour is displayed. By varying the brightness of the Blinkt I made the light gradually fade over 30 seconds for a red light and 5 minutes for the green light. This would give me an indication of how long ago the tweet had been received and removed any need for human interaction. I didn’t want to add any physical buttons to the device.
Overall I am really pleased with this project. I did find it quite hard to fit the PiZero W and the Blinkt into the case. In the end I had to directly solder the wires onto the GPIO holes on the Pi and poke the other ends into the female connector on the Blinkt.
Case attribution: SPIDERMAN LED Light / Nightlight by jjpowelly
I have removed my sensitive code from the example below, you will need to generate your own Twitter key codes etc.
Philip is a year 7 student from Birmingham, my son and an all-round really great kid!
Quite a few people have asked me which bits I did and which bits were his. Essentially I paid for the components and took him to the marker space to laser cut the case and the rest is his!
Over the six weeks school holidays Philip designed, built and programmed a Raspberry Pi powered Pokedex. A Pokedex is an electronic device for storing your Pokemon information in.
His project has two main functions.
- A directory of over 200 Pokemon photos which you recall by typing in their unique Pokemon number.
- A Pokemon Go style function which takes a photo with the Pi camera and then overlays a Pikachu with a transparent background.
The key components used in the construction:
- Raspberry Pi model A+
- An old car reversing monitor for the main display (composite output from the Pi)
- A Nokia 5110 phone screen for additional information
- A 4x4 membrane keypad
- A Raspberry Pi camera
The final project can be found here https://github.com/Flye001/Pokedex
The main code is multi10.py you will also need the libraries for the Nokia display and the keypad. You will also need to set the video output to composite.
Philip did a fantastic job of speaking about his Pokedex at the Cambridge Raspberry Jam in September 2016. He is such a shy boy so I was very proud to hear him speak.
Here is a video of Philip speaking about this project.
I have written a fun little 24 button touchscreen Advent Calendar.
Once a door has been opened an update is made to config.advent. If you want to close a door once opened simply delete the corresponding line from config.advent.
At the moment the calendar doesn’t check to see if it is the right date so you will have to be self controlled.
You can replace my photos (mostly from National Trust houses) with your own photos in the photos folder (save in the format 1.png etc)
Download the code and photos here https://github.com/uktechreviews/advent
I set out at Easter to build a motion time-lapse camera as I really wanted to take some beautiful photos of the Cornish sunrise when we are on holiday this summer. Little I did realise at the time how much this project would grow and how much I would get out of doing it.
Rather than this being a normal blog of how I built a project I want to share a little bit more about the journey I went on and the skills developed at the same time.
Aim: To build some sort of Pi based motion time-lapse camera rig
Final outcome: Motorised pan and tilt camera rig programmed and controlled by an Arduino Uno triggering photos to be taken on the Pi.
Step 1 was probably the hardest and now seems really simple. I started with a second hand very cheap Arduino board and a single servo motor which I mounted a camera on to. Here was the first challenge. I had never used an Arduino before and didn’t know the language. But within a few days I had the servo moving up and down and an LED flashing on an off. The Python code for the Pi was really easy but every photo came out a little bit blurry!
Step 2: I thought to overcome the shake I would need some sort of housing for the camera so it didn’t get blown by the wind. So I built a simple housing for it using a recycle Easter Egg box.
Step 3: Whilst the project now started to look better most of the images were still shaky. It was at this point I thought it is time to give up and forget the project. So rather than giving up I left it for a couple of weeks. Coming back to the project I decided I needed to rethink how the Pi took the photos. With the first prototype I had no method of synchronising the motor and the camera taking the photo.
I decided to buy an Arduino Uno (clone) and redesign the project so that the Arduino controlled the direction and speed of movement but also had control over the camera.
Step 4: After a bit of redesign and salvaging of other boards and bases the basic structure of the new camera rig was born.
The plan was the Uno would control the motion and trigger a photo taken with the new Pi Zero. You might notice that the camera cable is held on with tape - sadly during the experimenting phase the pi camera connector got broken. It took quite a few attempts to realise that if the Pi was upside down the cable wouldn’t get caught.
Step 5 - I was making progress but I soon hit a snag. I could not figure out an easy way to connect safely the Arduino to the Pi to trigger the photos. After much thought I landed on a 5V DC relay. Using a digital out pin from the Arduino I was able to power the relay. The relay could then act simply as a switch to trigger the photo on the Pi. I was really pleased with this!
Step 6 - With most things now working I was able to think about how you program the Arduino and see what is happening. A quick look on Amazon and I ordered a cheap LCD display which is very easy to program with the Arduino. This would be used for both setting up the sequences and displaying the position during the sequence.
Step 7 - Adding an input method. I decided on using a 4x4 membrane keypad (thanks Ryanteck) as my main input of settings for the camera. This was interesting, fun and challenging to wire up. It was very easy to input single key presses but to take three digits and convert them from a string to an integer gave me a stressful evening.
Step 8. With everything now working I had to design the user menu. In the end I went for completely programmed, default movement and manual control.
Step 9 It was time to replace my broken PiZero with a new one and test things out!
Step 10: Building a case for it. I bought two craft boxes from Hobbycraft which became the shell for the camera. To add extra waterproof and strength the whole case is covered in gaffer tape (much to the amusement of some!) I know it isn’t pretty or built on a 3D printer or laser cut perspex, but it is mine, designed, built and programmed by me!
I genuinely feel proud of this project. I have learnt so much during this and can’t wait for the next one.