Kutluhan Aktar
Published © CC BY

Free IoT Services | Get Heart Rate, Temperature and Humidity

Get data packets from NodeMCU etc. through encrypted database connection path by subscribing with Google+, Twitter, or creating an account.

EasyFull instructions provided1 hour308
Free IoT Services | Get Heart Rate, Temperature and Humidity

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
KY-039 Finger Heart Rate Sensor
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
5 mm LED: Green
5 mm LED: Green
SparkFun Solder-able Breadboard - Mini
SparkFun Solder-able Breadboard - Mini
Male/Male Jumper Wires

Software apps and online services

Arduino IDE
Arduino IDE
TheAmplituhedron IoT Services
Programmed in PHP, AJAX and jQuery by myself for only my website subscribers.
Continue with Twitter
Google Gmail
Sign In with Google Plus


Read more

Custom parts and enclosures

Fritzing File




Source Code

        // IoT Heart Rate and Temperature Detector //
       //    via TheAmplituhedron IoT Services    //
      //          ---------------------          //
     //           NodeMCU (ESP-12E)             //           
    //           by Kutluhan Aktar             // 
   //                                         //

// By only subscribing to TheAmplituhedron, you will be able get your data packets from NodeMCU, or any other device that can make an HTTP GET Request, to your IoT Dashboard on your account page.
// TheAMplituhedron IoT Services is an available system for TheAmplituhedron.com subscribers only, and simple to use.
// Follow the steps down below to create and communicate your connection path on which you will display your data packets in every 2 seconds.
// 1) Go to your Dashboard.
// 2) Click Iot Services under Available Systems.
// 3) Read the given instructions and click Create+
// 4) Copy the url to use in the souce code.
// After creating your unique connection path, you can send data packets through NodeMCU by entering your WiFi settings and required information down below.
// As a reminder, my website has SSL protection so that you need to identify your NodeMCU connection by entering TheAmplituhedron FingerPrint or ThumbPrint.
// You can learn about it more from the link below.
// https://www.theamplituhedron.com/dashboard/IoTServices/
// In this project turorial, I decided to use a KY-039 Heart Rate Sensor and a DHT11 Temperature and Humidity as data providers.
// But do not forget that the heart rate value generated by KY-039 is not accurate most of the time; it is merely a demonstration sensor for this project tutorial. If you want to
// get more accurate data in that subject, I recommend you to use an heart rate detector with enhanced accuracy and efficieny.
// Connections
// NodeMCU (ESP-12E) :           
//                                Control Led
// D1  --------------------------- +
//                                DHT11 Temperature and Humidity Sensor Module
// D2  --------------------------- Data
//                                KY-039 Heart Rate Sensor
// A0  --------------------------- S

// Include required libraries to send data to a website, in this case TheAmplituhedron.com.
#include <ESP8266WiFi.h>
#include <WiFiClient.h> 
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>

// Include DHT master library to elicit information from DHT11 Temperture and Humidity Sensor.
#include "DHT.h"

// Define DHT object.
DHT dht;

// Define your WIFI settings.
const char *ssid = "WiFi_SSID";
const char *password = "WiFi_Password";

// Define Finger Heart Rate Sensor signal pin.
#define fingerSignal A0

// Define a default average heartbeat value as integer to count heartbeat.
int count = 70;

// Define a control pin for WiFi test.
#define control D1

// Create data holders to send data packets.
int temperature, humidity;
String connectionPath, USERNAME, HEDRON, data_name_1, data_name_2, data_name_3, data_1, data_2, data_3;

void setup() {
  // Start DHT object at digital pin 2.
  // Activate control led.
  pinMode(control, OUTPUT);
  digitalWrite(control, LOW);
  // Wait until connected.
  // It is just for assuring connection is alive.
  // This mode allows NodeMCU to connect any WiFi directly.
  // Connect NodeMCU to your WiFi.
  WiFi.begin(ssid, password);
  Serial.print("Try to connect to WiFi. Please wait! ");
  // Halt the code until connected to WiFi.
  while (WiFi.status() != WL_CONNECTED) {
  // If connection is successful, turn control led on and write WiFi SSID to serial monitor along with assigned IPAddress.
  digitalWrite(control, HIGH);
  Serial.print("Connection is successful!");
  Serial.print("Connected WiFi SSID : ");
  Serial.println("Connected IPAddress : ");

void loop() {
  // Detect the heart beat approximately in a given range point.
  // Get tenperature and humidity from DHT11.

  // Create HTTP object to make a request.
  HTTPClient http;    
  // Enter your connection path variables and define a name and a value for each data packet below - up to 6 entry.
  USERNAME = "Account_Username";
  HEDRON = "Account_Hedron";
  // You can change these names if you want.
  data_name_1 = "HeartRate";
  data_name_2 = "Temperature";
  data_name_3 = "Humidity";
  data_1 = String(count);
  data_2 = String(temperature) + "C";
  data_3 = String(humidity) + "%";
  connectionPath = "https://www.theamplituhedron.com/dashboard/IoTServices/" + USERNAME + "-" + HEDRON + ".php?dataNameFirst=" + data_name_1 + "&dataNameSecond=" + data_name_2 + "&dataNameThird=" + data_name_3 + "&data1=" + data_1 + "&data2=" + data_2 + "&data3=" + data_3;
  http.begin(connectionPath, "xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx");
  int httpCode = http.GET();           
  String payload = http.getString();    
  // End HTTP Get Request.
  // Send data packets every 2 seconds to TheAmplituhedron.


// KY-039 Heart Rate Sensor detection unit is based on the peaks generated by the sensor, and by conunting them in a defined time period, you can approximately detect the heart beat. Nevertheless, this data might not be accurate becouse of the circuit schematic of KY-039; it is just a demonstration.
void heartBeat(int Delay){
  // Read sensor after a delay to detect peaks for conunting them later.
  int firstReading = analogRead(fingerSignal);
  int secondReading = analogRead(fingerSignal);
  // Calculate the range to define peaks.
  int peak = firstReading - secondReading;
  // If there is a peak, count them to evaluate the heart beat at a given time. These values are accurate for my sensor but you might need to test yours to get data explicitly.
  if(peak >= 2){
    }else if(peak < 2 && peak >= 0){
      count = count;
      }else if(peak < 0){

  void getTemperatureandHumidity(){
      // Wait until DHT11 Temperature and Humidity Sensor became ready.
      // Get temperature and humidity. 
      humidity = dht.getHumidity();
      temperature = dht.getTemperature();


Kutluhan Aktar

Kutluhan Aktar

17 projects • 31 followers
Self-Taught Full Stack Developer | Programmer | Maker | Physics Entusiast