Contactless temperature-measurement guns became popular during the Covid pandemic. Several places used this device to ensure safety protocols. However, one of the drawbacks of the contactless temperature measurement guns available today is that they measure body temperature — not the distance of the body (object) from the sensor.
The body’s distance from the sensor is the most important factor in correct temperature measurement. The sensor used for contactless temperature measurement in such guns can only read the temperature of the surface of an object (the human body in this case) accurately if the object distance is less than 5 cm. If we measure the body temperature from 10 or 15 cm away, there’s the possibility of an error and inaccurate reading.
To ensure the correct temperature reading, we must keep the gun sensor less than 5 cm away from the body. In this project, we will create a smart contactless temperature gun with some modifications and enhancements in the sensor and software part to ensure its accuracy in measuring the correct human body temperature that considers distance as a parameter.
The gun will measure the distance of the body first and, when the body is less than 5 cm away, it will then measure its temperature. It does not measure the temperature directly but, instead, it measures distance. If the body is away from the gun sensor, it gives a message to come closer, and when the body is within 5 cm range, it measures the body temperature. This provides accurate reading and rectifies the problem of reading the wrong body temperature.
We call it a “smart” contactless temperature measurement gun because it measures the distance and takes the body temperature reading multiple times, providing an accurate average value. It also reads the body temperature beyond the normal range, providing an alert notification.
This gun is built using contactless temperature measurement sensor MLX90614 from Melexis, UDM sensor HC SR04, Arduino, NANO, and OLED. The body temperature measured with the gun is compared with a conventional digital thermometer.
Here’s a snapshot of the prototype model.
Now, let’s start to build this gun. First, we’ll cover the system block diagram.
System block diagram
The major building blocks of this system include:
- The contactless temperature measurement sensor, MLX90614
- The ultrasonic distance measurement (UDM) sensor, HC SR04
- A 1-inch dual-color OLED screen
- The Arduino NANO development board
- A few other components such as LED, a mini buzzer, a pushbutton, etc.
The MLX 90614 sensor: a contactless temperature sensor that measures the surface temperature within a short range of 5 cm and provides a temperature reading output to the Arduino microcontroller through IIC communication.
The HC SR04 UDM sensor: an ultrasonic distance measurement sensor that measures the distance of any object in front of it, providing a PWM output (the pulse width varies as per the distance of an object) to the Arduino microcontroller.
Arduino NANO: which performs these tasks:
- Reads and gets human body temperature using the MLX sensor
- Measures the distance of an object (human body) using the UDM sensor
- Displays body temperature and distance on the OLED screen
- Gives an audio-visual indication via the LED and buzzer
- Receives user inputs from the pushbuttons
An OLED screen: this mini 0.96-inch, dual-color (yellow and blue) OLED screen works on the IIC protocol. It displays the object distance, object surface temperature, and some messages.
Pushbuttons: there is one for taking a reading (body temperature and distance) and another for changing the temperature reading from oC to oF and vice versa.
An LED and a buzzer: LED blinking and a buzzer “beeping” sound is used for audio-visual indication of the body temperature. The LED blinks when the body temperature is measured and displayed on an OLED. At the same time, the buzzer gives a beeping sound. The LED also blinks when the temperature reading changes from oC to oF and vice versa.
Before building the circuit, you’ll need to collect the required items.
Here’s the list…
Required items:
1. The MLX90614 sensor
2. The HC SR04 sensor
3. The OLED screen
4. The Pushbutton (small and micro)
5. An LED
6. Arduino NANO
Circuit diagram
The circuit is built using few components and it can be constructed quickly on general-purpose PCB (or on breadboard also).
- The MLX90614 sensor has four pins (1) VIN (2) GND (3)SCL and (4) SDA. The sensor operates on 5V, so the VIN pin is connected with the 5V output pin of Arduino, and the GND pin is connected with the circuit and Arduino board ground. The SCL and SDA pins are serial clocks and serial data pins for IIC communication. They’re connected with the Arduino board A4-SDA and A5-SCL pins, respectively.
- The HC SR04 sensor has four pins (1) Vcc (2) Gnd (3)Trig and (4) Echo. The sensor requires 5V so its Vcc pin is connected to the Arduino board 5V output pin, and the GND pin is connected with the circuit ground. The trigger (input) pin is connected with digital pin D2, and the echo (output) pin is connected with the pin D3 of the Arduino board.
- Again, the OLED screen has four pins (1) Vcc (2) Gnd (3) SCL, and (4) SDA. Its required operating voltage is 5V, so the Vcc pin is connected with the 5V output pin of Arduino, and the GND pin is connected with the circuit and Arduino board ground. It also works on the IIC protocol, so its SCL and SDA pins are connected with the Arduino board A4-SDA and A5-SCL pins, respectively.
- One small pushbutton is connected to pin A2*, and a micro pushbutton is connected to pin D11, as shown.
- The buzzer is connected with pin A1*, and the LED is connected with pin A0* as shown.
- A 9V battery (not shown in the figure) gives power to the entire circuit. It’s connected to the Vin pin of the Arduino board. The Arduino board gets 9V input from the battery, and it provides 5 V output using an onboard voltage regulator. This 5V output is given to all other circuit components.
*Note: the digital I/O devices (button, LED, and buzzer) are connected with analog input pins because we’re not using any analog input pins in this project. So, we’re using these analog input pins as digital IO pins. But you can connect these devices to any digital pins (D0 – D13, depending on convenience.
The circuit operation
Before explaining the working and operation of a complete circuit, it’s necessary to know the operation of the different blocks — such as the MLX sensor, UDM sensor, OLED display, etc. To fully understand the operation of the UDM sensor and the display distance on the OLED, please go through this article
The MLX90614 sensor operation
The MLX90614 is an infrared thermometer for non-contact temperature measurements. A low noise amplifier, 17-bit ADC, and powerful DSP unit are integrated into the MLX90614, allowing for high accuracy and resolution of the thermometer. The IR-sensitive thermopile detector chip and the signal conditioning ASIC are integrated into the same TO-39 can.
The thermometer comes factory-calibrated with a digital IIC bus (SMBus) output, giving full access to the measured temperature in the complete temperature range(s) — with a resolution of 0.02° C. The user can configure the digital output to be pulse-width modulation (PWM). As a standard, the 10-bit PWM is configured to continuously transmit the measured temperature in the range of -20 to 120° C, with an output resolution of 0.14° C.
The MLX90614 sensor can measure the temperature of an object without any physical contact. This is made possible via the Stefan-Boltzmann Law, which states that all objects and living beings emit IR energy. The intensity of the IR energy will be directly proportional to the temperature of that object or living being. So, the MLX90614 sensor calculates the temperature of an object by measuring the amount of IR energy emitted from it.
The MLX90614 consists of two devices embedded as a single sensor; one device acts as a sensing unit and the other acts as a processing unit. The sensing unit is an Infrared Thermopile Detector called MLX81101, which senses the temperature. The processing unit is a Single Conditioning ASSP called the MLX90302, which converts the signal from the sensor to digital value and communicates using the I2C protocol. The MLX90302 has a low-noise amplifier, 17-bit ADC, and a DSP, which helps the sensor achieve accuracy and resolution.
The sensor requires no external components and can be directly interfaced with any microcontroller. The power pins (Vdd and Gnd) can be used directly to power the sensor. The signal pins SCL and SDA are used for I2C communication and can be connected directly to the microcontroller operating on 5V logic.
As seen in the circuit diagram, these four pins are directly connected to the Arduino board. The Arduino microcontroller will get the direct digital value of body temperature from this sensor. However, the digital value given by the sensor should be further calibrated with a standard medical digital thermometer for accurate measurement of body temperature.
To interface the MLX sensor with Arduino and to read object temperature, we have to use its Arduino library readily available on Adafruit:
Adafruit_MLX90614.h
We have to install this library in Arduino IDE software.
Sensor testing and calibration
To test and calibrate the MLX sensor do the step by step procedure
1. Connect the sensor with Arduino. Connect its four pins with Arduino as given in the circuit diagram
2. Open “mlxtest” example from this library (file->example->adafruit MLX90614 library ->mlxtest)
3. Upload this program to the Arduino board
4. The sensor will read the object’s temperature and display it on the serial monitor
5. Measure the human body temperature using a sensor and note down the readings
6. Measure the body temperature using a conventional medical thermometer (digital) to calibrate it. Compare both values. If both are not the same, add some threshold value in the MLX sensor temperature readings.
For example, the MLX sensor reads body temperature as 91.0oF, and the thermometer reads temperature as 95.5oF, then add a threshold of 4.5 in the MLX sensor reading in the program as:
mlx.readObjectTempF() + 4.5
- Now read the body temperature of the other person using the sensor. Again measure his temperature using the thermometer and compare both temperature readings. If they match, then it is perfect otherwise adjust the threshold value. Repeat this procedure five to six times and adjust the threshold value. You will get accurate readings of human body temperature from the MLX sensor.
After understanding the working of different blocks now, let us see the working of the complete circuit.
- When battery power is given to the circuit, the initial message is displayed on the OLED as “contactless temperature measurement gun”
- The button (small pushbutton) is pressed to measure the body temperature.
- As soon as the button is pressed, the UDM sensor will start measuring the distance of the human body, which is displayed on the OLED screen.
- If the body is too far away from the sensor, it displays the message: “get closer.”
- When the body gets within 5 cm or less, the MLX sensor begins reading the body’s temperature.
- It takes readings five consecutive times, calculates the average of the five readings, and displays the final temperature value on the OLED. This process will take two to three seconds. The message is displayed on the OLED as, “Hold for 2-3 sec reading temperature”
- The LED blinks multiple times and when the process is done, the buzzer gives a beeping sound. The final body temperature is displayed on the OLED screen.
- The final body temperature reading is displayed on the OLED as oF or oC. It can be changed by pressing the micro pushbutton.
- Alternatively, pressing this button will change the temperature reading from oC to oF and vice versa. The LED blinks and the buzzer generates a beeping sound whenever it’s changed.
- Lastly, if body temperature exceeds the normal human body temperature range, such as 100 oF (or 40 oC), it gives an alert indication by blinking the LED. The buzzer will also beep three times.
The circuit is built on a general-purpose PCB. Also, it displays the output results of the circuit as the temperature and distance measurement display on an OLED screen.
Here are a few snapshots of component arrangements and circuit assembly…
This working and operation of the circuit are based on the program downloaded into the Arduino microcontroller (ATMega328) internal FLASH memory. Next, it’s time to go through the software program.
Software program
The program is responsible for performing all the following tasks
- It measures object distance (body) using the UDM sensor
- It measures body temperature using the MLX sensor
- It displays distance and body temperature on an OLED
- It gives an alert indication via an LED and a buzzer if the body’s temperature is high
The program is written in C programming language using Arduino IDE, and it’s compiled and uploaded into the Arduino microcontroller internal FLASH.
Here is the complete program code.
You may also like:
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.