Wireless Heart Rate Monitoring System Using PIC Microcontroller
- Sanskruti Ashtikar
- Nov 15, 2024
- 4 min read
Updated: Dec 1, 2024
Introduction
In the modern healthcare landscape, remote monitoring systems have become invaluable for patient care. A wireless heart rate monitoring system is one such application, allowing for real-time tracking of a patient's heart rate. By using a PIC microcontroller in conjunction with a heart rate sensor and wireless communication modules, you can build a system that monitors and transmits heart rate data to a remote location. This article will guide you through the design, implementation, and coding aspects of creating a wireless heart rate monitoring system using a PIC microcontroller.
Components Required
PIC Microcontroller (e.g., PIC16F877A)
Heart Rate Sensor (e.g., Pulse Sensor or IR-based Heart Rate Sensor)
RF Module (e.g., nRF24L01 or HC-12)
LCD Display (16x2)
Power Supply (5V and 3.3V)
Crystal Oscillator (20 MHz)
Capacitors (22pF, 100µF)
Resistors (1kΩ, 10kΩ)
Connecting Wires
PCB or Breadboard for Prototyping
System Overview
The wireless heart rate monitoring system consists of a heart rate sensor to measure the pulse, a PIC microcontroller to process the sensor data, and a wireless module to transmit the data to a remote receiver. The system can display the heart rate locally on an LCD screen and wirelessly send it to another microcontroller or a computer for remote monitoring.
Block Diagram
Heart Rate Sensor: Measures the pulse rate and outputs an analog signal.
PIC Microcontroller: Processes the sensor data and interfaces with the wireless module.
Wireless Module (e.g., nRF24L01): Transmits the heart rate data wirelessly.
LCD Display: Shows the heart rate in beats per minute (BPM).
Circuit Diagram
[Insert a simplified circuit diagram here, showing connections between the PIC microcontroller, heart rate sensor, LCD, and wireless module.]
Working Principle
Heart Rate Sensor: The heart rate sensor detects the heartbeat through changes in blood flow. It typically outputs an analog signal, where each pulse generates a corresponding voltage signal.
Signal Processing: The analog output from the heart rate sensor is fed into the PIC microcontroller's analog-to-digital converter (ADC) channel. The microcontroller processes this signal to calculate the heart rate in BPM.
Display and Transmission:
LCD Display: The calculated heart rate is displayed on an LCD in real-time.
Wireless Module: The processed heart rate data is transmitted wirelessly to a remote receiver for monitoring.
Software Implementation
Initializing the Microcontroller:
Configure the oscillator and ADC.
Set up the UART for wireless communication (if using a UART-based module).
Initialize the LCD for displaying data.
Reading Heart Rate Data:
Read the analog signal from the heart rate sensor using the ADC.
Process the signal to determine the heart rate in BPM.
Displaying and Transmitting Data:
Display the heart rate on the LCD.
Transmit the heart rate data via the wireless module to a remote receiver.
Sample Code
#include <xc.h>#include "lcd.h"#include <string.h>#define _XTAL_FREQ 20000000 // Define crystal frequency// Configuration bits#pragma config FOSC = HS // High-speed oscillator#pragma config WDTE = OFF // Watchdog Timer Disablevoid ADC_Init(void) { ADCON0 = 0x41; // ADC enabled, Channel 0 selected ADCON1 = 0x80; // Right justified result}unsigned int ADC_Read(unsigned char channel) { ADCON0 &= 0xC5; // Clear the channel selection bits ADCON0 |= channel<<3; // Select the ADC channel __delay_ms(2); // Acquisition time GO_nDONE = 1; // Start conversion while(GO_nDONE); // Wait for the conversion to complete return ((ADRESH<<8) + ADRESL); // Return the result}void UART_Init(void) { TRISC6 = 0; // TX Pin TRISC7 = 1; // RX Pin SPBRG = 31; // Baud rate 9600 for 20MHz TXEN = 1; // Enable transmitter SPEN = 1; // Enable serial port CREN = 1; // Enable continuous reception}void UART_Write(char data) { while (!TXIF); // Wait until the transmitter is ready TXREG = data; // Transmit data}void send_heart_rate(unsigned int rate) { char buffer[10]; sprintf(buffer, "%d", rate); // Convert integer to string for(int i = 0; i < strlen(buffer); i++) { UART_Write(buffer[i]); // Send each character } UART_Write('\n'); // New line after sending the data}void main(void) { ADC_Init(); // Initialize ADC UART_Init(); // Initialize UART lcd_init(); // Initialize LCD unsigned int heartRate; while (1) { heartRate = ADC_Read(0); // Read the analog signal from the sensor heartRate = (heartRate * 60) / 1023; // Convert to BPM (example conversion) lcd_clear(); lcd_goto(1, 1); lcd_puts("Heart Rate:"); lcd_goto(2, 1); lcd_put_num(heartRate); // Display the heart rate send_heart_rate(heartRate); // Transmit the heart rate wirelessly __delay_ms(1000); // Update every second }}Explanation of the Code
ADC Initialization and Reading: Configures the ADC module of the PIC microcontroller to read the analog signal from the heart rate sensor. The heart rate is calculated by converting the ADC result to a BPM value.
UART Communication: Used to transmit the heart rate data wirelessly using a UART-based RF module.
LCD Display: The heart rate is displayed on the LCD for local monitoring.
Conclusion
A wireless heart rate monitoring system using a PIC microcontroller is a practical and effective way to monitor heart rate remotely. By understanding the ADC, UART communication, and wireless transmission, you can build a system that provides real-time health monitoring. This project serves as a foundation for more complex biomedical monitoring systems and can be expanded with additional features like logging, alerts, or integration with mobile applications.
Further Enhancements
Data Logging: Store heart rate data on an SD card for historical analysis.
Mobile Integration: Send data to a smartphone via Bluetooth for real-time monitoring on a mobile app.
Alert System: Integrate an alert mechanism to notify healthcare providers if the heart rate exceeds normal thresholds.
This project not only demonstrates the use of PIC microcontrollers in healthcare applications but also provides a hands-on approach to building a functional wireless monitoring system.
Want us to guide you through your project or make the project for you ?
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects






Comments