Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Md. Khairul Alam
Published © Apache-2.0

Heart Rate Counter

A heart rate counter using the Cypress Analog Coprocessor Pioneer kit.

IntermediateWork in progress3 hours2,820
Heart Rate Counter

Things used in this project

Hardware components

PSoC Analog Coprocessor Pioneer Kit
Cypress PSoC Analog Coprocessor Pioneer Kit
×1
IR receiver (generic)
×1
IR transmitter (generic)
×1
Capacitor 1 µF
Capacitor 1 µF
×1
Capacitor 25nF
×1
Capacitor 33nF
×1
Resistor 10k ohm
Resistor 10k ohm
×3
Resistor 221 ohm
Resistor 221 ohm
×1
Resistor 2M
×1
Resistor 2.5M
×1
Resistor 220 ohm
Resistor 220 ohm
×1

Software apps and online services

PSoC Creator
Cypress PSoC Creator

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematic

Pin Diagram

Code

Source Code

C/C++
/* ========================================
 *
 * Copyright Md. Khairul Alam
 * All Rights Reserved
 * UNPUBLISHED, LICENSED SOFTWARE.
 *
 * CONFIDENTIAL AND PROPRIETARY INFORMATION
 *
 * ========================================
*/
#include "project.h"
#include<stdio.h>

uint32 pulse_in_10_sec;
uint16 heart_beat;
char str[10];

CY_ISR(InterruptHandler)
{
    /* Check interrupt source */
   	if (Timer_INTR_MASK_CC_MATCH == Timer_GetInterruptSourceMasked())
    {
        /* Clear interrupt and then process Capture interrupt */
        Timer_ClearInterrupt(Timer_INTR_MASK_CC_MATCH);

        /* Change color (switch active LED) between blue and green upon every trigger of capture interrupt */
        pulse_in_10_sec = Timer_ct_ReadCapture();
    }
  
}

int main(void)
{
    CyGlobalIntEnable; /* Enable global interrupts. */
    Opamp_LPF1_Start();
    Opamp_LPF2_Start();
    Timer_Start();
    Timer_ct_Start();
    Comp_1_Start();
    UART_Start();//Start the UART component.
    PVref_1_Start();
    PVref_1_Enable();
    Pulse_Count_StartEx(InterruptHandler);
    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

    for(;;)
    {
        /* Place your application code here. */
        heart_beat = pulse_in_10_sec * 6;
        UART_UartPutString("Heart Beat: \r\n");
        sprintf(str,"%u",heart_beat); //Convert to String value
        UART_UartPutString(str); // Send convrted value.
        /* each 10s */
        CyDelay(10000u);
    }
}

/* [] END OF FILE */

Credits

Md. Khairul Alam

Md. Khairul Alam

68 projects • 587 followers
Developer, Maker & Hardware Hacker. Currently working as a faculty at the University of Asia Pacific, Dhaka, Bangladesh.

Comments