Interface heartbeat sensor with NodeMCU


  • Interface a heartbeat/ pulse sensor with NodeMCU
  • View the waveform of a heartbeat.


  1. NodeMCU board (quantity: 1 no.)
  2. Micro USB cable A to B (quantity: 1 no.)
  3. Breadboard (quantity: 1 no.)
  4. Heartbeat/ pulse sensor (quantity: 1 no.)
  5. Jumper wire – male to male (quantity: 3 no.)
  6. Arduino IDE on your computer

Let’s begin!

A heartbeat/ pulse sensor consists of an LED and a photo-diode. The photo-diode senses the light emitted by the LED. When a finger is placed such that it covers both the LED and the photo-diode, the photo-diode measures the light from the LED through the finger.


Heartbeat/ pulse sensor 


When blood flows through a vein/artery in the finger, there is a small change in the composition of light absorbed by the finger. The output of the photo-diode will show this change and the presence of a pulse can be determined.

Pins of the heartbeat/ pulse sensor

Note that the color of the wires do not represent the pins. For example, if a wire is red, it is not necessary that it is the VCC wire.

Always check the back of the sensor for the labelled pins and then corresponding wires to their respective circuit locations. Incorrect connections can burn the sensor.


Pins on the heartbeat/ pulse sensor


When the heartbeat/ pulse sensor is connected correctly, the LED in the center should glow green.


Glowing of the LED


Interfacing heartbeat/ pulse sensor with NodeMCU


Interfacing heartbeat/ pulse sensor with NodeMCU


Final Code

To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.

There you go!

To view the graph of the sensor, navigate to Tools -> Serial Plotter.

April 22, 2020

0 responses on "Interface heartbeat sensor with NodeMCU"

Leave a Message

Your email address will not be published.


Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved