Thursday, March 23, 2023

How To Use Your Phone As A Thermal Camera

By Ashwini Kumar Sinha

- Advertisement -
 

efy testThermal cameras or thermal accessories are one of the most essential devices for thermal scanning-based fault detection, thermal throttle analysis, thermal monitoring, or for any other purpose. Thermal screening is also used in monitoring the temperature of furnaces or boilers or analyzing body temperature without physical contact, as in the COVID examination.

While thermal cameras are expensive and their price range starts from 30K to 1 Lakh or higher, some cameras are available as an external accessories for phones. It can be attached and will convert your phone into a thermal camera, but even these accessories can cost up to 30K or higher, which is also quite expensive and I think it is an unnecessary investment for basic thermal analysis or thermal screening or to test COVID symptoms.

So we have decided why not design a very affordable thermal camera accessory for phones which can convert phones into a thermal camera and the price is as low as 5K to 6K. This camera can be used to get very basic thermal video and it can be used for many basic tasks like thermal screening, thermal testing analysis, thermal monitoring, etc.

- Advertisement -

We made this Thermal Camera with Raspberry Pi.

Here you can see how to make your phone a thermal camera…

The design consists of the following components:

Bill of Materials 

Components Quantity Description
AMG 8833 (S1) 1 8×8 Thermal Sensor
Raspberry Pi Zero W (MCU1) 1 For Processing Sensor Data
Micro USB to iPhone OTG (USB 1) 1 Male iPhone/USB type C to Male micro USB OTG
3D Case 1 PLA/ABS 3D Printed Enclosure

 

Note:-The OTG adapter can be used according to the device or phone on which we will be configuring our device. For the iPhone, you need the OTG adapter for the iPhone, and for an Android phone, type-C USB.

DIY Thermal Camera
DIY Thermal Camera

Designing Thermal Camera for Smartphone

First, the body of the device is to be designed in a way that supports and protects the components and device. The thermal sensor and the Raspberry Pi Zero W are used together. The enclosure/case of the device can be designed as per the size of the Raspberry Pi Zero W and make a hole at the bottom of the case to expose the thermal sensor, while a cut for the USM micro OTG outlet can be provided at the top of the case as shown below.

Raspberry Pi Thermal Camera Enclosure
Thermal Camera Enclosure

Raspberry Pi Thermal Camera Circuit Diagram

After designing the case, connect the sensor, Raspberry Pi, and OTG as shown in the circuit diagram. If you have an OTG with a micro USB male output, then you can directly connect that micro USB to the Raspberry Pi micro USB input.

Or else, you need to cut the wire of the OTG and solder the +ve wire to the 5V pin of the Raspberry Pi, and GND to the GND pin of the Raspberry Pi.

Raspberry Pi Thermal Camera Circuit
Circuit Diagram

For the iPhone, avoid using the soldering process and use the Micro USB male to iPhone male OTG connector. Do check all connections to avoid causing damage to your expensive phone.

After connecting the OTG and sensor with the Raspberry Pi, fix the sensor, Raspberry Pi, and OTG adapter inside the designed and 3D printed enclosure.

ThermoCam
The thermal sensor attached to the designed case
Thermal Camera with Raspberry Pi
Raspberry Pi fixed on 3D printed case
DIY Thermal Camera
Device after setting and fixing all components

Let’s Understand How the Thermal Camera Works?

The thermal imaging camera has a thermal sensor inside many small IR thermal sensors. Each thermal sensor acts as a pixel of the thermal camera and it is in the form of a matrix, so if good quality and high-resolution thermal camera sensors are used, then it consists of very small thermal sensors in the form of pixels.

Here, we are using the AMG8833 thermal sensor, so the pixel size is a matrix of 8 X 8, and to get the real-time video, we map those pixels, i.e. small sized IR thermal sensor data, with colors like blue to yellow to red, where RED is the max hot color and BLUE is the min coldest color, and then after the mapping, the thermal image is formed that we see in any thermal camera video.

Programming Raspberry Pi Thermal Camera

Install the Raspberry Pi with the latest Raspbian OS. Then enable the I2C peripheral in Raspberry Pi as the thermal sensor we are using is interfaced on I2C communication, hence to enable the I2C on Raspberry Pi, open the terminal and run. 

sudo raspi-config 

Then go to the advance and interfacing option and enable the I2C and VNC.

Now connect the Raspberry Pi to a phone hotspot or WiFi network to which the phone is connected. Next, we need to install a few libraries and modules that help us with interfacing the sensor and getting data from it, as well as viewing that data in video form. So open the Linux terminal and run the following command 

sudo pip3 install pygame

sudo pip3 install scipy

sudo pip3 install numpy

sudo pip3 install Adafruit_AMG88xx pip install Adafruit_AMG88xxpip 

After installing the library, import all installed modules in the code, then we need to set the max. temperature and min. temperature range to get our AMG sensor read.

Set the range between 22 to 45, or even a higher range can be used depending on the requirement and the purpose for which you are using it.

If it is used for thermal analysis and the temperature range is greater than 100, then you can set the range according to that.

Next, set the pygame window size, the size at which the video output for your thermal camera is obtained, and then we will map the sensor pixel data to red, green, blue, and yellow. 

Thermal Camera Code
Code for Setting the Display Size

Our device is ready after preparing the above code.

Download Source Code

Now connect the device to the charging port/USB of your iPhone or Android phone.

Thermal Camera with Raspberry Pi
Using a smartphone as a Thermal Camera

Now, install the VNC viewer on the phone or PC on which you want to receive the thermal camera video. Suppose we are converting the iPhone into a thermal camera by attaching it to our device, so we install the VNC viewer on the iPhone, available on the app store.

We need to insert the IP address and password of our Raspberry Pi and let the Pi connect to either a phone hotspot or to the same WiFi network that our phone is connected to.

Now we run the code that we prepared earlier, and now you can get the real-time thermal video. Move your hand near the thermal sensor device or bring the hot object near the sensor device and you can see the thermal video of any object.

Mobile Thermal Camera
Testing the thermal camera on the phone

Congrats!! You have just designed the thermal screening attachment accessory

If you have any questions, please feel free to ask in the comment section below. You can also go to Forum to discuss with the community of electronics hobbyists and experts.

SHARE YOUR THOUGHTS & COMMENTS

 
 

What's New @ Electronicsforu.com?

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Tech Contests