Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

Body Temperature Monitoring System

Added to IoTplaybook or last updated on: 10/12/2020
Body Temperature Monitoring System

Story

INTRODUCTION

Body Temperature Monitoring has always been a matter of concern since medical science has grown up. For numerous reasons, body temperature of a patient needs to be monitored constantly in several diseases. Even if, constant care is taken by a human being, mistakes can occur and situation will not remain under control. The present pandemic situation seeks more attention from us, as the number of affected persons are increasing after each day and the workload on each and every medical personnel. Therefore, this project will focus on creating an automatic alarm system on two occasions, when the temperature of any particular patient 1) deteriorates at present or 2) tends to deviate from the normal specified range in near future. The main idea of the project can be used in many industrial applications also.

DEMONSTRATION

The project basically consists 3 parts:

1) Sensing Body temperature.

2) Creating a sound alarm system, when the temperature of a patient changes suddenly.

3) Turning on a LED, when the temperature of a patient is predicted to be deteriorating in near future.

Firstly, the LM35 temperature sensor needs to be placed in the patient body cavity, which will measure the actual body temperature. The data needs to be collected and stored for further analysis. Using this data, temperature readings can be predicted for the next one hour or half an hour by any Machine Learning Technique. Some threshold upper and lower limits can be set. Therefore, two things will be performed simultaneously. The predicted values as well as the current values will be checked continuously if those are staying between the threshold limits. If there is any discrepancy, alarms will be provided a positive signal.

The need for two separate alarm system is self-explanatory. The buzzer will seek immediate intervention, whereas the LED will help to take precautionary measures.

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
 
× 1

Bolt

Gravity: Analog LM35 Temperature Sensor For Arduino
DFRobot Gravity: Analog LM35 Temperature Sensor For Arduino
 
× 1

DFROBOT

LED (generic)
LED (generic)
 
× 1

Newark

SparkFun

Buzzer
Buzzer
 
× 1

Newark

Adafruit

Breadboard (generic)
Breadboard (generic)
 
× 1

Newark

SparkFun

Resistor 330 ohm
Resistor 330 ohm
 
× 1

Newark

Male/Female Jumper Wires
Male/Female Jumper Wires
 
× 1

Newark

Adafruit

Software apps and online services

Bolt IoT Android App
Bolt IoT Android App
 
   
 
Ubuntu

 

CIRCUIT CONNECTION

The schematic hardware connection is shown below.

Schematic Circuit Diagram
Schematic Circuit Diagram

The connection may be described using the reference of the given schematic diagram. The input from the LM35 Temperature sensor is taken at analog pin A0. The two outputs are provided at digital pin 1 & 4, for LED & buzzer respectively.

LM35 is a temperature sensor, which outputs the proportional analog voltage to a corresponding temperature. It has 3 pins, Vcc is connected to the 5V point of the WiFi module, GND is connected to Ground & the output point is connected at A0, which reads the voltage. The actual temperature value is given by T=r/10.24, where r is the reading of the analog pin.

The LED is connected between Digital Pin 1 & GND along with a resistor (330 Ohm- to limit the current flow) in series & the buzzer is connected between Pin 4 & GND.

OPERATION AND CONTROL

  • Configuration File

The program for this project is done in python in Ubuntu. A configuration file is created which contains the details for the WiFi module and several other details, required for the main program. The code in the file is given below.

API_KEY = "XXXX-XXXX..."        //Bolt Cloud API Key
DEVICE_ID = "BOLTXXXXX"    //Device ID of the Bolt Module
FRAME_SIZE = 10        //Frame Size of Z Score Analysis
MUL_FACTOR = 5         //Multiplication factor of Z Score Analysis
  • Z Score Analysis

Z score Analysis is a tool, which is often used for Anomaly Detection. Although, here it is used for some different purposes. Let us discuss the algorithm first. Basically, it gives us two optimum values as a range. This is values are called as upper bound and lower bound.

It takes some previous values into account and calculates its mean and variance and accordingly a distribution is created, which gives the range bounded by the two values. The Frame Size and Multiplication are dependent on the user's choice.

  • Complete Code

Complete Code
Complete Code

This code, as mentioned above does two jobs. Two pairs of preset values are given, one for comparing with present value and another for comparing with the predicted values.

  • Algorithm

Say, x is the current value and x1, x2 are the range, obtained from Z Score Analysis. Also, a1, a2 are the preset minimum and maximum values for comparison with present value and b1, b2 are the preset minimum and maximum values for comparison with prediction value. Buzzer will be on, if x<a1 or x>a2 and LED will glow if x1<b1 or x2>b2. All the preset values are to be selected by experienced professionals.

  • Possible Scenarios

Below some scenarios and their implications are mentioned.

1. LED glowing, Buzzer is off- The temperature of the patient is deteriorating slowly, so the predicted future values have gone out of specified values and hence precautionary measures are to be taken.

2. Buzzer is on, LED is off- Probability of this situation is very less, but if it happens, that implies the temperature has deteriorated suddenly, which needs immediate attention.

3. Both are on- This is also a critical situation and it seeks some amount of attention for some time, until situation is under control.

4. Both are off- This implies the temperature is under control.

Schematics

Working Flowchart

The control operation is illustrated using a block diagram.

 

Credits

Gourab Banerjee

 Gourab Banerjee

 Thanks to Bolt IoT

Hackster.io

This content is provided by our content partner Hackster.io, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at Hackster.io. It was added to IoTplaybook or last modified on 10/12/2020.