Thermal Camera HAT

From Waveshare Wiki
Jump to: navigation, search
Thermal Camera HAT
Thermal Camera HAT.jpg

Far-infrared thermal sensor array
USB interface
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

Thermal Camera HAT and Thermal USB Camera are long-wave IR thermal imaging camera modules with the 40PIN GPIO header and a USB interface respectively, with 80(H)×62(V) temperature measuring pixels. They support Raspberry Pi, PC, Android phones and other devices. They adopt the hybrid technology of microbolometer and thermopile pixels and can detect the IR radiation energy distribution of objects in view of the camera, turn the data into the surface temperature of the objects by calculation, and then generate thermal images, for easy integration into miscellaneous industrial or intelligent control applications.

Features

  • Adopts the hybrid technology of microbolometer and thermopile, 80(H)×62(V) array pixels.
  • Continuous operation and thermal imaging video stream due to shutterless design.
  • Noise Equivalent Temperature Difference (NETD) 150mK RMS@1Hz refresh rate, with good noise performance.
  • Up to 25FPS (Max) frame rate thermal imaging video stream output.
  • Comes with online resources and manuals. (Python demo for Raspberry Pi, Android/Windows host device and user manual, etc.)

Specifications

  • Power Supply: 5V
  • Operating Current: 61mA@5V
  • Wavelength Range: 8~14μm
  • Operation Temperature: -20~85℃
  • Target Temperature: -20~400℃
  • Refresh Rate: 25 FPS (Max)
  • FOV: 45°(H) × 45°(V) [Horizontal Angle x Vertical Angle]
  • Measure Accuracy: ±2℃
  • Dimensions:
    • Thermal Camera HAT: 65.0mm × 30.5mm
    • Thermal USB Camera: 62.0mm × 13.0mm
  • Noise Equivalent Temperature Difference: 150mK

Hardware Description

  • Thermal Camera HAT connects to Raspberry Pi series 40 GPIO Pin.
    • Thermal Camera HAT uses I2C to configure camera registers and SPI to send temperature data.
    • Thermal Camera HAT has a RESET button on the board, which can be pressed for hardware reset in case of an exception.
  • Thermal USB Camera connects to a Windows PC or Android phone and uses the USB interface to send temperature data.
    • Thermal USB Camera board has a RESET button that can be pressed for hardware reset in the event of an exception.

Hardware Connection

  • Thermal Camera HAT Connects to Raspberry Pi:
    • When you need to stack additional HAT modules on the Raspberry Pi 4B, you can use a 40-pin GPIO header to connect the Raspberry Pi and the HAT module.
    • If you want to extend the camera's connection with a 100mm ribbon cable, you can use it to increase the camera's flexibility and adjust its viewing angle.

Thermal Camera HAT Hardware01.jpg

  • Thermal USB Camera connects to Windows computers and Android phones.
    • Thermal USB Camera accessories have Type-C dual male cables that can be connected to the PC and Android phone, if you need to use a Type-C to Type-A male port, please purchase separately.

The left side of the following is the operation interface of the PC, and the right side is the operation interface of the Android phone software:
Thermal Camera HAT Hardwareer3.png

Pin Definition

Configure the camera registers on the Thermal Camera HAT via the I2C and send temperature data using SPI.

PI-4B Thermal Camera HAT
5V 5V
GND GND
D2 (BCM) SDA
D3 (BCM) SCL
D10 (BCM) MOSI
D9 (BCM) MISO
D11 (BCM) CLK
D23 (BCM) nRESET
D24 (BCM) D_READY
D7 (BCM) SS

Thermal camera hat01.jpg

I2C Bus

Thermal Camera HAT I2C1.jpg

  • On the Thermal Camera HAT, you can use a 0-ohm resistor to select the I2C address. The default address is 0x40, but you can optionally use 0x41. For more details, please refer to Thermal Camera HAT Schematic.
  • When the Raspberry Pi 4B acts as the Host device, it pulls down the SDA and SCL pins in sequence to initiate the START condition on the I2C bus. It then writes the device address (7 bits) and the write command (1 bit) for a total of 8 bits of data. If the pin connections are correct, the Thermal Camera HAT, acting as the Slave device, responds with an ACK.
  • The Raspberry Pi 4B continues by separately writing the register address (RA) and the register value (DATA) and waits for an ACK response. After completing the write operation, the controller pulls up the SCL and SDA pins in sequence to send the STOP condition.
  • If the Raspberry Pi 4B wants to read data from the register (RA), it waits for an ACK response after writing RA and then initiates another START condition. It writes the device address (7 bits) and the read command (1 bit) for a total of 8 bits and waits for an ACK response. After receiving the ACK response, the Thermal Camera HAT returns the DATA. Once the Raspberry Pi 4B receives the DATA, it can maintain the SDA pin at a high level.
  • For continuous writing of register values, please refer to the Burst Read/Write Sequence in the diagram.
  • For the register Map, please refer to MI48x3-Datasheet-v3.1.3.

SPI Bus

  • The SPI timing diagram of Thermal Camera HAT is shown below, please refer to MI48x3-Datasheet-v3.1.3 for more details.

Thermal Camera HAT SPI.jpg

  • The SPI interface of Raspberry Pi 4B must work in mode 0, MSB is valid, using 16-bit data width.
  • When reading data, 0x0000 must be sent to generate a clock signal, it supports full-frame temperature data readout mode.
  • When DATA_READY (D24 pin, abbreviated as D_READY) is high, the camera full-frame temperature data is valid.
  • DATA_READY will be lowered only after reading full frame data, Frame Header and Temperature data in the above figure represent full frame data.

Dimensions

Thermal Camera HAT Dimension.jpg

Temperature Measurement Principle

What is infrared temperature measurement?
In the field of measurement, "temperature" is one of the commonly used physical parameters, second only to "time." Based on the principles of Planck's and Boltzmann's radiation laws, infrared thermometers determine the temperature of objects by absorbing the infrared radiation emitted by the object being measured. So, how is non-contact temperature measurement achieved?
Any object with a temperature above absolute zero (0 K or -273.15°C) emits electromagnetic radiation from its surface, and this radiation is proportional to the object's intrinsic temperature. In this radiation, there is infrared radiation used for temperature measurement. After this radiation passes through the atmosphere, it can be focused on a detector using a specialized lens. The detector then generates an electrical signal proportional to this radiation. This signal is amplified and converted into an output signal proportional to the temperature of the object through continuous digital signal processing. As a result, the measured temperature value is displayed on the monitor or output in signal form.
In the use of radiation for temperature measurement, emissivity ε (Epsilon) plays a crucial role. It indicates the relationship between the actual object and the radiation of a black body. The emissivity of a black body is 1 (the maximum value). However, there are not many objects that can meet this ideal condition of a black body. When calibrating sensors, the emissivity of the radiation surface is typically considered (including the recommended wavelength: 0.99).
In terms of wavelength, many objects usually have constant emissivity, but their radiation ability is far from that of a black body, and they are referred to as gray bodies. If an object's emissivity depends on its temperature and wavelength (such as metals), it is called a selective emitter. In both of these cases, the missing radiation portion is compensated for by the emissivity. When using selective emitters, it is important to consider the wavelength being measured (for metals, a short wavelength is chosen).
In addition to radiation emitted from the surface of an object, infrared sensors can also receive reflected radiation from the surrounding environment, and sometimes there may be infrared radiation penetrating the object being measured.

Measurement Distance

  • Taking the 175cm human body as a standard, at a test distance of about 12m, the outline of the human body will be indistinguishable.

Measurement Accuracy

  • When the target object exceeds 25% or more of the module FOV, the relative humidity should be less than 95%, and there should be no condensed water vapor or moisture on the lens.
Using Temperature (℃) Target Temperature (℃) Maximum Deviation (℃)
Full Frame Accuracy 30.0 32.0-40.0 ±0.8 (center 32x24), ±1.0 (entire)
30.0 10-32.0, 40.0-70.0 ±1.5 (entire)
30.0 <10.0,>70.0 ±2.0 (entire), or 5%
Single Pixel 30.0 32.0-40.0 ±0.5 (center 32x24),±0.7 (entire)
30.0 10-32.0, 40.0-70.0 ±1.0 (entire)
30.0 32.0-40.0 ±2.5 (entire), or 5%
Temperature Stability 30.0 32.0-40.0 -0.21℃/℃
Power Stability 30.0 - ±1.0 ℃ / 100 mA

Main Usage

  • Long-term non-contact object temperature online monitoring program.
  • Infrared camera, and infrared thermometer.
  • Smart Home, Smart Building, Smart Lighting.
  • Industrial temperature control, security, intrusion/motion detection.
  • Micro-target thermal analysis, thermal trend analysis points and solutions.

How to Use

Windows

Thermal Camera HAT Usere.png

  • Connect the Thermal USB Camera to the PC, the accessories include a Type-C to Type-C double-ended data cable that can be connected to a PC and an Android smartphone. If you need to use a Type-C to Type-A adapter, please purchase it separately.
  • Open SenXxorEvkViewer.exe, click on "Refresh" on the interface, then select "Serial Port", and click on "Connect".
  • After clicking on "Connect", thermal images will be displayed in the SenXxorEvkViewer.exe software. By clicking on a specific point within the thermal image, the "Image Info Target" section will show the temperature value and coordinates of that particular point.
  • The "Color Palette Selection" section allows you to choose different rendering modes for thermal images, with the default being "HEATED_IRON". In the "FPS" section, you can adjust the frame rate using the "Down" and "Up" options.
  • In the bottom right corner of the SenXxorEvkViewer.exe software, there is a recording mode that enables you to save thermal image data as TXT files. Each line in the file records the temperature values of every pixel for each frame of the image.

Android

