Thermal Camera HAT (B)

From Waveshare Wiki
Jump to: navigation, search
Thermal Camera HAT (B)
Thermal-45-camera-hat-b-1 2 (1).jpg

Far-infrared thermal sensor array
40PIN
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

This product is a far-infrared thermal imaging sensor that uses a hybrid technology of microbolometer and thermopile pixels. It has an 80 × 62 pixel focal array and can detect the infrared radiation energy distribution of objects in the lens field of view. After quantization processing, the surface temperature distribution of objects in this field of view can be obtained, and a thermal imaging map can be generated, which is convenient for integration into various industrial or intelligent control applications. Compared to Thermal Camera HAT, this product has optimized internal filter and image processing algorithm, reduced the lens size to 9mm × 9mm, and changed the connector wiring method to FPC wire. Both 45° and 90° field of view models are available for selection.

Feature

  • Adopt 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) 125mK RMS@1Hz refresh rate, with good noise performance
  • Up to 25FPS (Max) frame rate thermal imaging video stream output
  • Online resources and manuals. (Python demo for Raspberry Pi, Android/Windows host computer and user manual, etc.)

Parameter

  • Power Supply: 5V
  • Operating Current: 20mA@5V
  • Wavelength Range: 8~14μm
  • FOV:
    • 56°(D) × 45°(H) × 34°(V) (Regular version)
    • 122°(D) × 90°(H) × 67°(V) (Wide angle version)
  • Operation Temperature: -40℃~85℃
  • Target Temperature: -40℃~400℃
  • Measure Accuracy: ±2℃
  • Refresh Rate: 25 FPS(Max)
  • Dimensions:
    • Thermal Camera HAT (B): 65.0mm × 30.5mm
    • Thermal USB Camera: NC
  • Noise Equivalent Temperature Difference: 125mK

Hardware Description

  • Thermal Camera HAT (B) connects to Raspberry Pi series 40 GPIO Pin.
    • Thermal Camera HAT (B) uses I2C to configure camera registers and SPI to send temperature data.
    • Thermal Camera HAT (B) has a RESET button on the board, which can be pressed for hardware reset in case of an exception.
  • Thermal USB Camera (B) connects to a Windows PC or Android phone and uses the USB interface to send temperature data.
    • Thermal USB Camera (B) encounters an abnormal situation, you can unplug and plug in the hardware again to reset it.

Hardware Connection

  • Thermal Camera HAT (B) 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 Raspberry Pi and HAT modules.

Thermal-45-Camera-HAT-B-5.jpg

Pin Definition

Configure the camera registers on Thermal Camera HAT via 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 hat 005.jpg

I2C Bus

Pico-10DOF-IMU011.jpg

  • On the Thermal Camera HAT (B), 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 Schematics.
  • When the Raspberry Pi 4B acts as the master 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 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 (B) is shown below, please refer to MI48x3-Datasheet-v3.1.3 for more details.

Thermal camera hat 006.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.

Dimension

Thermal-45-Camera-HAT-B-details-size.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 ±1.0 (center 32x24),±1.2 (entire)
30.0 10-32.0,40.0-70.0 ±1.5 (entire)
30.0 <10.0,>70.0 ±2.0 (entire FPA),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

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
  • 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 Thermal_camera_code Demoand 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:
Setup-capture.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 (B)

cd example 
sudo python stream_usb.py

FAQ

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)