Android non-contact smart infrared thermometer
The current situation with COVID-19 remains serious. While everyone is doing their best to protect themselves, it is important to act responsibly and tackle this problem collectively. These days, it has become quite common in many public places and other gatherings to take everyone’s temperature as a precautionary measure to check for fever. The device used to do this is called a non-contact infrared thermometer. As many of you may have noticed, there has been a surge in demand for this product, but it is not difficult to make one yourself that not only serves its purpose but also offers more useful features than commercial products.
Therefore, the purpose of this article is to design a low-cost, easy-to-make, non-contact thermometer that can measure body temperature and record it into Excel along with a personal photo so that the record can be easily shared with relevant agencies. Let’s get started….
Low cost and easy to make – Android app
We can distinguish some important components on the thermometer, such as IR temperature sensor, microcontroller, display, driver and battery. Now, our goal is to reduce the cost, and the most expensive of these components is the IR temperature sensor. Unfortunately, as a maker, it seems that you don’t have any better choices except MLX90614 and MLX90615. In addition, if you use analog sensors, there are many cheaper options, but it is not easy to make and calibrate the device. In this article, we will use the MLX90615 sensor from Melexis.
After choosing the sensor, we are left with the microcontroller, display and battery. Therefore, we decided to reduce the cost of these three parts by using an Android phone. Nowadays, almost everyone has a good android phone. We can create a simple Android application that can communicate with the thermometer and perform other activities such as data logging and image capture. This way, we will not only make it run faster but also increase its potential applications by sharing the log results instantly with pictures on WhatsApp, Gmail or any other platform. That is why we chose the Android application called “Easy Scan” which is open source and the APK is also available for free download. Here is the list of components required for this project:
● MLX90615 infrared temperature sensor
● TCRT5000 infrared sensor
● Arduino Nano development board
Why choose TCRT5000 and Arduino Nano?
For many people, there will be such doubts. The reason for using the TCRT5000 infrared sensor is to detect the position of the thermometer and automatically obtain the temperature reading. This way, you don’t need to do anything with the application after it is launched, making it easy to use. In addition, the reading is only taken when the sensor is at the right distance from the person, so we don’t have to worry about wrong readings.
The reason for using Arduino Nano is that it has a built-in USB interface, which is important for communication between the controller and the phone. If you don’t have one, you can also use a Mega or even an UNO. But for the cost, you can even use a low-power microcontroller like STM8S or any other controller that supports I2C, ADC, and UART to complete this project.
How to connect MLX90615 and TCRT5000 to Arduino
The circuit diagram of our project is very simple. It only requires connecting the MLX90615 and TCRT5000 sensors with the Arduino nano development board. The complete circuit diagram of the non-contact thermometer is given below.
MLX90615 and TCRT500 are powered with 3.3V and 5V respectively, so we can power them accordingly. I2C communication pins A4 (SDA) and A5 (SCL) are used to communicate with the MLX90615 sensor. Using TCRT5000 with an operational amplifier, we need to make it more reliable and our infrared sensor should not be affected by sunlight. Therefore, we connect the IR diode to the digital pin of Arduino and the photodiode to the analog pin of Arduino. In this way, we can measure the value of the photodiode during the normal phase and then again after turning on the IR LED, and the difference between these two values should help us deal with the noise.
You can make a PCB for this if you want, but for quick prototyping I soldered the parts directly onto the breadboard. Once you are done the setup will look like this, we will 3D print the enclosure for this.
Non-Contact Smart Thermometer – Arduino Program
Thanks to the Arduino community, the Arduino program for this project is very simple. You can download the header files for MLX90615 provided by Sergey Kiselev from the link below.
● Download the MLX90615 header file
The complete Arduino program for this project can be found at the bottom of this page, and an explanation of the code follows.
We add the required header files and declare the variables. There are two important variables here, one is the error_correction value and the other is the range sensitivity value. Even though the MLX90615 is calibrated at the factory, I found that the values only make sense if we add the error correction value to it. In this case, we have to add 3.2 to the value obtained from the sensor to get a reliable value. I tested this value on a handheld thermometer and found it to be reliable after adding this error correction value. The next variable is the range sensitivity, if we reduce this value, we can increase the range of the thermometer.
To avoid false triggering of infrared sensors due to sunlight:
The next set of code is how the TCRT5000 is used in this project for error correction. It can be used as a simple position sensor, but the biggest drawback of an IR position sensor is that it will be triggered if the IR rays from the sun fall directly on it.
To avoid this problem, we have measured two values from the TCRT5000 sensor as explained in the circuit, with the transmitter LED of the IR sensor connected to a digital pin and the receiver LED connected to an analog pin. Now, in the program, we will read two values from the IR sensor, one is “Noise” and the other is “Noise plus Signal”. The noise value will be measured while the transmitter IR LED is turned off so that the receiver IR LED only shows the intensity of sunlight present in the environment. Then, we will measure the Noise plus Signal value after turning on the IR LED. Then in the program, we just need to subtract the “Noise” from the “Noise plus Signal” to get the signal value. The code to perform this operation is shown below.
Once we know the signal and noise values we can compare it to the Range_Sensitivity value to check if the sensor is close to the skin; if so we can send the temperature value over serial communication, otherwise we will output the position error. If the noise value is high (greater than 500 in this case) it means the sensor is facing direct sunlight, in which case we will not be able to read the temperature as I have found the sensor values to be very unreliable when facing direct sunlight. Again this should help avoid false readings.
Android App Easy Scan
The most feature rich of this project is the EAndroid application Easy Scan. You can download this application APK file from the link below. Download Easy Scan Android App
Since it is outside the scope of this article, we will not go into detail on how this app was developed, however, if you are a developer, feel free to play around with the Easy Scan Android app on Github and add new features or tweak it as per your requirements.
As mentioned before, the Android application allows us to store all the temperature values with photos and also share it as an excel file via Whatsapp email etc. Some screenshots of the application are shown below.
Testing the non-contact smart infrared thermometer using the Easy Scan Android app
Once the hardware is ready, upload the Arduino code given below. Then open the serial monitor and you will see the position error is displayed. If you bring your hand close to the sensor, you will see the temperature value. You can use any existing IR thermometer to check if the value is correct. The serial monitor screenshot is given below.
This will help us make sure that the hardware and program are working as expected. After that, use the OTG connector and connect your device to the phone. Both phones with Type-C and micro USB ports have been tested and found to work fine. Make sure to turn on OTG in your phone under the settings option.
Once the connection is established, install the Easy Scan app using the APK shared earlier, and then launch the app. Place the device on the object, and if everything is fine with the connection, you should see the temperature value on the app.
The app allows you to set a threshold temperature and if the temperature is above this threshold, you will be prompted to take a photo. All scanned records can be viewed in the app with time and date and can also be shared in Excel format to maintain records. I hope you enjoyed this article. If you have any technical questions, you can always reply below.
Code
The complete code used in this article is as follows: main.rar