Thermal Camera HAT Ustae02.jpg

  • Using a Type-C dual-head data cable accessory to connect the Thermal USB Camera to an Android smartphone.
  • Install and open the app on your Android smartphone. The app will automatically detect and activate the infrared thermal imaging camera. If it doesn't open automatically, please try unplugging and reinserting the Type-C data cable.
  • After connecting the Thermal USB Camera, the thermal images will be displayed within app. By clicking on specific objects within the thermal image, you can view their corresponding temperature values.
  • In the app, you can use the triangular arrow icon located in the lower-left corner of the thermal image to select different rendering modes for the thermal images. The default mode is "HEATED_IRON." Additionally, on the right side of the screen in the "FPS" section, you can adjust the frame rate using the up and down arrows or opt for a dynamic frame rate.
  • The "SNAPSHOT" and "RECORD" buttons allow you to capture screenshots and record videos of the thermal images. The "AI FILTER" feature helps filter out image noise, and "FEVER DETECTION" can recognize the face, then estimate distances between body and the camera, as well as detect signs of heat.

Raspberry Pi 4B (buster&bullseys)

Note: The new version of the demo has been updated to have less noise and a clearer picture in infrared imaging.

  • It is recommended to use a pre-configured image with libraries already installed for testing purposes. When using such an image, you can skip the following environment setup and installation procedures.
  • Raspberry Pi Image-Google Drive, the image account and password are all test.
  • If users download and install the library by themselves, please install the library by prompts.
    • Enable the SPI and I2C serial bus of Raspberry Pi 4B.
    • Open the terminal and type "sudo raspi-config", select Interface Options, enable the following SPI and I2C interfaces, select "Yes" for both, and finally reboot the device.
    • Download the sample demo and unzip it. Please install the library according to the prompted information, the installation process takes a long time, the following information is for reference.
 wget https://files.waveshare.com/wiki/Thermal-Camera-HAT/Thermal_camera_code.zip 
 unzip Thermal_camera_code.zip
 cd pysenxor-master/
 sudo apt update
 sudo pip uninstall numpy(If you are prompted that there is no library, proceed to the next step, and if there is one, uninstall the library: pip uninstall numpy)
 sudo pip install numpy
 sudo pip install smbus
 sudo pip install crcmod
 sudo pip install matplotlib
 sudo pip install imutils
 wget https://www.piwheels.org/simple/opencv-python/opencv_python-4.6.0.66-cp39-cp39-linux_armv7l.whl#sha256=c1360e46e5ebd47a92e00c1f75c7d293d6ffd00d7f9ff06666f9af05eff2094f
 pip install opencv_python-4.6.0.66-cp39-cp39-linux_armv7l.whl
 pip install cmapy 
 sudo python setup.py install 
  • If the library is successfully installed, running the demo will start a window displaying a hot image, as shown in the following figure.
 cd pysenxor-master/example
 sudo python stream_spi.py

Thermal picture.png

Raspberry Pi Bookworm tutorial

Note: Since the bookworm environment itself no longer supports python-pip, you need to operate it in a virtual machine environment in order to use the installation package normally. If you find it complicated to configure your environment, you can use the Raspberry Pi Image here.

sudo apt install python3-venv
python3 -m venv myenv  #myenv is the name of the virtual environment created
source myenv/bin/activate

Note: If you need to boot up and enter the virtual environment, you can follow the following steps, or execute source myenv/bin/activate to enter the virtual environment.

deactivate  #Exit the virtual environment
sudo nano  ~/.bashrc    

Add the following to the last line of the file:

source /home/uesrname/myenv/bin/activate

Ctrl+X Save Exit

source ~/.bashrc  #Make the document effective

After executing the command, you will see that you have re-entered the virtual environment.

Demo download

wget https://files.waveshare.com/wiki/common/Thermal_Camera_Hat.zip

Install dependencies

pip install cmapy
pip install numpy   
pip install smbus
pip install crcmod
pip install matplotlib
pip install opencv-python
pip install cmapy

Unzip/install demo

unzip Thermal_Camera_Hat.zip
cd pysenxor-master/
pip install -e ./

After the installation is complete, you will be prompted with the following:
Install-pysensor.png

Thermal Camera HAT

The terminal executes the command to enable SPI

sudo raspi-config

Select Interface Options, then SPI, click Yes and press Enter key
Spi-1.png
Spi-2.png
Spi-3.png
Spi-4.png
Then select Interface Options, then I2C, click Yes and press Enter key, press Enter again and click Finish
Iic-1.png
Iic-3.png
Iic-4.png
Iic-2.png
Finish.png

sudo nano /boot/firmware/config.txt

Add dtoverlay=spi0-0cs statement below the dtparam=spi=on statement, save and exit
Config-thermal.png

cd example 
sudo python stream_spi.py

Thermal USB Camera

cd example 
sudo python stream_usb.py

Resources

Documents

Demo

Softwares

Datasheets

FAQ

 Answer:

The resolution of this camera is 80x62 as described.

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)