Week 4 18bce118
Week 4 18bce118
Week 4 18bce118
Submitted by
ASHIQ – 18BLC
R.VIGNESH– 18BEC
VAISHNAVI – 18BEC
GOKUL-18BLC
YESHWANT PREM-18BLC
CONNECTIONS:
• Signal pin of Pulse Rate Sensor to A0 of the Arduino
• VCC pin of Pulse Rate sensor to 5V supply of the Arduino
• GND pin to the GND of the Arduino
• VSS, K of the LCD to the GND of Arduino and the 10k potentiometer
• A and VDD of the LCD to the 5V supply of the Arduino
• VO of the LCD to the 10k potentiometer
• RS of LCD to pin 12 on the Arduino
• RW of the LCD to the GND of the Arduino
• E of the LCD to pin 11 of the Arduino
• D4, D5, D6, D7 of the LCD to 5, 4, 3, 2 pins of the Arduino
COMPONENTS:
• Arduino UNO R3
• Breadboard
• Jumper Wires
• Pulse Rate Sensor
• LCD 16 x 2 display
• 16x2 LCD Base
BLOCK DIAGRAM:
COST OF THE PROJECT (INR)
Arduino – 460/-
Breadboard – 50/-
• Microcontroller: ATmega328P
• Operating Voltage: 5V
• Input Voltage (recommended): 7-12V
• Inout Voltage (limit): 6-20V
• Digital I/O Pins: 14 (of which 6 provide PWM output)
• PWM Digital I/O Pins: 6
• Analog Input Pins: 6
• DC Current per I/O Pin: 20 mA
• DC current for 3.3V Pin: 50 mA
• Flash Memory: 32 KB (ATmega328P) of which 0.5 KB used by bootloader
• SRAM: 2 KB (ATmega328P)
• EEPROM: 1 KB (ATmega328P)
• Clock Speed: 16 MHz
• LED_BUILTIN: 13
• Length: 68.6 mm
• Width: 58.4 mm
• Weight: 25 g
Powering up the Arduino:
The Arduino Uno board can be powered via a USB connection or with an external
power supply. The power source is selected automatically. External (non-USB)
power can come either from an AC-to-DC adapter (wall-wart) or battery. The
adapter can be connected by plugging a 2.1mm center-positive plug into the
board's power jack. Leads from a battery can be inserted in the GND and Vin pin
headers of the POWER connector. The board can operate on an external supply
from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply
less than five volts and the board may become unstable. If using more than 12V,
the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts.
• Vin. The input voltage to the Arduino/Genuino board when it's using an external
power source (as opposed to 5 volts from the USB connection or other regulated
power sources). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.
• 5V.This pin outputs a regulated 5V from the regulator on the board. The board
can be supplied with power either from the DC power jack (7 - 12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via
the 5V or 3.3V pins bypasses the regulator, and can damage your board. We
don't advise it.
• 3V3. A 3.3 volt supply generated by the on-board regulator. The maximum
current draw is 50 mA.
• GND. Ground pins.
Pulse Rate Sensor:
The Pulse Sensor can be connected to Arduino, or plugged into a breadboard. The
front of the sensor is the pretty side with the Heart logo. This is the side that makes
contact with the skin. On the front you see a small round hole, which is where the
LED shines through from the back, and there is also a little square just under the
LED. The square is an ambient light sensor, exactly like the one used in
cellphones, tablets, and laptops, to adjust the screen brightness in different light
conditions. The LED shines light into the fingertip or earlobe, or other capillary
tissue, and sensor reads the light that bounces back. The back of the sensor is
where the rest of the parts are mounted.
Hardware Connections:
The Pulse Rate Sensor should be connected to Uno as follows:
• Signal(S) to A0
• VCC(+) to 5V
• GND(-) to GND
Project Board: Breadboard:
Pin Description:
Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) VCC
3 Contrast adjustment; through a variable resistor VEE
Selects command register when low; and data register Register
4
when high Select
Low to write to the register; High to read from the
5 Read/write
register
Sends data to data pins when a high to low pulse is
6 Enable
given
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC(5V) Led+
16 Backlight Ground (0V) Led-
Potentiometer(3296W-103-ND):
int pulsePin = A0; // Pulse Sensor purple wire connected to analog pin A0
int blinkPin = 13; // pin to blink led at each beat
static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino
Serial Monitor ASCII Visual Pulse
void setup()
{
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
// IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE
BOARD VOLTAGE,
// UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF
PIN
// analogReference(EXTERNAL);
lcd.begin(16, 2);
lcd.clear();
//Serial.print(BPM);
}
void interruptSetup()
{
// Initializes Timer2 to throw an interrupt every 2mS.
TCCR2A = 0x02; // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
TCCR2B = 0x06; // DON'T FORCE COMPARE, 256 PRESCALER
OCR2A = 0X7C; // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
TIMSK2 = 0x02; // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED
}
void serialOutput()
{ // Decide How To Output Serial.
if (serialVisual == true)
{
arduinoSerialMonitorVisual('-', Signal); // goes to function that makes Serial Monitor
Visualizer
}
else
{
sendDataToSerial('S', Signal); // goes to sendDataToSerial function
}
}
void serialOutputWhenBeatHappens()
{
if (serialVisual == true) // Code to Make the Serial Monitor Visualizer Work
{
Serial.print(" Heart-Beat Found "); //ASCII Art Madness
Serial.print("BPM: ");
Serial.println(BPM);
lcd.print("Heart-Beat Found ");
lcd.setCursor(1,1);
lcd.print("BPM: ");
lcd.setCursor(5,1);
lcd.print(BPM);
delay(3000);
lcd.clear();
}
else
{
sendDataToSerial('B',BPM); // send heart rate with a 'B' prefix
sendDataToSerial('Q',IBI); // send time between beats with a 'Q' prefix
}
}
if(secondBeat)
{ // if this is the second beat, if secondBeat == TRUE
secondBeat = false; // clear secondBeat flag
for(int i=0; i<=9; i++) // seed the running total to get a realisitic BPM at startup
{
rate[i] = IBI;
}
}
if (N > 2500)
{ // if 2.5 seconds go by without a beat
thresh = 512; // set thresh default
P = 512; // set P default
T = 512; // set T default
lastBeatTime = sampleCounter; // bring the lastBeatTime up to date
firstBeat = true; // set these to avoid noise
secondBeat = false; // when we get the heartbeat back
}
RESULT:
The hence developed protype measures and displays the number of heart beats per minute. The
LCD display refreshes according the delay command in the code and the detection of pulse by
the sensor.
CONCLUSION:
The prototype was developed successfully. The pulse rate sensor is highly useful. Pulse rate
sensor senses and measures the heart beat rate of the body. The heart beats per minute is an
important data that is used in various fields such as medicine, sports etc.
The pulse rate sensor being a plug and play device makes the job of measuring the heart beats
per minute a easy task with the aid of computer programming by Arduino.
Prototype: