Maker Portal

View Original

Thermal Camera Analysis with Raspberry Pi (AMG8833)

“As an Amazon Associates Program member, clicking on links may result in Maker Portal receiving a small commission that helps support future projects.”

See this content in the original post

See this content in the original post

This tutorial uses the AMG8833 infrared array wired to a Raspberry Pi 4 computer communicating via the I2C bus to approximate temperatures of objects via non-contact radiation measurement. The project is quite simple in the parts list and wiring requirements, as it only requires the RPi and AMG8833 module:

  • AMG8833 Thermal Imager - $60.00 [Our Store]

  • Raspberry Pi 4 Computer - $48.99 (1GB), $49.99 (2GB), $63.41 (4GB), $88.50 (8GB) [Amazon], $55.00 [2GB from Our Store]

  • 4x Female-to-Female Jumper Wires - $0.60 [Our Store]

The Raspberry Pi model technically does not matter, but we used and chose the RPi 4 Model B board for testing. The reason being - the RPi 4 has the fastest processor, which will result in faster output from the real-time visualization (more on this later). The AMG8833 from our shop has also been tested and is used for this tutorial. The assumption is that any properly wired AMG8833 module can be used to follow along in this project, however, the functionality cannot be promised.

See this product in the original post

It is important to note that the AMG8833 wiring diagram below forces the I2C address of the AMG8833 to be 0x69 (this is based on the wiring of the ADO pin being raised to VIN). If the ADO pin on the AMG8833 is pulled to GND, then the I2C address moves to 0x68.

In the next section, the preparation for I2C communication on the Raspberry Pi is given.

See this content in the original post

See this content in the original post

The following set of commands enables the I2C port on the Raspberry Pi and ensures that the AMG8833 is properly wired to the RPi computer. The AMG8833 will communicate with the Raspberry Pi using the I2C protocol. In order to read and write data via I2C, we must first enable the I2C ports on the RPi. The way we do this is either using the command line or by navigating to the Preferences → Raspberry Pi Configuration. Adafruit has a great tutorial outlining this process, but an abridged version will be given below using screenshots of the RPi configuration window.

First, install smbus and I2C tools for the RPi by inputting the following into the Pi’s terminal:

See this content in the original post

Next, enable I2C on the Raspberry Pi:

See this content in the original post

The “i2cdetect” command ensures that the AMG8833 is at the least properly wired to the Raspberry Pi via I2C. The AMG8833 sensor communicates at 400kHz, so we will also need to ensure the Raspberry Pi I2C clock frequency is set at that rate. This can be done by opening the terminal on the RPi and typing the following to access the boot file:

See this content in the original post

Changing the to 400kHz will ensure that the AMG8833 runs at its peak sample rate, which is configurable up to roughly 10 samples per second (10sps, 10Hz). Be sure to reboot the Raspberry Pi after enabling the I2C port and/or changing the baud rate. In the next section, the AMG8833 will be tested using the Adafruit AMG8833 Python library.


See this content in the original post

The Python library is based on the datasheet produced by Panasonic for the GRID-EYE® INFRARED ARRAY SENSOR which provides the entire breadth of information required for communicating with and configuring the AMG8833 sensor through Python. The registers and specifications are housed within that datasheet. The product sheet for the AMG88xx is a more abridged version of the datasheet and is helpful for reviewing the limits, ratings, and performance expectations of the AMG8833. The Python package developed for our analysis also uses a combination of the Adafruit and Seeed Studio packages developed for their AMG8833 boards. The major difference between our project and their projects is the implementation of our infrared camera visualization and analysis routines, which can be found on the GitHub page for this project. The AMG883 library and examples used in this tutorial can be found at the GitHub page for this project:

See this content in the original post

Once the package is downloaded to the Raspberry Pi, the AMG8833 functionality can be verified on the Raspberry Pi using one of the example scripts. The temperatures can be tested by pointing the array at different objects at different temperatures and observing the change in pixel colors (body temperature vs ambient object temperature is a good way of verifying the functionality of the sensor).

The IR camera test code example is given below, followed by the expected output image (be sure to first downloading the amg8833_i2c library before running the codes below):

See this content in the original post

The example outputs the raw 8x8 pixel temperature output from the AMG8833. One thing to note is the orientation of the sensor. If the sensor image is flipped, the following command: origin='lower' can be added to move the origin to the bottom of the image, ensuring the desired orientation of the sensor image.


See this content in the original post

Now that the AMG8833 has been deemed functional using the Python test code above, simple analyses can be conducted on the infrared image output from the thermopile array. First, an interpolation routine can be added to smooth the infrared image. In this simplified case, bicubic interpolation is used to smooth the image. The code for the real-time interpolation routine is given below:

See this content in the original post

The resulting real-time, bicubic-interpolated, infrared camera temperature output should be outputted onto the Raspberry Pi in a figure similar to the video shown below:

The output rate of the visualization above depends on the size of the figure. For the approximate (10,9) inch output with 6x interpolation, the visualization outputted at a rate of roughly 2.6 samples per second (2.6Hz). A modified resolution of (7,6) results in a sample rate of approximately 5.5Hz. At the fairly small resolution of (5,5) and 6x interpolation, the specified maximum sample rate of the AMG8833 (10Hz) was achieved. The interpolation value also affects the sample rate output. Therefore, depending on the application (high speed, higher interpolation, higher accuracy), the figure size, interpolation (image size), and sampling rate setting will all affect the output rate of the visualization.


See this content in the original post

The AMG8833 infrared thermopile array is a 64-pixel (8x8) detector that approximates temperature from radiative bodies. The module is wired to a Raspberry Pi 4 computer and communicates over the I2C bus at 400kHz to send temperature from all 64 pixels at a selectable rate of 1-10 samples per second. The temperature approximation is outputted at a resolution of 0.25°C over a range of 0°C to 80°C. A real-time infrared camera (IR camera) was introduced as a way of monitoring temperature for applications in person counting, heat transfer of electronics, indoor comfort monitoring, industrial non-contact temperature measurement, and other applications where multi-point temperature monitoring may be useful. The approximate error of the sensor over its operable range is 2.5°C, making is particularly useful for applications with larger temperature fluctuations. This tutorial is meant as the first in a series of heat transfer analyses in electronics thermal management using the AMG8833. In the next entry, the emissivity of different material types will be explored, along with validation of temperature measurements using another temperature measurement device (thermistor, thermocouple, or RTD).

See this content in the original post

See More in Sensors and Raspberry Pi

See this content in the original post