Body Temperature and Heart-rate Monitor

ABSTRACT

The world is depending more and more on mobile devices for its computational tasks. The mobile revolution has touched every technological facet and keeps moving at a fast pace with no sign of slowing down. Recently,  there has been an introduction of a new category of devices known as wearables. These devices are in the form of eye glasses, watches, wrist bands and even clothes but they have smart electronics devices built into them. Taking a page from the book of wearable devices, this project aims to create a medical device capable of continuous monitoring of a patients heart rate and body temperature throughout a day while allowing the patient go about his other daily business. The project is a mobile device that can be worn around the wrist or arm; having integrated electronic sensors that can read body temperature as well as heart rate. The device logs this data in its memory at regular intervals. When tethered to a computer system via USB port, real-time body temperature and heart rate can be displayed on the computer screen. Also, logged data in the device memory can be read and analyzed on the computer. This data can then be saved on the computer for future reference. The project is built around a microcontroller, LCD display, LED and LDR, push buttons as well as other electronics components. Owing to the complexity of the project, the firmware is written in ANSI C and includes a full USB software stack for USB communication device class interface.

 

Mode of Operation

block-diagram-of-the-body-temperature-and-heart-rate-monitor

Block diagram of the body temperature and heart rate monitor

 

From the above block diagram a list of the circuit modules can be compiled as follows:

  1. Power Supply
  2. LM35 Body Temperature Sensor
  3. LED /LDR Heart Rate Detector
  4. LM358 Amplifiers / Filters
  5. 16×2 Liquid Crystal Display
  6. Input Buttons
  7. PIC18f2550 Microcontroller
  8. USB Interface
  9. USB Modem

The functions of the listed modules and how they influence the overall operation of the project will be explained one at a time.

 

Power Supply

The project is battery powered. A nine volts battery supplies the required power to the circuit components of the hardware. Due to the critical power requirements of the digital circuit components used, a regulated five volts source is paramount. This is achieved by using a fixed-voltage regulator IC, LM7805. This integrated circuit provides a fixed output voltage of five volts for an input voltage range of 7 Volts – 35 Volts. Also, having a maximum current output of 1000milliampere far exceeds what the entire circuit required. The LM7805 has a quiescent current of 3mA. For a battery operated device that needs to be powered ON for at least twenty four hours, this quiescent current level is tolerable. The circuit diagram below shows the power supply section of the project.

power-supply-circuit-diagram

Power supply circuit diagram of the body temperature and heart rate monitor

 

The power supply circuit is quite simplistic. This is typical of battery operated devices. Battery B1 is a 9V alkaline type battery. It’s the power source of the entire circuit hardware. PSW1 is a switch used to power on and off the device. U5 is the LM7805 five volts output voltage regulator. Capacitor C10 filters the output of the supply against voltage transients.

 

LM35 Body temperature sensor

To accurately detect and read body temperature level of the patient with the device, the LM35 precision temperature chip was used. This temperature integrated circuit component can measure temperatures as low as -55OC and temperatures as high as +150OC. It has a resolution of 10millivolt per degree centigrade. Thus, at a room temperature of 27OC, the output pin of the LM35 IC reads 0.27 Volts. In order to effectively measure the body temperature of the patient, the surface of the LM35 must be put in contact with skin on the patient’s neck or armpit as these are areas where the human body temperature is more apparent and least influenced by ambient temperature. The output of the LM35 is analog in nature, and as such, requires conversion to a digital format. This conversion is handled by the microcontroller integrated analog to digital converter. Normally in applications as this, temperature calibration is necessary if passive temperature sensors are used; the LM35 chip has already been calibrated at the factory. The circuit connection of the LM35 is shown below.

lm35-connection-to-the-microcontroller

LM35 Connection to the MIcrocontroller

This above image is a snippet of the complete circuit diagram. It shows the LM35 connected to the 5 volts supply and its output connected to the pin2 of U2 which is the microcontroller. Pin2 of U2 is also labeled RA0/AN0. This pin is configured as an analog input to an internal ADC in the microcontroller.

 

LED  and LDR Heart Rate Detector

Circuit diagram showing connection of the LED and LDR for heart rate detection

Circuit diagram showing connection of the LED and LDR for heart rate detection

The combination of the LED and light dependent resistor (LDR) as depicted in the above circuit diagram allows for effective detection of the heart beat through the flow of blood in the body. The light emitting diode is of the high intensity type.It emits red light. Resistor R2, 220 Ohms provides the appropriate current level for the LED. High intensity light source is required to allow the light pass through the skin.The light dependent resistor detects light levels by the variation of its resistance in proportion to the amount of light incident on its surface. Since the resistance varies as light intensity on the surface of the LDR varies, we need to convert this resistance to voltage so it can easily be amplified. Resistor R1 (100K Ohms) together with the resistance of the LDR forms a potential divider. As a result, as the resistance of the LDR varies, the voltage across it varies as well. Appropriate placement of the LED and LDR is critical for the sensor to work. The LDR should be place directly under the LED. The LDR should be completely covered when a finger is placed else ambient light might saturate the LDR. The connecting wire shouldn’t be too long else the noise levels will be far higher than the heart beat signal.

 

