Introduction: 1979 Apollo Pi Thermal Camera
This vintage Apollo microwave detector now has a shiny new purpose as a thermal camera, powered by a Raspberry Pi Zero with an Adafruit thermal camera sensor taking the temperatures, displaying the results in real-time on a bright 1.3" TFT display.
It has a Preset and a Dynamic mode - in the first the colours shown on screen are based on hard-coded temperature thresholds, and in the second the colour range can be adjusted using temperature sliders on an Adafruit.io dashboard.The dashboard also instantly displays any snapshots uploaded by the device, which are captured using the original thumb button on the grip.
The whole system is powered by a thin, cylindrical USB battery pack concealed in the hand grip, which can be easily recharged by popping off the nose cone and plugging in a USB lead.
Working on this project has really helped keep me positive during lockdown, and with the extra time on our hands the kids & I have found many interesting things around the house to point it at!
Have a look at the Apollo Pi in action in the YouTube video, in case you can't see the embedded version above it's at https://youtu.be/1xjRJExzPR8
Apollo Microwave Monitor
Raspberry Pi Zero W
Adafruit AMG8833 Thermal Camera Breakout
Adafruit Mini PiTFT 1.3" Screen
3v Vibrating Disc
USB power bank
Step 1: Teardown
I picked up the Apollo Monitor at a secondhand sale last summer, for its unique look rather than anything else - which is just as well as it had definitely seen better days! The circuits inside were incomplete and the whole thing was covered in a mess of glue, a historical attempt to repair it.
It would originally have been used to check for the presence of Microwave radiation, presumably in some kind of industrial setting given its design and the rarity of microwave ovens at the time, though I couldn't find out much more about it. One thing I did know, it would make the ideal home for a thermal camera.
As soon as I popped off the conical "nose" the rest of it literally fell apart, and the glued-in analogue meter and rectangular button were easily removed. I kept the button though, it was perfectly functional and a really odd shape, so I'd have struggled to fit a replacement in the same hole.
Step 2: Wiring
Before trimming the case to make everything fit I first wanted to make sure I knew how the parts would go together, so I set to cabling up the sensor and screen. The sensor itself was fine, just four jumper cables needed to connect it up to the Raspberry Pi.
The screen was a bit more complicated, the pinout diagram showed that I'd need to connect up 13 jumper wires - obviously it's designed to sit directly on top of a Pi so I only had myself to blame really. I decided to add in a piece of female header between the screen and the Pi connections, so that I'd be able to take the screen off and connect it up easily. This was a great idea, and I followed the pinout diagram very carefully to wire up the header to the Pi.
Next I soldered some fresh jumper cables to the original button, so it could be connected to the GPIO and used to capture thermal image snapshots. Lastly I soldered a small vibrating disc directly to the GPIO pins, to provide some haptic feedback to the button presses.
Step 3: Case Mods
One of the things that resurrected the Apollo Monitor from my "to do" box was the display hole in the top - this was roughly the size I needed for the small Adafruit screen. Roughly. It took an hour or so with a file to extend the hole to just the right size, but I thankfully managed to not destroy the case in the process.
I also chopped away parts of the insides that originally held a PP3 battery, and cut out some bulkheads inside the grip to make room for the battery pack, using a rotary tool.
Finally I drilled some large holes so that the cables for the sensor and charging cable could make their way from the "nose" to join up with the rest of the circuits.
Step 4: Power
For this project I decided against using a LiPo battery and adaptor/charger, as there was more room in the case. I decided instead to use a standard USB power bank. I wanted to get a thin cylindrical one, to fit inside the handle, so searched for the cheapest and thinnest one I could find on Amazon. The one that arrived, with its cheesy LED torch and faux-battery styling was the thinnest I could find, but on unboxing it I realised it was still too thick to fit in the handle. Then I realised that it came apart - the top unscrewed and the naked battery inside slid out, neatly saving me the 3mm I needed to fit it inside the handle, what a result!
Next I took a short Micro USB cable, stripped off some of the insulation, snipped the positive cable and soldered in a lovely square latching button, so that the power could be controlled without having to unplug the battery pack. This button fitted nicely into what was originally the battery cover, and was a pretty close match for the original one on the top of the case. Now that I knew everything would fit it was time to get it all working!
Step 5: Thermal Camera Software Setup
The thermal sensor itself is an Adafruit AMG8833IR Thermal Camera Breakout , which uses an 8x8 array of sensors to create the heat image. It works with Arduino and Raspberry Pi, but the biggest advantage of using a Pi is that the software can use the scipy python module to perform bicubic interpolation on the captured data, making it look like a 32x32 image, neat!
Setting up the sensor is fairly straightforward, but there are some hoops to jump through, this is what worked for me:
Enable I2C and SPI on the Raspberry Pi (Raspberry Pi Configuration > Interfaces)
Install the Blinka CircuitPython library:
pip3 install adafruit-blinka
Next install the AMG8XX sensor library:
sudo pip3 install adafruit-circuitpython-amg88xx#
Turn off the Pi, and connect up the sensor - only 4 wires thankfully!
Next install the scipy, pygame and colour modules:
sudo apt-get install -y python-scipy python-pygame<br>sudo pip3 install colour
At this point my code threw a scipy error, so I reinstalled it with:
Sudo Pip3 install scipy
Then I received the error: ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory
This was resolved by installing:
sudo apt-get install python-dev libatlas-base-dev
From then on the example code worked fine, running the script from the console rather than from Thonny:
sudo python3 /home/pi/FeverChill/cam.py
This made the sensor display show up on screen in a pygame window, and after some tweaks to the colour/temperature thresholds I was hypnotised by a heat image of my face.
Step 6: LCD Screen Software Setup
It was really good to get the sensor working, but now I needed to have it display on the little screen. The screen I used is an Adafruit Mini PiTFT 1.3" 240x240 - mainly because its resolution and shape were just right for the thermal camera, also it was the right size to fit in the case and offered the two GPIO-connected buttons I needed.
The Adafruit instructions offered two options here: an Easy and a Hard way - after experimenting I realised I needed to use the Hard way, because the sensor required direct access to the framebuffer. Following the step by step instructions I was fine until I hit the question "Would you like the console to appear" - I initially selected No, but should have said Yes. This was a bit of a pain as it meant I had to re-do the process, but it did make me aware that once the Pi is set to display the console on the TFT it will no longer show the desktop via HDMI (at least that was my experience).
Still, once the setup was complete, on rebooting the tiny screen displayed a miniature version of the usual Pi startup process, and when I ran the example thermal camera script the pygame window displayed the heat image on the little screen - very satisfying!
Step 7: Code Tweaks
The sample code worked fine, but I wanted it to do a little bit more, so set about tweaking the scripts to my taste. I started by creating a Menu script that would load on startup and make good use of the two buttons integrated into the display board.
Firstly I found some Python online that would display a nice animated menu effect on the small screen, using PyGame. The beauty of this script is that it animates all images in a set folder, so it would be easy to change the animation at a later stage (for example to match the animation colours to the case). I set the menu script so that pressing either one of the buttons would stop the animation and open either fever.py or chill.py, the scripts to show the sensor display. With this working I set the script to run on startup - ordinarily I do this by editing /etc/xdg/lxsession/LXDE-pi/autostart, but as this method relies on the Desktop loading I needed a different option this time around.
So first I edited the rc.local file...
sudo nano /etc/rc.local
... then added in the following just above the Exit line...
sudo /home/pi/FeverChill/menu.py &
...having first ensured that the menu.py script had the following at the very top...
...and also after setting menu.py as an executable script by typing:
chmod +x /home/pi/FeverChill/menu.py
into the terminal.
For the Preset script I first set the colour / temperature thresholds, setting the lower one (blue) to 16 and the upper one (red) to 37.8. This would theoretically still show up a person's face in green, but glow up red if the temperature was at or above 37.8 degrees. There's a lot of research online about sampling body temperature via different methods, but with the variance of the sensor being +/- 2.5 degrees I decided to just stick with the most widely accepted "fever" range - this is easy enough to change via ssh at a later date.
Next I set the two screen buttons to close the current script and open up menu.py. I also wanted to find a way to capture and export the camera image, and having found the right PyGame command
I set this to run when the "thumb" button was pressed - the one you'd have originally used to take a microwave reading. That took care of capturing the image, next I added in some lines of Python so that the image would be immediately uploaded to an Adafruit IO dashboard once captured, so it could be viewed on other devices and easily downloaded. With a quick "save as" that was the Preset script completed.
There's more to a thermal camera than looking for specific temperatures, and I wanted the Dynamic script to be flexible, so that the upper and lower colour thresholds could be easily adjusted. I didn't want to add extra buttons to the device and complicate the navigation, so opted to use sliders on an Adafruit.io dashboard.
I already had the bulk of the Adafruit code in the Preset script, so just had to add in some extra lines, so that the current slider values from the dashboard would be retrieved on launch and set as the display defaults.
The code I used is all available on GitHub, to re-use it you just need to download the FeverChill folder to the /pi/ folder on your Pi and enter your Adafruit.io credentials & feed names in the scripts, once your display & sensor are set up.
With the scripts working nicely it was time to move to something messier!
Step 8: Finishing Touch-Ups
Originally this project was meant to be a quick distraction from using the thermal sensor for something else, but with current events I found myself increasingly drawn into it, and the tiny extra details that would stretch it out and make it more of a challenge.
The Apollo Monitor case was pretty nice to work with, easy to cut and sand, but to finish it off nicely I wanted to tuck some of the visible circuit boards behind painted "masks". These took ages, carving them out of pieces of waste plastic by hand, but it was satisfying work. First I made a small one that would cover up the screen board but leave the microswitches visible. Next I made one for the thermal sensor, so that you wouldn't see bare electronics if you looked down the "business end".
I decided on the colour scheme a couple of days before the UK went into lockdown, and was fortunate to find the colours I wanted in the nearby hardware store. As the case split so nicely into halves a two-tone colour scheme was suggested, and I then extended this to the "nose cone" and sensor cover. The painting was great fun, the first warm day of the year, though that did mean painting while the wasps in the shed were stirring and milling about. I've not used masking tape with spray paint before but I'm really pleased with how the resulting two-tone pieces came out.
Learning the lessons of previous builds I left the painted parts to harden for a good week before attempting assembly, and started putting the video together in the meantime.
Step 9: Assembly
Whenever I'm working on a project I love getting to the stage where everything is laid out ready for assembly like a self-made model kit. There are no guarantees it will all fit together and the instructions only exist in my head, but it's my favourite part of any build.
This time around it went very smoothly - mostly because I had extra time to spend on the small details and make sure everything was just-so. I hot-glued the screen into the case first of all, then added the "capture" button - these were the only parts connected to the top of the case so that was a nice easy start.
Next I lightly hot-glued the battery pack into the grip, and fitted the Pi with its bracket into the case. After that the camera sensor was carefully glued into the nose cone, the power switch was screwed to the battery cover and everything was connected up.
I used jumper cables for all of the connections but just to be extra-careful I hot-glued these in place, in case of any movement during the final squish-together of the two halves. It was just that in fact, a bit of a squish, but no cracking sounds, so once the two halves were snugly together I push-fitted the nose cone and secured the bolt through the handle - the only two things holding the whole assembly together.
It didn't work first time, I managed to disconnect the screen during the first squishathon, but with a few strategic cable bends it all ended happily second time around. Time to point it at things!
Step 10: Temperature Testing Times
Having extra time at home really helped me focus (obsess?) more than usual on the small details of this project, and that definitely made for a cleaner finish and fewer surprises at assembly time - as well as helping keep my mental well-being on the straight and narrow. The original plan for the sensor was something completely different, so I'm very pleased with the end result, a slow-paced and satisfying build.
The Apollo Pi looks great on the project shelf too and is definitely a fun & useful tool to have around, we can't stop pointing it at stuff! In an ideal world it'd be slightly higher resolution, and I need to find some way of "flipping" the display as it's mirrored at the moment, but these are small niggles.
Thanks for reading and stay safe everyone.
My other Old Tech, New Spec projects are all on Instructables at https://www.instructables.com/member/MisterM/instructables/