Adventures in flight tracking - part 1
Whilst looking through the lovely Raspberry Pi goodies at Pimoroni over Christmas my eye was drawn to the DVB-T dongle which was described as being 'ideal for ADS-B (real-time plane tracking)'. For £12 (currently £10) I thought this would be nice little project to kick off 2018.
Linked from the Pimoroni shop page was Alex Ellis' blog with a very detailed tutorial on setting up flight tracking by picking up ADS-B transmissions. This blog is very comprehensive and also introduced me to the world of docker. The tutorial also sets up the dump1090 application which has a great web interface which lets you view aircraft in real time.
Get eyes in the sky with your Raspberry Pi
If you are new to Docker I would defiantly do the final recommended step in the installation,
sudo usermod -G docker pi
I also found that one of the final steps didn't work (there was also a comment from someone else with the same issue)
docker logs --tail 20 -f 1090
The next stage involved setting up the Pimoroni scrollpHAT-HD. Rather than attaching the pHAT straight to the Pi I soldered just six pins onto the pHAT and used jumper cables to attach it off the Pi.
the scrollpHAT can be installed with:
curl -sS https://get.pimoroni.com/scrollphathd | bash
The pHAT only requires the following connections.
BCM 2 (SDA)
BCM 3 (SCL)
Displaying the currently scanned flights.
I modified code from @th0ma5 http://th0ma5w.github.io which filters out the list of planes in view from data.json and prints changes to standard out. By then selecting only the characters in positions 32-39 per line and then tidying up the output I could isolate the flight numbers.
The code then reads the current list of flights into a list which then is displayed on the scrollpHAT HD. It took a little bit of tweaking to get the names to scroll enough so you could read them.
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