Thermal Camera HAT

From Waveshare Wiki
Revision as of 09:14, 25 April 2024 by Eng52 (talk | contribs) (→‎Demo)
Jump to: navigation, search
Thermal Camera HAT
Thermal Camera HAT.jpg

USB
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

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 connector respectively. Support Raspberry Pi, PC, and Android phones. They adopt the hybrid technology of microbolometer and thermopile pixels and can detect the IR distribution of objects in the field of view, 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, 80x62 array pixels.
  • Continuous operation and thermal imaging video stream due to shutterless design.
  • Noise Equivalent Temperature Difference (NETD) 150mK RMS@1Hz refresh rate.
  • Up to 25FPS (Max) thermal imaging video stream output.
  • Comes with online resources and manuals (Python demo for Raspberry Pi, Android/Windows host computer and user manual, etc.)

Specification

  • 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]
  • Noise Equivalent Temperature Difference: 150mK
  • Measure Accuracy: ±2℃ (ambient temp. 10~70℃)
  • Dimensions:
    • Thermal Camera HAT: 65.0 × 30.5mm
    • Thermal USB Camera: 62.0 × 13.0mm

Hardware Description

  • Thermal Camera HAT connects to Raspberry Pi series 40 GPIO headers.
    • 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 right side of the following is the operation interface of the Android phone software, and the left side is the operation interface of the PC:
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 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 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.
  • The data must be read by sending 0x0000 to generate a clock signal, supporting 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? (Quoted from OPTRIS.)
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 both 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", in the SenXxorEvkViewer.exe software, thermal images will be displayed. 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 *Thermal USB Camera Android Software. 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 estimate distances between faces and the camera, as well as detect signs of heat.

Raspberry Pi 4B

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 passwords are "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 
 Thermal_camera_code.zip
 cd pysenxor-master/
 sudo apt update
 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)
 wget https://files.pythonhosted.org/packages/79/ae/7e5b85136806f9dadf4878bf73cf223fe5c2636818ba3ab1c585d0403164/numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
 sudo pip install numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl 
 sudo pip install smbus
 sudo pip install crcmod
 wget https://files.pythonhosted.org/packages/9c/c2/cef42160c52076a9e4b102a56a5ddfe732e2b88502f5ca0c9a7d262e706e/matplotlib-3.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
 sudo pip install matplotlib-3.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
 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 
  • 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 5

Note: As "python-pip" is no longer supported by pi5, we need to operate in a virtual environment to ensure that the dependencies are installed properly.
Install virtual environment:

sudo apt install python3-venv

Create virtual environment:
Thermal Camera HATrp5.png
Enter:

source env/bin/activate

Note: Due to some libraries directly installed will appear timeout or can not find the version, you need to download first and then install!
Install dependencies:

sudo apt update
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)
wget https://files.pythonhosted.org/packages/79/ae/7e5b85136806f9dadf4878bf73cf223fe5c2636818ba3ab1c585d0403164/numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip install numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip install smbus
pip install crcmod
wget https://files.pythonhosted.org/packages/9c/c2/cef42160c52076a9e4b102a56a5ddfe732e2b88502f5ca0c9a7d262e706e/matplotlib-3.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip install matplotlib-3.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip install imutils
wget https://files.pythonhosted.org/packages/9e/b9/0d479c9ce987ba3c894c08785a4a3c38651e8cb14800fbe788d3ed8d3c11/opencv_python-4.7.0.72-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip install opencv_python-4.7.0.72-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pip install cmapy --break-system-packages

Download Pysenxor-master demo:

wget https://files.waveshare.com/wiki/Thermal-Camera-HAT/Pysenxor-master.zip
unzip Pysenxor-master.zip
cd pysenxor-master/
sudo python setup.py install

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

Thermal Camera HAT

sudo nano /boot/firmware/config.txt

Add "dtoverlay=spi0-0cs" after "dtparam=spi=on", save to exit:

cd example
sudo python stream_spi.py

Thermal USB Camera

cd example
sudo python stream_usb.py

Resource

Document

Demo

Software

Datasheet

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)