Index
Introduction
In this tutorial, we are using a pulse sensor with ESP32 to measure heart rate.
The sensor detects blood flow changes in the fingertip using infrared light.
The ESP32 reads the analog signal and processes it to determine real-time heartbeats.
It’s commonly used in DIY health monitors and wearable fitness projects.
Required Components
- ESP32 Board
- Pulse Sensor
- Jumper wires
- Breadboard
Pinout

Circuit Diagram / Wiring
- Pulse Sensor VCC → 5V (ESP32)
- Pulse Sensor GND → GND (ESP32)
- Pulse Sensor Signal → 34 (ESP32)

Code / Programming
const int pulsePin = 34; // Pulse sensor connected to GPIO34 (ADC1)
int signal = 0; // Variable to store pulse value
void setup() {
Serial.begin(115200); // Use higher baud rate for ESP32
Serial.println("Pulse Sensor Initialized");
}
void loop() {
signal = analogRead(pulsePin); // Read analog signal from pulse sensor
Serial.println(signal); // Print pulse value to Serial Monitor
delay(10); // Small delay for stable reading
}
Explanation
- The pulse sensor detects blood flow changes in your fingertip using infrared light.
- The ESP32 reads this data via analog input (e.g., GPIO34) to monitor real-time heart activity.
- The signal can be visualized using the Serial Plotter to identify heartbeats clearly.
Troubleshooting
- If you get flat or noisy readings, ensure firm, stable finger contact and avoid movement.
- Use ADC1 pins only (GPIO32–GPIO39) for reliable analog readings on ESP32.
- If the Serial Monitor shows zero or static values, check wiring and sensor orientation.