InstaPulse: An all-in-one health solution with ESP32 and IFTTT

1 Arduino Mega 2560
1 ESP32 WROOM32 38 pin NodeMCU
1 ILI9341 TFT 2.8"
1 Adafruit AMG8833 IR Thermal Camera
1 MAX30102
Arduino IDE
Soldering Iron

I realized that the ESP32 was not really able to accurately get sensor data, and I wasn't sure why. Therefore, I used an Arduino to obtain the data, which can be sent to the ESP32 via Serial/UART. The ESP32 controls the WiFi communication with Adafruit IO and the TFT display, which tells directions and the data obtained to the user. Once the ESP32 gets the data, it sends it to feeds on Adafruit IO, which IFTTT will check for abnormal data. Then, IFTTT sends an email to the user about the readings.

Install libraries

First, you must install the required libraries for this project. They include Adafruit AMG8833, Adafruit IO, TFT_eSPI, Sparkfun's MAX3010x sensor library, and SoftwareSerial.


While SoftwareSerial is actually not necessary, I was originally going to use an Arduino Uno


Once you open Arduino IDE, go to Sketch → Include Library → Manage libraries


Click install on the latest version, and search for the other libraries similarly.

Additionally, you would also need to create an account on Adafruit IO. You will need to obtain your key, so go to any dashboard and click on “My Key".


You will have to set up 3 feeds. You can assign any name to them, they will just store the numeric values of temperature, heart rate, and spo2.

Code for ESP32

Originally, I wanted to include everything on the ESP32 itself. That means that all my sensors would send data to the ESP32. But for reasons I could not decipher myself, the ESP32 wasn't reading the correct data. Therefore, the ESP32 would only have the code to send data to Adafruit IO and control the TFT.


This code just listens to if data is sent over Serial, and then it is parsed accordingly. I use the whitespace “ ” and underscore “_” in order to separate what data is temperature, heart rate, and SpO2.


However, the ESP32 board is not natively available to be flashed in Arduino IDE. Therefore, we would need to add the JSON for the Board Manager about the ESP32.



First, go to Preferences → Additional Boards Manager URLs and copy this link in that field.




In Arduino IDE, go to Tools → Board →Boards Manager. Search ESP32, and install that.


After that, wire the ESP32 to the TFT like this:

ESP32     TFT

3.3V → VCC

3.3V → LED

18 → SCK

15 → CS


23 →MOSI

2 → DC


Then, go to your folder where your arduino libraries are normally saved. Go to TFT_eSPI, and replace the file named User_Setup.h with the one in this zip. The one I have in the zip is preset with the configurations according to my connections.



icon User_Setup.zip 6KB Download(0)

Now, your ESP32 is ready to be flashed. Download this code and config.h file. Edit the config.h file and add your adafruit io username, key, WiFi ssid, and WiFi password. Then, compile it to your ESP32. Leave all upload instructions to the default, just select the port and upload.


It will display a simple non-interactive GUI, but it won't change because the Arduino isn't sending data. So, let's program that.


Additionally, change the names of the Adafruit IO feeds to whatever you named it to be. I used C1T, C2T, and eco21 because those were names from an old project of mine, and I am reusing the same feeds.

icon esp32code (2).zip 2KB Download(1)
Program Arduino Mega 2560

Originally, I was considering about using the Arduino Uno to get the sensor data, for its small size. However, I realized that the algorithms for SpO2 and heart rate detection went over the 2048 KB limit for variables. Therefore, I upgraded to an Arduino Mega 2560, which has 8192 KB allowed for variables. Although I certainly do not need the excess pins, the extra space for variables is definitely useful.


Wire the AMG8833 thermal camera and MAX30102 SpO2 and HR sensor like this:

Arduino Mega 2560 → AMG8833 → MAX30102

3.3v → VIN → VCC



Next, you would need to wire the Arduino Mega 2560 to the ESP32. This is to send the sensor data from the Arduino to the ESP32. I used SoftwareSerial because I was originally designing the Serial communication using the Arduino Uno, which only has 1 Serial port. However, I didn't want to use that, because those were the same two pins as the ones used by the USB to flash code.



I attached a wire from Arduino pin 11 to two 10k ohm resistors, in series. Between the two resistors, I added a wire to G16 on the ESP32. The other side of the 2nd 10k ohm resistor goes to the ESP32's ground. This is basically a voltage divider to make the voltage usable with the ESP32, to avoid overheating or frying it.

Next, download the code in this zip file, and run it on the Arduino Mega. Leave all other settings as default except COM port.

icon mega2560.zip 3KB Download(1)

Lastly, we need to prepare IFTTT. Go to https://ifttt.com/explore and create an account. Then,go to https://ifttt.com/adafruit and link your IFTTT account to adafruit. Be sure to use the same email for both. 


Go to Create. You should see text saying “If this then that”. Set the “this” to your feed. Let's say this is for high temperature. Then, set the “that” to an email. The contents of the email can detail the information about the sensor, and indicate that the temperature is very high.


Repeat this for extremely low temperature, low SpO2, very high heart rate, and very low heart rate. 

Once you press the reset button on the Arduino Mega and ESP 32, your solution should be working. After 30 seconds to 2 minutes, the TFT should change to show your data. It would also send this to the Adafruit IO feeds.






All Rights