Sensor

โค๏ธ Finger Detection Heartbeat Module

๐Ÿ“Œ Description

The finger detection heartbeat module is a sensor that measures tiny changes in blood flow when you place your finger on it. These changes are converted into an analog voltage signal that the microcontroller can read. By analyzing the signal, you can detect heartbeats.

๐ŸŽฏ Use

In our projects, the heartbeat sensor is used to:

  • Measure heart rate (beats per minute).
  • Monitor health conditions in simple experiments.
  • Demonstrate how sensors can detect biological signals.

๐Ÿ‘‰ Think of the heartbeat sensor as the robotโ€™s stethoscope โ€” it listens to your pulse through your finger.

Module parametersย Click here to return to the table of contents

Pin name Description
G GND (Power Input Negative)
V VCC (Power Input Cathode)
A Analog signal pins
  • Supply voltage: 3.3V/5V
  • Connection: 2.54mm pin header
  • Installation method: double screw fixing

๐Ÿ–ฅ๏ธ Code Explanation

import machine
import time

adc36 = machine.ADC(machine.Pin(36))          # Heartbeat sensor connected to pin 36
adc36.atten(machine.ADC.ATTN_11DB)            # Set attenuation for wider voltage range
adc36.width(machine.ADC.WIDTH_12BIT)          # 12-bit resolution (0โ€“4095)

while True:
    sensor_value = adc36.read()               # Read raw sensor value
    voltage_ = (sensor_value / 4095) * 3300   # Convert to millivolts (mV)
    print('Analog Voltage: ', voltage_, 'mV') # Print voltage
    time.sleep(0.01)                          # Wait 10 ms

Step by Step

  1. adc36 = machine.ADC(machine.Pin(36)) โ†’ Reads the analog signal from the heartbeat sensor.
  2. atten and width โ†’ Configure the ADC for accurate readings (0โ€“4095).
  3. while True: โ†’ Loop that repeats forever.
  4. sensor_value = adc36.read() โ†’ Reads the raw sensor value.
  5. voltage_ = (sensor_value / 4095) * 3300 โ†’ Converts the raw value into millivolts.
  6. print(...) โ†’ Displays the voltage reading.
  7. time.sleep(0.01) โ†’ Adds a short delay (10 ms) between readings.

๐Ÿ‘‰ Together, this program prints the heartbeat sensorโ€™s voltage signal in real time.


โœ… Conclusion of the Test

  • If placing your finger on the sensor produces changing voltage values, the program is working correctly.
  • This test shows how the robot can read biological signals and convert them into data.
  • Later, the voltage signal can be processed to calculate beats per minute (BPM) and display heart rate on an LCD or OLED screen.
On this page