PiEyeR Enhanced Thermal Camera




Introduction: PiEyeR Enhanced Thermal Camera


The Adafruit AMG8833 IR Thermal Camera board can provide a “FLIR™”-like Far Infrared imaging camera at about 1/10th the price of previous Far IR Thermal imaging units. Of course, the resolution and sensitivity are not as high as more advanced cameras, but hey, for $39 it’s a great deal.

With this project, I took the excellent Adafruit tutorial Raspberry Pi Thermal Camera by Dean Miller and added extra functionality to the software and hardware.

New Features:

  • Safely shutdown/power up Raspberry
  • Automatically runs software at powerup
  • Battery Powered for portability
  • Uses PiTFT GPIO buttons
  • Sensitivity controls
  • Potential for future additions
Note that IR Thermal Cameras are NOT the same as NOIR cameras. The former uses only the heat given off by the object being imaged, while the latter requires an infrared light source such as IR LEDs (or the Sun) to illuminate the object.

Step 1: Hardware & Software

Preliminary Setup

NOTE: If you already have set up a Raspberry Pi with an Adafruit PiTFT Plus 320x240 screen and AMG8833 Thermal Camera module as shown in the Adafruit Tutorial (https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install) then you can skip to the RaspiThermalCam Software in section II. below. Otherwise, continue to the next step...

Step 2: Hardware Setup - Install PiTFT Display

Because the PiTFT Resistive Touch screen requires modifications to the Raspbian kernel, it is STRONGLY suggested to start fresh with the pre-built Raspbian Jessie image from Adafruit. This already contains all the necessary drivers for the PiTFT screen.

Note that this is going to be a “headless” installation, thus will not be using the Raspbian GUI. You will be using the linux command-line to configure and program the Raspberry. The easiest way to access is to set up SSH and WiFi or Ethernet connectivity and use a remote terminal program like Putty.

The below instructions are taken from Adafruit PiTFT tutorial at the URL below. If you have difficulties or want to see the full instructions please visit the Adafruit tutorial FAQ.

PiTFT Installation Steps

1) Download the piTFT Raspian Jessie Lite from Adafruit to a PC:


2) Install this image on a 4GB or larger SD card. If you need help here, check out instructions at


3) Insert the micro SD card into the Pi. But do not turn on yet.

4) Before installing the piTFT onto the Pi, plug the 40 pin GPIO Cable into the back of the piTFT.

BE SURE to position the GRAY line mark on the cable on PIN 1 of the piTFT male connector. Note that there are two connectors on the PiTFT module; a female connector that plugs into the Raspberry Pi, and a male connector that this cable connects to.

This will be used to connect the Thermal Camera module later.

(Actually, you only need 4 wires to connect the camera, but due to dimensions, it’s easiest to just use this ready-made cable as is.)

5) Now plug in the PiTFT onto the Raspberry Pi itself. Again, look at the photos to see which way it should go. (gray to pin 1)

6) Verify that the GRAY line mark on the GPIO cable is positioned as shown.

Now you are ready to test the PiTFT and Raspberry Pi. (The IR Thermal Sensor will be installed later).

7) Connect a USB keyboard into one of the Raspi ports. (No mouse is needed). This will make it easier to initially log in and find the IP address that is assigned. Otherwise, you’ll need to check your router for the IP assignment.

8) For network connectivity, the easiest is just plug in an Ethernet cable, though you can set up WiFi manually via wpa_supplicant.conf if you prefer.

Note that once the IR camera is completed, you won’t need networking, so wifi isn’t needed.

9) Connect 5V power and let your pi boot. If all goes well, after a few seconds, the PiTFT screen should show boot messages and then a login prompt.

If you do not see any display, verify your connection (bent pins?), power supply and SD card are all good. Also see the Adafruit FAQ

10) Login & passwd are the default “pi” “raspberry”.

11) Locate the IP address using $ ifconfig –a

Now you can remotely log in using SSH Putty using pi@YOUR_IP_ADDRESS

You can unplug the keyboard once you successfully ssh in.

(Remote access is only needed just to make it easier to complete the setup, not for normal use.)

12) Update your package manager: $ sudo apt-get update

IMPORTANT NOTE! Do NOT run “apt-get upgrade” or “rpi-update”!

This would overwrite the custom Adafruit kernel needed to run the PiTFT. If you do, probably easiest is to just start over. Or consult the Adafruit FAQ above.

This Pi will not be accessible from the Internet, so security patches aren’t as critical.

(If paranoid, just turn off WiFi and only use Ethernet cable.)

Step 3: AMG8833 Image Sensor Setup

The following is excerpted instructions from Adafruit’s Thermal Camera tutorial. Feel free to examine it for more details:

1) Run the following to install the Raspberry Library and Adafruit GPIO

sudo apt-get install -y build-essential python-pip python-dev python-smbus git
git clone https://github.com/adafruit/Adafruit_Python_GPIO.git cd Adafruit_Python_GPIO sudo python setup.py install sudo apt-get install -y python-scipy python-pygame sudo pip install colour Adafruit_AMG88xx

This installs all the packages and libraries needed to drive the IR Image Sensor.

2) Enable the I2C Interface for the IP camera: $ sudo raspi-config

Navigate to 9 Advanced Options and select A7 I2C then select Finish

3) Shutdown Raspi and unplug the power cable (and Ethernet cable, if connected):

$ sudo shutdown -h now

Step 4: Wiring the IR Module

You will be connecting only 4 pins of the AMG8833 IP to the 2x20 IDC Box Header and plugging this into the 40 wire GPIO cable.

For the most reliable wiring connectivity, I suggest soldering 4 short wires to the pins on the IR module and to the 2x20 Header. Use a needle point soldering iron and magnifier for best results. Use heat shrink tubing to protect the connections.

Be sure to note the direction positioning of the Header. There is a cutout key and a tiny arrow marking pin 1. (This is inverted from GPIO diagrams due to the cable/header arrangement)

Also note the direction that the IR camera should be pointing away from the bottom of Raspi.

4) Plug in the Box Header onto the GPIO cable, noting that pin 1 of the header should match the gray marked wire on the cable.

Smoke Test Time (Please no smoking here!)

5) Plug in the 5V power and Ethernet cable again.

6) Log into the Raspberry via SSH (or using the PiTFT screen and keyboard)

7) Run $ sudo i2cdetect -y 1

You should see the “69” entry. If not, did you enable the I2C interface via raspi-config? Also verify wiring!

8) Run the Example code:

cd ~/
git clone https://github.com/adafruit/Adafruit_AMG88xx_python.git cd Adafruit_AMG88xx_python/examples sudo python thermal_cam.py

If all is well, you should see a heat map image when you wave your hand or stand in front of the camera!

Once completed, the camera should be facing forward, like a digital camera:

The LCD screen towards you and camera towards (hot) object.

Step 5: Part II - RaspiThermalCam Software

(If you had previously used the Adafruit tutorial to set up your Thermal Cam, just jump to here to add the enhancements)

Now that you have a working Raspberry Pi Thermal Camera, the
next step is to add extra software functionality and package everything into a more portable unit.

1) Install GIT, if needed:

$ sudo apt-install git

2) Download the RaspiThermalCam software

$ cd ~/

$ git clone https://github.com/rgrokett/RaspiThermalCam.git

3) Run the Installation script

$ cd RaspiThermalCam

$ ./install.sh

$ sudo reboot

Once rebooted, you should see the new PiEyeR screen.

See Troubleshooting if needed.

The 4 buttons on the TFT screen have been re-mapped to GPIO functions as shown:

Button GPIO Desc
1 17 Safely Shutdown/Start up Raspberry (Does not remove 5V power, must be done usually via the 5V USB battery on/off switch) 2 22 Increase Sensitivity (while in Camera Mode) 3 23 Decrease Sensitivity (while in Camera Mode) 4 27 Start/Stop Camera Mode

(If needed, you can remap the buttons to your TFT screen’s GPIO pins by editing the "raspitherm.py" program.)

Step 6: ​3D Printed Case

The RaspiThermalCam/stl/ subdirectory contains STL files for 3D printing a simple front-end case for the thermal sensor. It’s currently not very fancy and expects the Raspberry Pi 3 and PiTFT screen to use the Adafruit faceplate and case.

1. Print out the three pieces; body, front plate, back bracket.

2. Clip out the support tips along one edge of the wide end of the Body. This is where the ribbon cable will go thru.

3. Slip the Body over the AMG8833 camera module and cables, wide end towards the Raspberry Pi case.

4. Pull the camera module up through the front (narrower) end of the Body.

