Many people all over the world do not have immediate and easy access to health care. For some, that means thinking of creative ways of contributing toward taking better care of ourselves and improving response times to reacting to potential illness, like via this handheld, personal body temperature detector.
GitHub user Gilbert François created a Raspberry Pi-based device capable of estimating human skin temperature. This is useful as a quick way of helping you take your own temperature in an interesting way. If you feel a fever coming on, this device could help you verify that with temperature data and imaging.
Read on for a step by step tutorial on how to build one for yourself.
Before you start
Using the project
Before you start
Human skin has an average temperature of 32ºC to 34ºC (that is 89ºF to 93ºF), values below or above that range are not considered healthy and could be an indication of a possible health issue.
This project combines a thermal camera with a small screen to display temperature readings in real time and show a warning in case you are outside of the healthy range.
NOTE: This is NOT an approved medical device. This project is an exploration of body temperature monitoring and not meant as any kind of treatment or therapy. Contact healthcare professionals should you have concerns about your health regarding COVID-19 or any other disease or illness.
To build this project you’ll need the following:
- Raspberry Pi 3A+/3B/3B+/4B
- An SD Card (we recommend SanDisk Extreme Pro SD cards)
- Power supply
- MLX90640 thermal camera (pimoroni, sparkfun)
- DSI screen for Raspberry Pi (example of Raspberry Pi 7’’ touchscreen)
- (optional) Case and battery
- A download of the skin-temperature-scanner project
- Software to flash an SD card (e.g. balenaEtcher)
- A free balenaCloud account to setup and manage the Pi
Set up the Raspberry Pi and hardware
To start things off we need to hook up the screen to our Raspberry Pi.
Connect the ribbon display cable using its two black latches. Secure one end to the Raspberry Pi, and then secure the other to the screen controller. Make sure the cable has a good fit before doing so. In case you want a detailed step by step guide on how to assemble the screen be sure to check out our guide on it.
Next, connect the header pins on the controller into the Raspberry Pi GPIO. Since we won’t be using the touch capabilities of the screen, there are two cables that we don’t need to connect. The only connections that we need are the following:
|LCD Pin||Pi GPIO board pin||Lead Color|
|Power (Vcc 5V)||2||Red|
Note: we’ve included the pinout labelling for the Raspberry Pi GPIO port below, but pay extra care to avoid damage to either board.
Lastly, we need to connect the thermal camera module to the GPIO on the Raspberry Pi. The connections are as follows:
|MLX90640 Pin||Pi GPIO board pin|
The camera module has an extra pin (INT) which we won’t be using. You can either leave it unplugged or connect it to GPIO #7 as seen below:
Deploy the project code
This project uses the
Deploy to balena feature, so you’ll want to set up your free account ahead of time to get the most out of this convenient method.
Click this button to create the application and deploy it:
Create and Deploy.
This will create an application with all of the project code already deployed and all of the configuration settings pre-set.
Add an application following the steps within the interface, selecting the correct device type for the device you’re using. For most new users, the
Starter application provides you with all of the features of the microservices application and is free up to and including your tenth device.
Once you add the application, you’ll see your newly created application appear on the dashboard. If you choose to, you can rename your application.
Add a device and download the balenaOS disk image from the dashboard
Once your application has been created, you can setup and add a device within that application by clicking the green ‘add device’ button. When you add a device you specify your device type, which is important that it matches the device you’re using, and if you are connecting to a wireless network you can set your WiFI SSID and passphrase here too.
Note: we’ve used a Raspberry Pi 3 in the image below but be sure to select the correct device type for the device you are using!
This process creates a customized image configured for your application and device type and includes your network settings if you specified them.
Note: When you’re first getting started, a development image will be most useful, as it permits a number of testing and troubleshooting features. More details on the differences between development and production images can be found here. If you’re confident you can go ahead and deploy the production image straight away.
Flash your SD card with the balenaOS disk image and boot the device
Once the OS image has been downloaded, it’s time to flash your SD card. You can use balenaEtcher for this.
Once the flashing process has completed, insert your SD card into the Raspberry Pi and connect the power supply.
When the device boots for the first time, it connects to the balenaCloud dashboard, after which you’ll be able to see it listed as online and move onto the next step.
Troubleshooting: It should only take a few minutes for the new device to appear in your dashboard, If your device still hasn’t shown up on your dashboard after a few minutes, something has gone wrong. There’s an extensive troubleshooting guide in the documentation, with lots of information on why this could be, but if you still can’t get your device online, come on over to the forums where we’ll be able to help out.
If everything worked out correctly, after a few minutes your device information screen in the dashboard should look something like this, showing the service running.
At this point you’re ready to move on, connect things up and give it a try!
Using the project
Give it a try
Once your device boots up and the app gets running you’ll see the output of the thermal camera displayed on the screen along with the indicator on whether the temperature detected falls within the safe rage or not.
There are two noticeable improvements that can be made though to make the device experience more fluid.
First of all we need to fix the screen orientation. By default it will show in landscape mode but that does not take advantage of our screen. Let’s fix that by adding a device configuration variable in the balenaCloud dashboard called
BALENA_HOST_CONFIG_display_rotate and set the value to
1 (90º rotation) or
3 (270º rotation).
The other thing you might notice is that the thermal data refreshes quite slowly. To increase that we need to increase the speed with which the thermal camera communicates with the Raspberry Pi over the I2C bus. That can be done by appending
"i2c1_baudrate=1000000" to the DT parameters list under the
Device Configuration section:
Until next time…
Thanks for checking out this guide! If you have trouble getting the project running or have any other feedback we’d love to hear it; everything helps to improve our projects and tutorials for the next time.
As a final note, make sure to star Gilbert’s repository in GitHub and drop him a comment to thank him for his great work. As mentioned earlier, he envisioned and created this project and it’s with his permission that we’ve turned it into a full tutorial.