LM358 Amplifiers / Filters

The project comprises of both analog and digital circuit elements. The LM358 dual low-power operational amplifiers is an ‘active’ operational amplifier integrated circuit. It is used in this project because of its low power operation requirement, single supply operability and its high open loop gain. The LM358 amplifies the signals coming from the LED/LDR sensor module. Amplification is necessary as the signal from the sensor is very low in amplitude and power. Since the LM358 chip comes with dual operational amplifiers in one package, a single chip was used. Both operational amplifiers where configured as non-inverting amplifiers. This is shown below.

operational-amplifier-active-filters-used-in-the-project

Circuit diagram of the operational amplifier active filters

The heart beat pulses are very low frequency pulses, being able to amplify just these pulses will reduce the effect of noise signals on the system. In the end, only low frequency signals are amplified by the LM358 amplifiers while frequencies above 3Hz are attenuated.

Capacitors C1 and C3 are coupling capacitors. They only pass pulsing signals or alternating current signals while blocking the DC components. Potentiometer RV1 allows for the tuning of the amplification level.

The output of these amplifier stages is derived from pin 7 of the LM358. This is the output of the amplifier stage U1:B. light emitting diode D3 connected through current limiting resistor R8 provides a visual indication of the detected heart beat action. This output is also connected to one of the port pins of the microcontroller. This port pin is configured as an input to an internal 8–bit counter in the microcontroller. This allows the microcontroller to keep track of the number of pulses detected.

 

16X2 Liquid Crystal Display

A sixteen character, two line liquid crystal display is used as a visual display output for the project. The LCD display is based on the industry standard Hitachi HD44780 LCD driver integrated circuit. It is a parallel LCD, thus it works faster.

The HD44780 is a dot-matrix liquid crystal display controller and driver. The device displays ASCII alphanumeric characters, Japanese kana characters, and some symbols. A single HD44780 can display up to two 28-character lines. An available extension diver makes possible addressing up to 80 characters. The HD44780U contains a 9,920 bit character-generator ROM that produces a total of 240 characters: 208 characters with a 5 × 8 dot resolution and 32 characters at a 5 × 10 dot resolution. The device is capable of storing 64 x 8-bit character data in its character generator RAM. This corresponds to eight custom characters in 5 x 8-dot resolution or four characters in 5 x 10-dot resolution.

The LCD allows for an easy to use interface and menu system to be incorporated into the project. The standby screen for instance displays time of log, body temperature, log count, heartbeat rate and heartbeat pulse indication.

standby-screen-on-the-LCD

Standby screen of the project on an LCD

LCD operates with low power and has high legibility under direct sunlight. In darkness, a backlight is required to read an LCD. Powering the Backlight increases current draw. In mains powered devices, this might not be a problem but in battery operated devices, this can cause the battery to drain quickly. To reduce the current drawn by the backlight, the backlight should only be enabled when the user performs an activity on the device and disabled when the device is left idle for a period of time. In the project, when any button is pressed, the backlight is activated. After 10 seconds of inactivity or no button press, the backlight is disabled.

 

Input Buttons

The addition of input buttons in the project completes the project as a mini computer having input, output and a CPU. In the case of the project, there are three push buttons. These push buttons have low switch bounce although switch debouncing is still implemented via software. Switch bounce or chatter is a term used to describe mechanical switches when they are pressed. To understand switch bounce, consider the illustration below:

 

Switch-bounce-absent-in-an-ideal-switch

An ideal switch has no switch bounce

The illustration shows an ideal switch. In the image on the left, the switch is open i.e. not pressed. In this case, the output A is at Vcc potential. The image on the right shows when the switch is pressed. Output A immediately goes from Vcc to ground potential the moment SW1 is pressed. Compare this with the action of a mechanical switch depicted in the illustration below:

Switch-bounce-present-in-an-ideal-switch

A real switch exhibits switch bounce

Like an ideal switch, when the mechanical switch is open, the output A is at Vcc potential. When it is closed, as shown on the image on the right, the output A oscillates before settling. This is known as switch bounce. Switch bounce, when neglected, poses a problem for digital circuits. A digital circuit can interpret the effect of switch bounce as multiple button presses. Switch bounce can be eliminated through hardware or software. Eliminating switch bounce through hardware involves connecting a capacitor and a resistor in form of an integrator across the output A. the time constant of the resistor and capacitor should be at least 10mS. If the time constant is high, the output A will be slow to respond to the switch. A monostable multivibrator of S-R flip flop can be used as well for hardware switch debouncing, but this might increase circuit complexity. When a microcontroller or microprocessor is used, it is best to implement switch debouncing through software. The software should poll the output A. once the output goes low, a delay is initiated. After the delay, which takes a few milliseconds, output A is polled again. If it is still low, then that’s a valid button press.

 

