ESP8266 NodeMCU Smart Health & Environment Monitoring System with Pulse, Temperature and Motion Sensors
on
Get link
Facebook
X
Pinterest
Email
Other Apps
ESP8266 NodeMCU Smart Health & Environment Monitoring System | MakeMindz
MakeMindz
ESP8266 NodeMCUPulse SensorDHT11/DHT22PIR MotionIoT Health
ESP8266 NodeMCU Smart Health & Environment Monitoring System
A multi-sensor IoT platform combining heart rate, temperature, humidity, and motion detection — all transmitted wirelessly via WiFi for real-time cloud monitoring and smart automation.
🕐 45–60 min build🔧 Intermediate📡 WiFi IoT🏷️ MakeMindz.com
❤️
Heart Rate
Pulse Sensor → A0
🌡️
Temperature
DHT11/22 → D4
💧
Humidity
DHT11/22 → D4
🚶
Motion
PIR → D6
📋 Project Overview
This IoT monitoring system uses the ESP8266 NodeMCU as its central hub, collecting data from four sensor types simultaneously. The pulse sensor measures heart rate via an analog signal on pin A0. The DHT11 or DHT22 sensor provides temperature and humidity readings over a single digital wire. The PIR motion sensor detects human presence and triggers automation or alerts. An additional light-level sensor (analog or digital) rounds out the environmental picture.
All readings are processed by the ESP8266 and transmitted over WiFi to a cloud platform, MQTT broker, or local web dashboard — making this an ideal foundation for patient monitoring, smart home sensing, and IoT lab projects.
Sensors at a glance
❤️
Pulse Sensor
Optical heart rate detection via fingertip. Outputs analog voltage proportional to blood flow intensity.
A0 (Analog)
🌡️
DHT11 / DHT22
Single-wire digital sensor. DHT22 offers higher accuracy (±0.5°C vs ±2°C for DHT11).
D4 (Digital)
🚶
PIR Motion Sensor
Passive infrared sensor detects body heat movement. Output goes HIGH when motion is detected.
D6 (Digital)
💡
Light Level (LDR)
Analog light level on A0 (mux with pulse sensor) or digital threshold output on D7.
D7 (Digital DO)
🔧 Components Required
1
ESP8266 NodeMCU
v2 or v3, built-in WiFi, USB programming via CH340
1
Pulse Sensor Module
Analog output, 3.3V–5V, clip or velcro finger mount
1
DHT11 or DHT22
Temperature + humidity; DHT22 for higher accuracy
1
PIR Motion Sensor (HC-SR501)
Adjustable sensitivity and delay via trimpots
1
LDR Light Sensor Module
Photoresistor with digital comparator DO output
1
RGB LED Module
Common cathode, PWM via D3/D4/D5
—
Breadboard + Jumper Wires
Half-size breadboard, male-to-female jumpers
1
Micro USB Cable
For programming and 5V power supply to NodeMCU
⚠️Analog pin note: The ESP8266 has only one ADC pin (A0) with a 0–1V input range. Use a voltage divider (100kΩ + 220kΩ) if your pulse sensor outputs 0–3.3V. Do not connect 5V signals directly to A0.
✨ Key Features
❤️ Real-time heart rate monitoring
🌡️ Temperature + humidity sensing
🚶 PIR motion detection
💡 Ambient light level sensing
📡 WiFi IoT connectivity
🌐 Cloud dashboard ready
⚡ Low power compact design
🔁 MQTT / HTTP data push
⚡ Circuit Diagram
All sensors connect to the NodeMCU's GPIO and analog pins. The RGB LED uses PWM-capable pins D3, D4, and D5 for colour mixing.
Simplified schematic — see pin wiring table below for all exact connections
🔌 Pin Wiring Reference
Sensor / Module
Sensor Pin
NodeMCU Pin
Notes
Pulse Sensor
SIG (Signal)
A0
Analog — use voltage divider if >1V
Pulse Sensor
VCC
3V3
3.3V power
Pulse Sensor
GND
GND
Common ground
DHT11/DHT22
DATA
D4 (GPIO2)
Single-wire digital — add 10kΩ pull-up to 3V3
DHT11/DHT22
VCC
3V3
3.3V power
DHT11/DHT22
GND
GND
Common ground
PIR HC-SR501
OUT
D6 (GPIO12)
Digital HIGH = motion detected
PIR HC-SR501
VCC
VIN / 5V
PIR needs 5V — use VIN from USB power
PIR HC-SR501
GND
GND
Common ground
LDR Module
DO (Digital Out)
D7 (GPIO13)
HIGH = below light threshold
LDR Module
VCC
3V3
3.3V power
LDR Module
GND
GND
Common ground
RGB LED
R (Red)
D3 (GPIO0)
PWM — 100Ω series resistor
RGB LED
G (Green)
D5 (GPIO14)
PWM — 100Ω series resistor
RGB LED
B (Blue)
D8 (GPIO15)
PWM — 100Ω series resistor
RGB LED
GND (common)
GND
Common cathode to GND
ℹ️D4 (GPIO2) is connected to the onboard LED on most NodeMCU boards — it will blink during DHT reads. This is normal. If conflicts arise, move DHT data to D2 (GPIO4) and update the pin definition in the sketch.
🛠️ Step-by-Step Build Guide
1
Install required libraries in Arduino IDE
Open Arduino IDE → Library Manager and install: DHT sensor library by Adafruit, PulseSensorPlayground by World Famous Electronics, and ESP8266WiFi (included with the ESP8266 board package). Install the ESP8266 board package via: http://arduino.esp8266.com/stable/package_esp8266com_index.json
📦 Also install Adafruit Unified Sensor — it is a dependency of the DHT library and will cause compile errors if missing.
2
Wire the pulse sensor to A0
Connect the pulse sensor SIG pin to the NodeMCU A0 pin. Connect VCC to 3V3 and GND to the common ground rail. The A0 pin accepts 0–1V, so check your module's output range — most pulse sensor modules output 0–3.3V and require a resistor divider (100kΩ in series, 220kΩ to GND).
⚠️ Never connect a 5V signal directly to the ESP8266 A0 or GPIO pins — the chip is not 5V tolerant and will be permanently damaged.
3
Connect the DHT11 or DHT22 sensor
Connect DHT DATA pin to D4, VCC to 3V3, and GND to the common rail. Place a 10kΩ pull-up resistor between the DATA pin and 3V3. This is required for reliable single-wire communication — without it, readings will be intermittent or fail entirely.
💡 Use DHT22 if you need better accuracy (±0.5°C, ±2–5% RH). DHT11 is cheaper but less precise (±2°C, ±5% RH). The code works for both — just change DHT11 to DHT22 in the type definition.
4
Wire the PIR motion sensor (HC-SR501)
Connect PIR OUT to D6, VCC to the NodeMCU VIN pin (5V when powered via USB), and GND to the common rail. The HC-SR501 requires 5V to function — it will not trigger correctly on 3.3V. Its output is 3.3V HIGH when motion is detected, which is safe to read on D6.
💡 The HC-SR501 has two orange trimpots: one adjusts detection range (3–7m), the other sets the trigger-hold time (5–300 sec). Set both to minimum initially for fast testing.
5
Connect the LDR light sensor module
Connect the module DO (digital output) to D7, VCC to 3V3, and GND to the common rail. The onboard potentiometer sets the light threshold — when ambient light drops below the threshold, DO goes HIGH. Turn the pot clockwise to increase sensitivity.
6
Wire the RGB LED
Connect the common cathode (longest leg or GND pad) to ground. Wire the R, G, and B anodes through individual 100Ω resistors to D3, D5, and D8 respectively. These pins support PWM on the ESP8266, allowing full colour mixing via analogWrite().
⚠️ D8 (GPIO15) must be LOW at boot for the NodeMCU to start correctly. The RGB LED's blue channel being off at boot satisfies this requirement — do not add a pull-up on D8.
7
Connect all grounds to a common rail
All sensor GND pins, the RGB LED cathode, and the NodeMCU GND must share the same ground node. Use the breadboard's negative rail as the GND bus. This ensures stable analog readings and prevents floating sensor outputs.
8
Update WiFi credentials and upload
In the sketch below, update ssid and password with your WiFi network details. Select NodeMCU 1.0 (ESP-12E Module) as the board in Arduino IDE and set the upload speed to 115200. Upload via USB. Open Serial Monitor at 115200 baud to verify sensor readings and the assigned IP address.
📡 Once connected, navigate to the NodeMCU's IP address in a browser on the same network to see the live sensor dashboard.
💻 Full Source Code
This sketch reads all four sensors every 2 seconds, prints data to the Serial Monitor, and serves a simple live JSON endpoint over WiFi for dashboard integration.
✅The web server returns a JSON response at the NodeMCU's IP address — connect this to Node-RED, Blynk, Home Assistant, or any custom dashboard by fetching http://[IP]/ every few seconds.
📡 IoT Platform Integration
The ESP8266's built-in WiFi means this monitor can push data to any IoT platform without extra hardware:
🏠 Home Assistant (ESPHome)
📊 Blynk dashboard
🔁 MQTT / Node-RED
🔥 Firebase Realtime DB
📈 ThingSpeak charts
📱 Telegram bot alerts
📋 Google Sheets logging
🌐 Custom web dashboard
💡The ESPHome YAML config shown in the project (AHT10 + ADC + GPIO binary sensors + RGB LED) is directly compatible with Home Assistant — flash using the ESPHome add-on and your sensors appear as entities automatically, no extra code needed.
🖥️ Run the Simulation
Test the circuit online before building on hardware:
Comments
Post a Comment