When it comes to our heart rate, of course,we don’t want it to beat too fast, and to beat too slow. But, most of the time, we don’t really think about the rhythm and pace of our heart. And if there is something unusual happening in our heart, we are really completely unaware of it.

In this tutorial we made a simple Heart Rate Monitoring System that monitors the rate of your heart and also the Beats Per Minute.

Sample Video:

Hardware Components

You can buy it all here at CreateLabz

Software Components

Application Discussion

How Pulse Sensor works

The working of the Pulse/Heart beat sensor is very simple. The sensor has two sides, on one side the LED is placed along with an ambient light sensor and on the other side we have some circuitry. This circuitry is responsible for the amplification and noise cancellation work. The LED on the front side of the sensor is placed over a vein in our human body. This can either be your Finger tip or you ear tips, but it should be placed directly on top of a vein.

Now the LED emits light which will fall on the vein directly. The veins will have blood flow inside them only when the heart is pumping, so if we monitor the flow of blood we can monitor the heart beats as well.  If the flow of blood is detected then the ambient light sensor will pick up more light since they will be reflect ted by the blood, this minor change in received light is analysed over time to determine our heart beats.


Since all the electronics on the sensor are directly exposed it is also recommended to cover the sensor with hot glue, vinyl tape or other non conductive materials. Also it is not recommended to handle these sensors with wet hands.

The sensor is covered with an electrical tape.

For more info about this sensor, visit our store.

What is an I2C 1602 LCD

The I2C 1602 LCD module is a 2 line by 16 character display interfaced to an I2C daughter board. The I2C interface only requires 2 data connections, +5 VDC and GND to operate.

I2C (Inter-Integrated Circuit)

In I2C you can connect multiple slaves to a single master and you can have multiple masters controlling single, or multiple slaves. This is really useful when you want to have more than one microcontroller logging data to a single memory card or displaying text to a single LCD.

I2C is a serial communication protocol, so data is transferred bit by bit along a single wire (the SDA line). Like SPI, I2C is synchronous, so the output of bits is synchronized to the sampling of bits by a clock signal shared between the master and the slave. The clock signal is always controlled by the master.

For more info about this I2C 1602 LCD, Visit our store.

Hardware Setup


The LCM1602 I2C is located at the back of the LCD or it is already connected at the back of the LCD.


Library included

Arduino code

Code Breakdown

In this code we begin the serial communication and set the baud rate to 9600 bps. And initialize the LCD and displays the “Heart Beat” text in the first row of the LCD and the “Sensor” text in the second row of the LCD.

This code will read the value from the analog pin 0 where the pulse sensor is connected. And it will map input voltages between 0 and 5 volts into integer values between 0 and 1023.

This the code that tells the system to start scanning when the value suddenly drops less than 70 which means that a fingertip is placed on the sensor. And set the test variable to 1, this variable acts like a switch for the other condition to start running, also variables r1, r2, r3, r4 and r5 acts like a switch for the next conditions. And displays the corresponding text on the LCD. But it has a delay of 6 seconds before it starts to scan.

After the delay, a timer is set for 15 seconds to read or scan the pulse. And change the text “please wait” on the LCD to “scanning”.

This code will now run after the test variable is equal to 1.
The range of values when a pulse is detected are between 540, 530, 520, 512, and 500. If the pulsesensor is equal to 540 and r1 equals to 1, since the r1 is already set to 1 from the previous condition. The counter variable will now increase every time the value reaches 540 which means the counter variable counts how many pulse it detected. And also sets the variables r2, r3 ,r4 and r5 to 0, to stop the other conditions from running since the 540 is the highest value we got from the sensor every time it detects a pulse. And it’s the same process for the other conditions if it equals to the highest value that we got.

This code runs after the timer runs out, the timer is set for 15 seconds. The text “scanning” on the LCD will now be change to “remove”, which means to remove your finger on the sensor. And the counter will be multiplied to 4, means the number of pulse that we got will be multiplied to 4 to get the beats per minute which will be stored in the bpm variable. Sets the rate variable to 1 to run the next condition it also acts like a switch. and the test variable equal to 1 to stop the previous condition from running. And also resets the counter to 0. And a delay of 5 seconds before moving to the next condition.

This code will run when the rate variable is equal to 1. This conditions will analyze if your heart rate is slow, normal or fast. If bpm is between 60 and 100, the normal() function is called and sets the rate variable to 0 to stop this code from running again. And a delay of 5 seconds before resetting the bpm to 0. And clearing the LCD screen leaving the “Heart Rate: ” text on the Screen. The same process will happen, if the bpm is below 60 the slow() function is called and if the bpm is greater than 100 the fast() function will be called.

This code are the functions that are used in the previous code or conditions. slow() function displays “Heart Rate: ” on the first row of the LCD and “slow” and “BPM: ” text are display on the second row of the LCD and also the bpm value next to the “BPM: ” text. And it’s same for the other functions, but for the normal() function instead of the text “slow” it displays “normal” and for the fast() function it displays “fast”.


There are so many different kinds of sensors whose purpose is to detect events or changes in it’s environment. And because of that we are able to generate new ideas in making technologies that helps us solve real life problems. For example the pulse sensor that allows us to read live heart-rate data, because of this type of sensor we are able to create a project that monitor or checks our heart rate.





Tags : 1602arduinoheart rateHeart Rate Monitoring SystemHeart Rate Pulse SensorI2C 1602 LCDI2C LCDlcdPulsePulse Sensor

Leave a Response