PIC18F2550 Microcontroller

At the heart of the project is the PIC18F2550 microcontroller. The PIC18F2550 microcontroller is a higher range microcontroller of the PIC family of microcontrollers. It has the following features:

  • 32KB flash program memory
  • 2048 Bytes Static RAM
  • 256 Bytes EEPROM
  • 24 I/O Pins
  • 10 channel Analog to Digital Converter
  • One 8-Bit timer and three 16-bit Timers
  • USB Serial interface engine
  • Up to 48MHz Clock

The PIC18F2550 has an impressive specification. It was designed with high level programming language like ‘C’ in mind. Thus it encourages the use of ‘C’ for its software development. Microchip technologies, the manufacturers of the PIC18F2550, have good software development tools which can be acquired easily from their website. All software coding of the project was done using Microchip MPLAB IDE (Integrated Development Environment) software. MPLAB, by default, allows for all microchip microcontrollers to be programmed using Assembly Language without any other application requirement. To program in ‘C’, a plugin application is required. In the case of the project, Microchip’s C18 was used. C18 allows higher end PIC microcontrollers (from ‘18’ series and above) to be programmed using native ‘C’ under MPLAB IDE. Using high level programming languages for the programming of the microcontroller allows for faster and flexible software development as opposed to using assembly language. In the project, The PIC18F2550 handles the conversion of the LM35 analog temperature data to digital, Pulse counting-for the calculation of the patient’s heart beat rate in BPM, Display of various information on the LCD, Checking for button pressed, and USB interfacing to a computer host. The figure below is part of the project hardware circuit diagram showing connections to the PIC18F2550 microcontroller.

Circuit diagram showing the connection of the PIC18F2550 microcontroller to the rest of the main circuit

Circuit diagram showing the connection of the PIC18F2550 Microcontroller to the rest of the main circuit

 

Pulse counting of the heart beat signal is done within a 20 seconds window. That is, an internal 8-bit timer configured as a counter, is incremented each time a pulse is received. At the start of the 20 seconds window, the counter is cleared. After 20 seconds, the value of the counter is read and multiplied by three to get a BPM value. Once the counter value is read and BPM value computed, the counter is cleared again and the cycle repeats. This means that the update rate of the patient’s BPM is 20 seconds. To achieve the 20 seconds window, interrupt is used. Each of the timers in the microcontroller can be configured to raise an interrupt whenever an overflow occurs. Data logging is also performed by the microcontroller. At an interval of one minute, the temperature data and heart rate is logged. Logged data is stored in the microcontroller’s flash memory.

 

USB Interface

The project boasts of a USB interface. This allows the user to plug in the device into a computer host and read off logged body temperature and heart rate data in the device. In addition, a real time mode is also available. This mode of operation allows temperature and heart pulses to be sent to a computer host in real-time. The computer then computes the BPM from this data and also shows the instantaneous patient’s body temperature on the computer monitor. The USB interface feature is made possible as it is integrated into the PIC18F2550 microcontroller. Once the device is plugged, the computer host detects the presence of the device and asks for driver installation. Once the driver is installed, running the computer software program of the project completes the USB communication interface operation.

 

USB MODEM

To allow for SMS notification in the project, a USB data MODEM was used. The MODEM used is the Huawei E380. Communication to the MODEM is done using ‘AT’ commands. ‘AT’ commands are a set of commands used mainly for modem control. With ‘AT’ commands, a lot of actions can be performed on a MODEM through software. Calls can be placed, SMS messages can be sent, received and displayed on a computer monitor, DATA communication is also possible.

 

 


PROJECT INFO

  • Project is Available
  • Includes documentation in PDF and DOCX formats
  • Includes Source codes, Circuit Diagram and PCB Layout
  • Project is fully operational

 


 

Interested in this project?

 

Get it Now

 

 

 

I am an Electical and Electronics Engineer / web designer and developer based in Nigeria. ProjectGICS was conceived out of my passion for Electronic Circuits and anything Computer related. I believe there are many out there that share this passion and would love to take it to greater heights. ProjectGICS is dedicated to students, designers and hobbyists in the field of Electronics and Computer who are eager to learn electronics and computer designs. ProjectGICS is all about circuit designs, programming and construction of things that can be fun, lucrative and can help solve a problem. The Electronic Components and Kits Store allows you shop items for your projects; Allowing you bring your project ideas to life without limitations. I can't wait to hear from you on the successes you have achieved through ProjectGICS.

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*