5. Place the camera through the hole in the front plate. Note that the ridge on the front plate faces OUTWARDS, thus helps protect the imager.

6. Place the bracket behind the camera module circuit board. The camera should be just lightly held in place by the bracket

7. Use two small screws/nuts to attach the bracket to the front plate with the camera sandwiched between.

8. Currently, I just glued the front plate to the Body. The camera can still be removed from the case by removing the screws and back bracket.

9. I also just attached the wide end of the Body to the Raspberry Pi case using hot melt glue, which can be cut or melted to open it back up.

NOTE that you cannot cover the front lens of the AMG8833 as most glass or clear plastics will absorb the far-infrared, thus be opaque to the camera.

Since my next version of the PiEyeR is to try to replace the Raspberry Pi 3 with a Zero W, all of the case designs will change.

Feel free to design a better case and let me know!!

Step 7: Future Features

  • 3D Printed front case parts for the camera
  • Switch to using Raspberry Pi Zero W for lower cost & power/smaller size
  • Add new mode button features for middle buttons
  • Get pygame Touch Screen working for PiTFT
  • Add Camera Screen Snapshot feature

The Faceplate, buttons, and Raspi Case can be used to enclose the Raspberry and TFT screen.

3D Printed Case (future)
This document and GitHub will be updated with the .stl parts and instructions for a simple case for the Imager, once completed. It’s not fancy and you may need to modify it, if your components are larger than what I used.

Step 8: Uh Oh, Trouble!

**I don't see any new screen, only the boot messages and login.**

Did you run the ./install.sh script? Try running $ crontab -l and see if you see a @reboot line:

@reboot sudo python /home/pi/RaspiThermalCam/raspitherm.py >/dev/null 2>&1

You did set up your Pi Thermal Camera as detailed in the Adafruit tutorial? (https://learn.adafruit.com/adafruit-amg8833-8x8-thermal-camera-sensor/raspberry-pi-thermal-camera)

**I get a python error message**

Most likely there is a missing python package. The last line of the Python error should say what is missing. Try Googling that message. Else, leave an Issue at Github.

**My screen is mangled up, but the buttons seem to work**

Are you using the PiTFT Plus 2.8" 320x240 screen?

**My buttons don't work or are on the bottom not side of the PiTFT**

You have a different screen. If you have GPIO buttons on botton of TFT, you can try remapping them in the raspitherm.py program.

**The Touchscreen doesn't work**

Bugs in the SDL software used by pygame software make for inconsistent operation of the touch screen. We have to wait for a better solution. This program doesn't use the touch, just buttons.

**My Camera screen is all BLUE or all RED**

Press the Sensitivity buttons (middle two) to increase/decrease sensitivity

**My Camera doesn't work**

Try manually running tools/thermal_cam.py program.

This is the same program from Adafruit with no modifications. You may need to kill the raspitherm.py program first by editing the crontab:
$ crontab -e
comment out the @reboot line #@reboot ...

**What can I see with it?**

Find a cat.
They glow hot!

So do water heaters!

Raspberry Pi Contest 2017

Runner Up in the
Raspberry Pi Contest 2017

2 People Made This Project!


  • For the Home Contest

    For the Home Contest
  • Big and Small Contest

    Big and Small Contest
  • Make It Bridge

    Make It Bridge



3 years ago

i have a question , when i start the cam software , i see the thermal , but after one second
it freeze , i have to press second button or third button , it wake up for another 1 sec and
freeze , like a hold function , any thought on this


Reply 3 years ago

I found a tab char in the raspitherm.py at line 221 that might be the problem you were seeing. I have updated the code, so you can either git the code again and reinstall or you can edit raspitherm.py and make sure that there are 8 spaces at line 221, and not a tab and 4 spaces.

# GPIO Button Press
........if GPIO.input(BTN4) == GPIO.LOW:
logger.info("stopping camera()")

If you still have problems, turn on DEBUG and run and then check the debug.log file to trace to see if there is an error message.

Reply 3 years ago

.hello , i update your raspitherm.py and i activate the debug file , don't see any error in the log file and it still freeze


4 years ago

Made one with RPi Zero W, a few DuPont connectors, hot glue and cardboard. External power source.

I had to convert tabs to spaces in the python source to make it run python3.

Couple of issues I have not looked into yet:

- I am getting some annoying image artifacts that look like lines "between the pixels"
- Calling touch() was crashing the app, so I had to disable it
- The installation script did now work for me, somehow it killed my pitft software and I had to reinstall it. After that it was not starting up automatically, so I just added it to my .bashrc



Question 4 years ago

hello! this was great, thankyou for the tutorial. i was wondering if you know best way to have it set up to display on a large monitor (hdmi) rather than the pitft screen? thanks!


Answer 4 years ago

Understand this sensor resolution is only 8x8 that is interpolated to 32x32 pixel format here, a far cry from 1920x1200 pixels of a HDMI TV. (But from a distance, you will still see a heat image, just not very high res!)

For an HDMI monitor, you probably should use the original Adafruit software only, as it doesn't use the touch screen menus that this version for the PiTFT has.



5 years ago

Great project you have here. On a side note, we could pass for brothers.


5 years ago

Nice work ! Is is powerfull enough to detect thermal leaks in a house ?

If so could you try and publish some pictures please (both by filming from inside and outside) ? Thanks.

It could be interesting to compare it to this project :


(much more expensive but using FLIR components..)


Reply 5 years ago

I've used it for examining electrical plugs & wall warts, water heaters, candles, smoldering embers, car engines and lamps, but I would not consider it reliable enough for things like doors and windows. Not enough temperature variation typically. I would say this is more useful for science experiments and other hacks.

For home use, I just use the $29 black & decker tld100 thermal leak detector http://a.co/iS3sQMC

The FLIR, besides being expensive, is probably overkill unless you are doing professional work, though the FLIR One Gen III at $199 looks like a good deal.


5 years ago

You said it costs $39 but when I went to the site you linked it shows 3 devices with total cost of under $80. Do I need all 3 of them?


Reply 5 years ago

The AMG8833 device is $39. But yes, if you don't already have a Raspberry Pi available and PiTFT screen, then those would be needed.

Note that this is not a simple project, so not recommended for anyone just starting out with Raspberries or comfortable with Linux command line. The python code is also designed to be hacked so anyone can add their own features.

Also remember, the AMG8833 thermal imager is limited in both range (~25ft) and resolution (8x8 upscaled to 254x254) in comparison to $400+ FLIR cameras. But for hobbyist and hackers, the AMG8833 is a great deal.


5 years ago

This Instructable is definitely a "keeper". I was thinking about one of those FLIR cameras that work with your phone, only to find out from others that you MUST have an internet/data connection for the thing to work. Not much good for being out in the wilderness if you can't get a signal!

Just wondering, on a parallel subject here, since I know absolute zero about the Raspberry Pi and Adafruit stuff, but here goes.......

Have you or anyone reading ever thought about re-inventing FLIR's add-on camera, but make it useful to anyone with a tablet or smart phone that has a USB port, and works without the internet? I'll be in my Sarcophagus way before I could possibly figure that one out, but if anyone comes up with a viable one that doesn't send me to the poorhouse it would be great.


Reply 5 years ago

The problem is that the Far Infrared sensors are very expensive. This project's AMG8833 from Panasonic is billed as "advanced motion detector", not really as a FLIR replacement. A normal motion detector is basically one bit (on/off). This one is 64 bit (actually 8x8 matrix) which, with math that Adafruit added, generates a usable image, if no where near a FLIR. (but costs ~$40 instead of >$400). Also, its range is limited to about 25 feet or so.

Worse, Far IR lenses are rather exotic since glass & most plastics are opaque to that wavelength. Individual parts (sensor, lens, electronics, etc.) end up being back into the hundreds of dollars.

So far, the best use I have seen with this is looking for heat/cold leaks around the house. Like how much heat is lost with our old water heater and looking for faulty wiring or "wall warts".


5 years ago

Do you have any thoughts if the PiEyeR could be ported to run on the Pi Zero (W)?

Or is its 1-core BCM2835 too underpowered compared to the Pi 3 (BCM2837)?

Also, while the clock speeds are nearly the same, the Pi Zero only has 512MB compared to 1GB...

do you have any numbers on how much cpu/ram is used when running PiEyeR?


Reply 5 years ago

I was planning to try switching out the Pi 3 for a Pi Zero W right after I finish building the Pi 3 version. Besides being smaller and cheaper, battery drain should also be less. How compatible it is with driving the piTFT display is the main question. I hope to start on it by next week.


5 years ago

This maybe just the thing to locate wildlife in my yard.....thank you!