You are on page 1of 59

MICROCONTROLLER BASED REMOTE

PATIENT MONITORING SYSTEM

by

Pallavi Baniya (1206831060)

Parth Shankar (1206832040)

Shreya Dhaka (1206831302)

Department of Electronics & Communication Engineering


Meerut Institute of Engineering & Technology,
Meerut, U.P.(India)
May, 2016
MICROCONTROLLER BASED REMOTE
PATIENT MONITORING SYSTEM

by

Pallavi Baniya (1206831060)

Parth Shankar (1206832040)

Shreya Dhaka (1206831302)

Submitted to the Department of Electronics & Communication Engineering

in partial fulfilment of the requirements for the degree of

Bachelor of Technology

in

Electronics & Communication

Department of Electronics & Communication Engineering


Meerut Institute of Engineering & Technology,
Meerut, U.P.(India)
May, 2016

ii
DECLARATION

We hereby declare that this submission is our own work and that, to the best of our
knowledge and belief, it contains no material previously published or written by another
person nor material which to a substantial extent has been accepted for the award of any
other degree or diploma of the university or other institute of higher learning except where
due acknowledgment has been made in the text.

Signature: Signature:

Name : Pallavi Baniya Name : Shreya Dhaka

Roll No. : 1206831060 Roll No. : 1206831302

Date : Date :

Signature:

Name : Parth Shankar

Roll No. : 1206832040

Date :

iii
CERTIFICATE

This is to certify that the Project Report entitled “Microcontroller Based Remote
Patient Monitoring System” which is submitted by Pallavi Baniya (1206831060),
Parth Shankar (1206832040) and Shreya Dhaka (1206831302), in partial
fulfilment of the requirements for the award of degree B. Tech in Department of
Electronics & Communication Engineering of Dr. A.P.J Abdul Kalam Technical
University, is record of the candidate own work carried out by him under my/our
supervision. The matter embodied in this thesis is original and has not been submitted
for the award of any other degree.

Date: ( Mr. Priyank Sharma )


Assistant Professor

iv
ACKNOWLEDGMENT

It gives us a great sense of pleasure to present the report of the B.Tech Project
undertaken during B.Tech Final Year. We owe special debt of gratitude to Dr. D.K.
Sharma, Prof. & Head and Mr. Priyank Sharma, Assistant Professor from the
Department of Electronics & Communication Engineering, Meerut Institute of
Engineering & Technology, Meerut for their constant support and guidance
throughout the course of our work. Their sincerity, thoroughness and perseverance
have been a constant source of inspiration for us. It is their minimum efforts that our
endeavours have seen light of the day.
We also would like to take this opportunity to acknowledge the contribution of all
faculty members of the department for their kind assistance and cooperation during
the development of our project. Last but not the least, we acknowledge our friends for
their contribution in the completion of the project.

v
ABSTRACT

Proper monitoring of patients is very critical as even the slightest of mistake or delay
can lead to catastrophic results. Managing a number of patients and monitoring them
is a cumbersome task. For this a simple monitoring system that wirelessly informs the
caretakers of the criticality of the patient’s health is quite useful. Although a number
of sophisticated monitoring equipments may be available in the market , something
as simple and generic has its own advantages.

This project brings forward the idea of monitoring of patients on the basis of body
parameters like heartbeat and body temperature and informing the caretakers
wirelessly .The medicine reminder system involved in this project is quite helpful
when it comes to patients who forget to take their medicines or for caretakers to get
reminded of the medicines at the exact time.

vi
TABLE OF CONTENTS

DECLARATION .............................................................................................iii
CERTIFICATE.................................................................................................iv
ACKNOWLEDGEMENT.................................................................................v
ABSTRACT .....................................................................................................vi
LIST OF TABLES.............................................................................................ix
LIST OF FIGURES............................................................................................x
LIST OF SYMBOLS ........................................................................................xi
LIST OF ABBREVIATIONS ...................................................................…..xii
CHAPTER 1 (INTRODUCTION)……….........................................................1
1.1 Introduction............................................................................................1
CHAPTER 2 (TECHNICAL BACKGROUND)................................................2
2.1 Working Principle..................................................................................2
2.2 Project Model.........................................................................................3
2.3 Components...........................................................................................4
2.3.1 Sensors.....................................……………………………...4
2.3.1.1 Heartbeat Sensor.........................................................4
2.3.1.2 Temperature Sensor.....................................................5
2.3.2 Microcontrollers..………………………………………….....6
2.3.2.1 ATmega 16..................................................................6
2.3.2.2 BeyonDuino................................................................7
2.3.3 MyFi.............…………………………………………….......9
2.3.4 RF Module...................................…………………….........10
2.3.4.1 Transmitter and Receiver..........................................10
2.3.4.2 HT12E.......................................................................10
2.3.4.3 HT12D.......................................................................12
2.3.5 Voltage Regulator....................………………….................12
2.3.6 Liquid Crystal Display..……………………………………13
2.3.7 Buzzer...................…………………………………………15
2.3.8 Momentary Push Button Switch..........................................16

vii
CHAPTER 3 (PROJECT DEVELOPMENT)...............................................17
3.1 Interfacing..……………………………………………………….....17
3.1.1 Transmitter side......................................................................17
3.1.2 Receiver side..........................................................................18
3.2 Final PCB Design………………………………………………........19
3.3 System Cost……………………………………………………….... 20
3.4 Requirements………………………………………………………...21
3.4.1 Software Requirements………………………………........ 21
3.4.2 Hardware Requirements…………………………………....21
3.5 Advantages...........................................................................................21
3.6 Key Features.........................................................................................21
CHAPTER 5 (PROGRAM CODING)………………………………………. 22
5.1 Monitoring Side……………………………………………………....22
5.2 Medicine Reminder System (Arduino Sketch).....................................25
CHAPTER 5 (CONCLUSION, LIMITATIONS & SCOPE OF
IMPROVEMENT)……………………………………………………......28
5.1 Conclusion……………………………………………………….........28
5.2 Limitations……………………………………………………….........28
5.3 Scope of Improvement…………………………………………...........28
APPENDIX A ...................................................................................................29
APPENDIX B ...................................................................................................33
APPENDIX C ...................................................................................................37
APPENDIX D ...................................................................................................43
APPENDIX E....................................................................................................45
REFERENCES... ..............................................................................................47

viii
LIST OF TABLES

Table No. Name Page No.


2.1 Pin Description(LM7805) 13
2.2 Pin Description(LCD) 25
3.1 System Cost 20
B.1 Features of ATmega 328P 34
C.1 Pin Description(FT23RL) 38
E.1 Details of Arduino IDE 46

ix
LIST OF FIGURES

Figure No. Name Page No.


2.1 Block Diagram of Project 3
2.2 Heart Beat Sensor 4
2.3 LM35sensor 5
2.4 ATmega 16 IC 6
2.5 BeyonDuino 8
2.6 MyFi 9
2.7 RF Transmitter and Receiver 10
2.8 HT12E IC 11
2.9 HT12E IC Pin Diagram 11
2.10 HT12D IC 12
2.11 HT12D Pin Diagram 12
2.12 7805 Pin Diagram 13
2.13 LCD Pin Diagram 14
2.14 Buzzer 16
2.15 Momentary Push Button Switch 16
3.1 Transmitter Schematic 17
3.2 Receiver Schematic 18
3.3 Final PCB 19
A.1 Pin Diagram ATmega16 29
A.2 Block Diagram ATmega 16 30
B.1 Pin Diagram ATmega 328P 33
B.2 Block Diagram 328P 34
B.3 ATmega 328P- Arduino Pin mapping 36
C.1 Schematic Layout of FT232RL 37
D.1 CodeVisionAVR window screenshot 44
E.1 Arduino IDE 46

x
LIST OF SYMBOLS

1. V Volts
2. kΩ Kilo ohm
3. A Ampere
4. Ms Millisecond
5. Tx Transmitter
6. kB Kilo Bytes
7. Hz Hertz
8. MHz Mega Hertz
9. I Current
10. C Capacitance
11. Rx Receiver

xi
LIST OF ABBREVIATIONS

1. RF Radio Frequency
2. LED Light Emitting Diode
3. PCB Printed Circuit Board
4. LCD Liquid Crystal Display
5. RTC Real Time Clock
6. FTDI Future Technology Devices International
7. ADC Analog to Digital Convertor
8. IDE Integrated Development Environment
9. DIP Dual In Package
10. USART Universal Synchronous Asynchronous
Receiver Transmitter
11. SPI Serial Peripheral Interface
12. GND Ground

xii
CHAPTER 1

INTRODUCTION
Patient monitoring and management in critical care environments such as the ICU’s ,
SICU’s and ANCU’s involve estimating the status of the patient and reacting to
events that may be life threatening. It is impossible to keep a tab on every patient
throughout the day. New solutions are needed in this field to help the doctors and the
nursing staff to monitor the patients.
The project is basically a patient monitoring and reminder system. It consists
of two modules. One is which monitors the patient’s heartbeats and body temperature
and sends the information to the caretaker wirelessly through radio frequency
transmission.
A critical element is the medicine administration and monitoring as most of
the patients forget to take the appropriate prescribed medication at the required time.
There are occasions when patients remember to take medicines at the stipulated time
but forget which pill has to be taken at that particular time. This poses a big problem
as it affects the dosage quantum required for the patient that results in not yielding the
right recovery result. It is difficult for doctors/paramedics/attendants to monitor
patients round the clock. In order to avoid these problems, we have implemented the
second module which reminds the patient and the nurses of the medicines to be taken.
This has been achieved by the patient medicine reminder system. This system is
driven by an embedded program that inputs predefined parameters which is processed
based on the input variables entered via a user interface device such as the PC. All the
entries made by on the PC is concurrently and simultaneously displayed on the LCD
panel of the device. The logic for the processing is built into the embedded program to
initiate the alert through an audio alarm. Not only does it have an alarm system, but
also an LCD display which displays which medicine is to be taken at the reminder
time.

1
CHAPTER 2

TECHNICAL BACKGROUND

2.1 WORKING PRINCIPLE

The system continuously monitors the patient and informs the caretaker from time to
time about the patient regarding the body temperature and heartbeat. When these
parameters reach a critical value whether high or low, the systems detect it and
informs the nurse station wirelessly through RF transmission and alarms the caretaker
through a display and an audio message. Once the caretaker reaches the patient he/she
can switch of the alarm by pressing a switch thus indicating that the patient is being
monitored.

This is done using a few switches and the list of medicines to be administered is
entered through the computer. This data will be stored in the EEPROM by the
microcontroller. The microcontroller continuously reads the time from the RTC
.When the timings read from the RTC equals the timings stored in the EEPROM, the
system alerts the buzzer and displays the list of medicines to be taken at that particular
prescribed time on the LCD. Thus, the patient can listen to the audio indication and
see the name of the medicines on the LCD and take them on time.

2
2.2 PROJECT MODEL

The project model consists of three blocks basically:

1. Patient Station ( Transmitter side)


2. Nurse Station (Receiver side)
3. Medicine Reminder System

The Patient Station receives input from the sensors process them and transmit the
necessary signals over radio frequency. The Nurse Station receives the signals and
shows the warning messages on the LCD and triggers the buzzer accordingly. The
instantaneous values of the parameters are displayed on the LCD.

Figure 2.1 Block Diagram of Project

3
2.3 COMPONENTS
2.3.1 Sensors

2.3.1.1 Heartbeat Sensor (SEN-11574)

Description: Heart rate data can be really useful when designing a patient monitoring
system, exercise routine, studying one’s activity or anxiety levels. The problem is that
heart rate can be difficult to measure.

The Pulse Sensor Amped is a plug-and-play heart-rate sensor for microcontrollers. It


can be used by students, artists, athletes, makers, and game & mobile developers who
want to easily incorporate live heart-rate data into their projects. It essentially
combines a simple optical heart rate sensor with amplification and noise cancellation
circuitry making it fast and easy to get reliable pulse readings. Also, it sips power
with just 4mA current draw at 5V so it’s great for mobile applications.

Simply clip the Pulse Sensor to your earlobe or finger tip and plug it into your 3 or 5
Volt Arduino or other microcontroller and you’re ready to read heart rate! The 24"
cable on the Pulse Sensor is terminated with standard male headers so there’s no
soldering required.

Dimensions: 0.625" Diameter and 0.125" Thick

Fig. 2.2 Heartbeat Sensor

4
2.3.1.2 Temperature Sensor (LM35)

LM35 is a precision IC temperature sensor with its output proportional to the


temperature (in o C). The sensor circuitry is sealed and therefore it is not subjected to
oxidation and other processes. With LM35, temperature can be measured more
accurately than with a thermistor . It also possess low self heating and does not cause
more than 0.1 o C temperature rise in still air.

The operating temperature range is from -55°C to 150°C. The output voltage varies
by 10mV in response to every o C rise/fall in ambient temperature, i.e., its scale factor
is 0.01V/ o C.

Figure 2.3 LM 35 Sensor and Pin Diagram

5
2.3.2 Microcontrollers

2.3.2.1 ATmega16

ATmega16 is an 8-bit high performance microcontroller of Atmel’s Mega AVR


family with low power consumption. Atmega16 is based on enhanced RISC (Reduced
Instruction Set Computing, architecture with 131 powerful instructions. Most of the
instructions execute in one machine cycle. Atmega16 can work on a maximum
frequency of 16MHz.

ATmega16 has 16 KB programmable flash memory, static RAM of 1 KB and


EEPROM of 512 Bytes. The endurance cycle of flash memory and EEPROM is
10,000 and 100,000, respectively.

ATmega16 is a 40 pin microcontroller. There are 32 I/O (input/output) lines


which are divided into four 8-bit ports designated as PORTA, PORTB, PORTC and
PORTD.

ATmega16 has various in-built peripherals like USART, ADC, Analog


Comparator, SPI, JTAG etc. Each I/O pin has an alternative task related to in-built
peripherals.

Figure 1.3 ATmega16 IC

6
2.3.2.2 BeyonDuino

The Arduino has become a popular and user-friendly development platform for
makers, electronics enthusiasts and students. But, the Arduino board, by itself, is
extremely limiting in terms of the peripheral devices available on board. Even though
the capabilities of the Arduino can be expanded using Shields, it adds restrictions in
terms of form factor as well as the ability and compatibility in connecting multiple
shields. Another way to interface peripherals to the Arduino can be through simple
bread-boarding, but that is a highly error prone and unscalable thing to do.
Not just that, one of the biggest highlights of the BeyonDuino ecosystem is
that it charts out very clearly the basic concepts of building a microcontroller system
starting from chip up by elaborating the concept of interfacing between various
peripherals, in hardware. In contrast, most of the Arduino based systems tend to
eliminate this aspect by presenting Arduino in a seemingly easy to use wrapper that
inherently takes care of all the low level nitty-gritty like reset, boot loading interface,
etc. While the later approach is many times beneficial and can result is a small ramp
up time for the user, it does not help when one has to design independent systems.

Figure 2.4 BeyonDuino

7
The development of the BeyonDuino was inspired by these issues and has resulted in
an Arduino compatible platform that is equipped with a carefully selected set of
peripheral devices that not only enhance the learning experience for beginners of the
Arduino ecosystem but also allow more experienced users to explore various
interesting projects ideas.

BeyonDuino is an Arduino based DIY-friendly hardware platform with a multitude of


on-board peripherals, and can be used to perform experiments starting the beginner
level and ‘beyond’. The BeyonDuino has all the essential elements of a standalone
microcontroller platform. After being programmed using an external USB-to-Serial
converter, the board only requires a USB based power supply to operate. The entire
ecosystem is designed as a single sided PCB which can easily be fabricated by DIY
enthusiasts using the inexpensive Toner Transfer Method.

A distinctive feature of the BeyonDuino is the assortment of peripherals available on


board. Unlike traditional Arduino boards, which only have a single user LED on
board, the BeyonDuino is equipped with various digital and analog peripherals. The
selection of on board peripherals is intended to enhance the understanding of the
capabilities of the ATMega328 microcontroller without the need to setup elaborate
connections on a breadboard or to use a variety of shields. Each of the on board
peripherals aids the user in understanding how other devices of a similar nature can be
interfaced with the Arduino.

2.3.3 MyFi (FTDI USB to serial bridge)

Figure 2.5 MyFi

8
MyFi is a breakout board for the FTDI FT232RL which is a USB to Serial bridge IC.
It can be used to program the target board as well as communicate by UART for
Serial Monitor, in case of Arduino like boards. It has four signal lines and two lines
for providing power supply (VCC and GND). It works on two voltage logic levels
particularly +3.3 V and +5V. The four signal lines are RX, TX, RTS/DTR and CTS.
The RTS and DTR are on the same line. The DTR pin is used to auto-reset the target
board while uploading sketch/HEX code. RTS pin is an output and CTS pin is an
input. RTS pin should be connected to the CTS pin of the target device. Similarly,
CTS should be connected to RTS of the target. It has three LEDs on the breakout
board namely TX, RX and Power-on LED that blinks when serial data is sent or
received.

2.3 RF Module

2.3.1 Transmitter and Receiver

Figure 2.6 RF Transmitter and Receiver

An RF module (radio frequency module) is a (usually) small electronic device used to


transmit and/or receive radio signals between two devices. In an embedded system it
is often desirable to communicate with another device wirelessly. In this project they
are working on a frequency of 434 MHz and have a range up to 100 m.

9
2.3.2 Encoder IC (HT12E)

The HT 12E Encoder ICs are series of CMOS LSIs for Remote Control system
applications. They are capable of Encoding 12 bit of information which consists of N
address bits and 12-N data bits. Each address/data input is externally ternary
programmable if bonded out.

Figure 2.7 HT12E IC

Figure 2.8 HT12E Pin Diagram

10
2.3.3 Decoder IC(HT12D)

The HT 12D ICs are series of CMOS LSIs for remote control system applications.
This ICs are paired with each other. For proper operation a pair of encoder/decoder
with the same number of address and data format should be selected. The Decoder
receive the serial address and data from its corresponding decoder, transmitted by a
carrier using an RF transmission medium and gives output to the output pins after
processing the data.

Figure 2.9 HT12D IC Figure 2.10 HT12D Pin Diagram

2.4 Voltage Regulator IC (LM7805)

7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed

linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and

would not give the fixed voltage output. The voltage regulator IC maintains the output

voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is

designed to provide. 7805 provides +5V regulated power supply. Capacitors of

suitable values can be connected at input and output pins depending upon the

respective voltage levels.

11
Pin Diagram:

Figure 2.11 7805 Pin Diagram

Pin Description:
Table 2.1

\
Pin No Function Name

1 Input voltage (5V-18V) Input


2 Ground (0V) Ground
3 Regulated output; 5V (4.8V-5.2V) Output

2.5 Liquid Crystal Display

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide
range of applications. A 16x2 LCD display is very basic module and is very
commonly used in various devices and circuits. These modules are preferred over
seven segments and other multi segment LEDs. The reasons being: LCDs are
economical; easily programmable; have no limitation of displaying special & even
custom characters (unlike in seven segments), animations and so on.

12
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In
this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers,
namely, Command and Data.

The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data
register stores the data to be displayed on the LCD. The data is the ASCII value of the
character to be displayed on the LCD.

Pin Diagram:

Figure 2.12 LCD Pin Diagram

13
Pin Description:
Table No. 2.2

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
4 Selects command register when low; and data register when Register Select
high
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
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-

2.6 Buzzer

This section includes a buzzer as well as a resistance to limit the current. The buzzer
operates in the range of 20-25mA. The voltage given to the buzzer is 5v and also the
buzzer can operate between 3V-24V. The resistance used is calculated by using the
ohm’s law.

Buzzer is an indicating device which is used for checking the software condition and
also used for indicating any specific condition.

Different types of buzzer used are mechanical, electromechanical and piezoelectric.

14
Figure 2.13 Buzzer

2.7 Momentary Push Button Switch


The momentary push-button switch is a type of biased switch. The most common type
is a "push-to-make" (or normally-open or NO) switch, which makes contact when the
button is pressed and breaks when the button is released. Each key of a computer
keyboard, for example, is a normally-open "push-to-make" switch. A "push-to-break"
(or normally-closed or NC) switch, on the other hand, breaks contact when the button
is pressed and makes contact when it is released. A simple momentary push button is
shown in Fig. 3.6.
An example of a push-to-break switch is a button used to release a door held closed
by an electromagnet. The interior lamp of a household refrigerator is controlled by a
switch that is held open when the door is closed.

Fig. 2.14: Momentary Push Button Switch

15
CHAPTER 3

PROJECT DEVELOPMENT

3.1 INTERFACING

3.1.1 TRANSMITTER SIDE

Figure 3.1 Transmitter Schematic

16
3.1.2 RECEIVER SIDE

Figure 3.2 Receiver Schematic

17
3.2 FINAL PCB DESIGN

18
3.3 SYSTEM COST

COMPONENTS COST(Rs.)

Arduino Uno (ATmega 150


328P)
MyFi 200

ATmega 16 50

RF module 400

Buzzer 10

PCB Cost 50

Resistors, Transistors 10
& LEDs
16 MHz Crystal 20
Oscillator
Momentary Push 10
Button
7805 Voltage Regulator 10

Sensors 250
LCDs 200

TOTAL COST 1360

19
3.4 REQUIREMENTS

3.4.1 Software Requirements :


1. Assembler of Atmega microcontroller series
2. Arduino IDE

3.4.2 Hardware Requirements :


1. Microcontroller Atmega16
2. Arduino Uno board
3. LM7805 Regulator
4. RF Transmitter and Receiver
5. RF Encoder(HT12E) and Decoder(HT12D) ICs
6. Resistors, Variable Resistors
7. LEDs
8. Heartbeat sensor and Temperature sensor
9. Transistors
10. Connectors
11. LCDs (16X2)
12. Buzzers
13. Switches
14. 9V Battery Source

3.5 ADVANTAGES

Some of the advantages of the project developed are:


1. Efficient patient monitoring and medicine administration
2. Critical health parameter warning ( audio and display)
3. Useful in various places like old age homes, care units etc.

3.6 KEY FEATURES

Some of the key features of this project work are:


1. Easily configurable
2. Multiple uses and moderate accuracy
3. Low height and recess profile
4. Simple installation

20
CHAPTER 4

PROGRAM CODING

4.1 Monitoring System:

#include <mega16.h>
#include <delay.h>

// Alphanumeric LCD functions


#include <alcd.h>

// Declare your global variables here


int i;
void main(void)
{
// Declare your local variables here

// Input/Output Ports initialization


// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In
Func1=In Func0=In
// State7=T State6=T State5=P State4=P State3=T State2=T
State1=T State0=P
PORTA=0x31;
DDRA=0x00;

// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In
Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T
State1=T State0=T
PORTB=0x00;
DDRB=0x00;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In
Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T
State1=T State0=T
PORTC=0x00;
DDRC=0x00;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In
Func1=In Func0=Out
// State7=T State6=T State5=T State4=T State3=T State2=T
State1=T State0=0
PORTD=0x00;

21
DDRD=0x01;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=0xFF
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=0xFFFF
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=0xFF
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;

// External Interrupt(s) initialization


// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization


TIMSK=0x00;

22
// USART initialization
// USART disabled
UCSRB=0x00;

// Analog Comparator initialization


// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

// ADC initialization
// ADC disabled
ADCSRA=0x00;

// SPI initialization
// SPI disabled
SPCR=0x00;

// TWI initialization
// TWI disabled
TWCR=0x00;

// Alphanumeric LCD initialization


// Connections are specified in the
// Project|Configure|C Compiler|Libraries|Alphanumeric LCD
menu:
// RS - PORTB Bit 0
// RD - PORTB Bit 1
// EN - PORTB Bit 2
// D4 - PORTB Bit 4
// D5 - PORTB Bit 5
// D6 - PORTB Bit 6
// D7 - PORTB Bit 7
// Characters/line: 16
lcd_init(16);

while (1)
{
// Place your code here

if(PINA.4==0)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("critically low BT");
PORTD.0=1;
delay_ms(1000);
PORTD.0=0;
}

23
if(PINA.4==1)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("critically high BT");
PORTD.0=1;
delay_ms(4000);
PORTD.0=0;
}
if(PINA.5==0)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("critically low HB");
PORTD.0=1;
delay_ms(1000);
PORTD.0=0;
}
if(PINA.5==1)
{
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("critically high HB");
PORTD.0=1;
delay_ms(4000);
PORTD.0=0;

}
if(PINA.0==1)
{
PORTD.0=0;
}

}
}

4.3 Medicine Reminder System :

#include <Wire.h>

#include <Rtc_Pcf8563.h>

/* add the lcd support */

#include <LiquidCrystal.h>

#include <String.h>

24
//init the real time clock

Rtc_Pcf8563 rtc;

/* initialize the library objects */

/* LiquidCrystal lcd(rs, en, d4, d5, d6, d7); */

#define BUZZER 11

#define LED 5

LiquidCrystal lcd(9,10,13,12,4,7);

char time1[10]="10:00:10";

char time2[10]="10:00:20";

char time3[10]="10:00:30";

char time4[10]="10:00:40";

void setup()

// set up the LCD's number of rows and columns:

lcd.begin(16, 2);

//clear out all the registers

rtc.initClock();

//set a time to start with.

//day, weekday, month, century, year

rtc.setDate(10, 2, 5, 0, 16);

//hr, min, sec

rtc.setTime(10, 00, 00);

pinMode(11,OUTPUT);

25
digitalWrite(BUZZER,HIGH);

pinMode(LED,OUTPUT);

void loop()

// set the cursor to column 0, line 1

// (note: line 1 is the second row, since counting


begins with 0):

//lcd.print(rtc.formatTime(RTCC_TIME_HM));

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Med Rem Sys");

if(!(strcmp((rtc.formatTime()),time1)))

digitalWrite(LED,HIGH);

digitalWrite(BUZZER,LOW);

lcd.clear();

lcd.print("TakeMedicine 1");

lcd.setCursor(0, 1);

lcd.print(rtc.formatTime());

delay(3000);

digitalWrite(BUZZER,HIGH);

26
digitalWrite(LED,LOW);

lcd.clear();

//lcd.print("BUZZER OFF");

delay(3000);

if(!(strcmp((rtc.formatTime()),time2))){

digitalWrite(LED,HIGH);

digitalWrite(BUZZER,LOW);

lcd.clear();

lcd.print("Take Medicine 2");

lcd.setCursor(0, 1);

lcd.print(rtc.formatTime());

delay(3000);

digitalWrite(BUZZER,HIGH);

digitalWrite(LED,LOW);

lcd.clear();

//lcd.print("BUZZER OFF");

delay(3000);

if(!(strcmp((rtc.formatTime()),time3))){

digitalWrite(LED,HIGH);

digitalWrite(BUZZER,LOW);

lcd.clear();

lcd.print("Take Medicine 3");

lcd.setCursor(0, 1);

27
lcd.print(rtc.formatTime());

delay(3000);

digitalWrite(BUZZER,HIGH);

digitalWrite(LED,LOW);

lcd.clear();

//lcd.print("BUZZER OFF");

delay(3000);

if(!(strcmp((rtc.formatTime()),time4))){

digitalWrite(LED,HIGH);

digitalWrite(BUZZER,LOW);

lcd.clear();

lcd.print("Take Medicine 4");

lcd.setCursor(0, 1);

lcd.print(rtc.formatTime());

delay(3000);

digitalWrite(BUZZER,HIGH);

digitalWrite(LED,LOW);

lcd.clear();

//lcd.print("BUZZER OFF");

delay(3000);

lcd.setCursor(0, 1);

//lcd.print(rtc.formatDate(RTCC_DATE_ASIA));

lcd.print(rtc.formatTime());

delay(1000);}

28
CHAPTER 5

CONCLUSION, LIMITATIONS AND SCOPE OF


IMPROVEMENT

5.1 CONCLUSION

By the proposed system basic parameters of a patient like heartbeat and body
temperature can be monitored and a graph of the same can be viewed on the serial
monitor. The system detects when the parameters cross a critical value and inform the
caretakers of the same through a display and audio warning. Also the system keeps a
track of the medicines to be administered to the patient and reminds of it on the
required time.

5.2 LIMITATIONS

The system designed is only for a single patient and only two body parameters. It is
not highly accurate and sensitive.

5.3 FURTHER IMPROVEMENTS

The system proposed has great chances for further improvements. The resolution of
level sensing can be improved by using highly sensitive multiple sensors. Moreover it
can be designed for multiple patients and a no. of body parameters can be monitored.
This will improve the accuracy, but it increases a lot of cost and complexity. The
system is open for future advancements and enhancements.

29
APPENDIX A: PIN DIAGRAM AND SPECIFICATIONS OF
ATMEGA 16

Pin diagram:

Figure A.1 Pin Diagram ATmega 16

30
Block Diagram :

Figure A.2 Block Diagram ATmega 16

31
Features-
• High-performance, Low-power Atmel® AVR® 8-bit Microcontroller
• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory segments
– 16 Kbytes of In-System Self-programmable Flash program memory
– 512 Bytes EEPROM
– 1 Kbyte Internal SRAM
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– Programming Lock for Software Security
• JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels in TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x

32
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
• I/O and Packages
– 32 Programmable I/O Lines
– 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
• Operating Voltages
– 2.7V - 5.5V for ATmega16L
– 4.5V - 5.5V for ATmega16
• Speed Grades
– 0 - 8 MHz for ATmega16L
– 0 - 16 MHz for ATmega16
• Power Consumption @ 1 MHz, 3V, and 25°C for ATmega16L
– Active: 1.1 mA
– Idle Mode: 0.35 mA
– Power-down Mode: < 1 μA

33
APPENDIX B: PIN DIAGRAM AND SPECIFICATIONS
OF ATMEGA 328P

Pin Diagram:

Fig . B.1: Pin Diagram of ATmega 328P

34
Features:

Table B.1: Features of ATmega 328P


Manufacturer Atmel

Pins 28

Package Type 28 Pin DIP

Flash Program Memory 32 kBytes

EEPROM Data Memory 1 kBytes

SRAM Data Memory 2 kBytes

I/O Pins 23

Timers Two 8-bit / One 16-bit

A/D Converter 10-bit Six Channel

PWM Six Channels

RTC Yes with Separate Oscillator

MSSP SPI and I²C Master and Slave Support

USART Yes

External Oscillator up to 20MHz

35
Pin Mapping:

Fig . B.2: ATmega 328P - Arduino Pin Mapping

36
Block Diagram:

Fig . B.3: Block Diagram

37
APPENDIX C: FTDI DETAILS

Schematic Layout:

Fig. C.1: Schematic Layout of FT232RL

38
Pin Description:

Table C.1: USB Interface Group


Pin No. Name Type Description
15 USBDP I/O USB Data Signal Plus, incorporating
internal series resistor and 1.5kΩ pull
up resistor to 3.3V.
16 USBDM I/O USB Data Signal Minus,
incorporating internal series resistor.

Table C.2: Power and Ground Group

Pin No. Name Type Description


4 VCCIO PWR +1.8V to +5.25V supply to the
UART Interface and CBUS group
pins (1...3, 5, 6, 9...14, 22, 23). In
USB bus powered designs connect
this pin to 3V3OUT pin to drive out
at +3.3V levels, or connect to VCC to
drive out at 5V CMOS level. This pin
can also be supplied with an external
+1.8V to +2.8V supply in order to
drive outputs at lower levels. It
should be noted that in this case this
supply should originate from the
same source as the supply to VCC.
This means that in bus powered
designs a regulator which is supplied
by the +5V on the USB bus should be
used.
7, 18, 21 GND PWR Device ground supply pins

39
17 3V3OUT Output +3.3V output from integrated LDO
regulator. This pin should be
decoupled to ground using a 100nF
capacitor. The main use of this pin is
to provide the internal +3.3V supply
to the USB transceiver cell and the
internal 1.5kΩ pull up resistor on
USBDP. Up to 50mA can be drawn
from this pin to power external logic
if required. This pin can also be used
to supply the VCCIO pin.
20 VCC PWR +3.3V to +5.25V supply to the device
core.
25 AGND PWR Device analogue ground supply for
internal clock multiplier

Table C.3: Miscellaneous Signal Group


Pin No. Name Type Description
8, 24 NC NC No internal connection
19 RESET# Input Active low reset pin. This can be
used by an external device to reset
the FT232R. If not required can be
left unconnected, or pulled up to
VCC.
26 TEST Input Puts the device into IC test mode.
Must be tied to GND for normal
operation, otherwise the device will
appear to fail.
27 OSCI Input Input 12MHz Oscillator Cell.
Optional – Can be left unconnected

40
for normal operation.
28 OSCO Output Output from 12MHZ Oscillator Cell.
Optional – Can be left unconnected
for normal operation if internal
Oscillator is used.

Table C.4: UART Interface and CUSB Group

Pin No. Name Type Description


1 TXD Output Transmit Asynchronous Data Output.
2 DTR# Output Data Terminal Ready Control Output
/ Handshake Signal.
3 RTS# Output Request to Send Control Output /
Handshake Signal.
5 RXD Input Receiving Asynchronous Data Input.
6 RI# Input Ring Indicator Control Input. When
remote wake up is enabled in the
internal EEPROM taking RI# low
(20ms active low pulse) can be used
to resume the PC USB host controller
from suspend.
9 DSR# Input Data Set Ready Control Input /
Handshake Signal.
10 DCD# Input Data Carrier Detect Control Input.
11 CTS# Input Clear To Send Control Input /
Handshake Signal.
12 CBUS4 I/O Configurable CBUS output only Pin.
Function of this pin is configured in
the device internal EEPROM.
Factory default configuration is
SLEEP#.

41
13 CBUS2 I/O Configurable CBUS I/O Pin.
Function of this pin is configured in
the device internal EEPROM.
Factory default configuration is
TXDEN.
14 CBUS3 I/O Configurable CBUS I/O Pin.
Function of this pin is configured in
the device internal EEPROM.
Factory default configuration is
PWREN#. PWREN# should be used
with a 10kΩ resistor pull up.
22 CBUS1 I/O Configurable CBUS I/O Pin.
Function of this pin is configured in
the device internal EEPROM.
Factory default configuration is
RXLED#.
23 CBUS0 I/O Configurable CBUS I/O Pin.
Function of this pin is configured in
the device internal EEPROM.
Factory default configuration is
TXLED#.

42
APPENDIX D: Code Vision AVR Evaluation V2.05.5a

CodeVisionAVR is a C cross-compiler, Integrated Development Environment and


Automatic Program Generator designed for the Atmel AVR family of
microcontrollers. The program is a native 32bit application that runs under the
Windows 95, 98, NT 4, 2000 and XP operating systems. The C cross-compiler
implements nearly all the elements of the ANSI C language, as allowed by the AVR
architecture, with some features added to take
advantage of specificity of the AVR architecture
and the embedded system needs. The compiled COFF object files can be C source
level debugged, with variable watching, using the Atmel AVR Studio debugger.
The Integrated Development Environment (IDE) has built-in AVR Chip In-System
Programmer software that enables the automatic transfer of the program to the
microcontroller chip after successful compilation/assembly. The In-System
Programmer software is designed to work in conjunction with the Atmel STK500,
Kanda Sy
stems STK200+/300, Dontronics DT006, Vogel Elektronik VTEC-ISP, Futurlec
JRAVR and MicroTronics' ATCPU/Mega2000 development boards. For debugging
embedded systems, which employ serial communication, the IDE has a built-in
Terminal. Besides the standard C libraries, the CodeVision AVR C compiler has
dedicated libraries for:
• Alphanumeric LCD modules
• Philips I2C bus
• National Semiconductor LM75 Temperature Sensor
• Philips PCF8563, PCF8583, Dallas Semiconductor DS1302 and DS1307 Real Time
Clocks
• Dallas Semiconductor 1 Wire protocol
• Dallas Semiconductor DS1820/DS18S20 Temperature Sensors
• Dallas Semiconductor DS1621 Thermometer/Thermostat
• Dallas Semiconductor DS2430 and DS2433 EEPROMs
• SPI
• Power management

43
• Delays
• Gray code conversion.
CodeVisionAVR also contains the CodeWizardAVR Automatic Program Generator,
that allows you to write, in a matter of minutes, all the code needed for implementing
the following functions: External memory access setup
• Chip reset source identification
• Input/ Output Port initialization
• External Interrupts initialization
• Timers/Counters initialization
• Watchdog Timer initialization
• UART initialization and interrupt driven buffered serial communication
• Analog Comparator initialization
• ADC initialization
• SPI Interface initialization
• I2C Bus, LM75 Temperature Sensor, DS1621 Thermometer/Thermostat and
PCF8563, PCF8583, DS1302, DS1307 Real Time Clocks initialization
• 1 Wire Bus and DS1820/DS18S20 Temperature Sensors initialization
• LCD module initialization.

Figure D.1 CodeVisionAVR window screenshot

44
APPENDIX E: ARDUINO IDE 1.5.6

For programming the microcontrollers, the Arduino project provides an Integrated


Development Environment (IDE) based on a programming language named
Processing, which also supports the languages C and C++. The Arduino project
provides the Arduino integrated development environment (IDE), which is a cross-
platform application written in the programming language Java. It originated from the
IDE for the languages Processing and Wiring. It is designed to introduce
programming to artists and other newcomers unfamiliar with software development. It
includes a code editor with features such as syntax highlighting, brace matching, and
automatic indentation, and provides simple one-click mechanism to compile and load
programs to an Arduino board. A program written with the IDE for Arduino is called
a "sketch".
The Arduino IDE supports the languages C and C++ using special rules to organize
code. The Arduino IDE supplies a software library called Wiring from the Wiring
project, which provides many common input and output procedures. A typical
Arduino C/C++ sketch consist of two functions that are compiled and linked with a
program stub main() into an executable cyclic executive program:
 setup(): a function that runs once at the start of a program and that can
initialize settings.
 loop(): a function called repeatedly until the board powers off.
After compiling and linking, the Arduino IDE employs the program avrdude to
convert the executable code into a text file in hexadecimal coding that is loaded into
the Arduino board by a loader program in the board's firmware.

45
Fig. E.1: Screenshot of the Arduino IDE showing the Blink simple beginner program

Table E.1: Details of Arduino IDE

Developer Arduino Software


Stable Release 1.6.8 / 9 March 2016
Written in Java, C and C++
Operating System Cross-platform
Type Integrated Development Environment
License LGPL or GPL license
Website www.arduino.cc

46
REFERENCES

[1] Details of ATMEGA 16, https://en.wikipedia.org/wiki/ATmega16


[2] Details of ATMEGA 328P, https://en.wikipedia.org/wiki/ATmega328
[3] Different images of the FTDI, “http://beyonduino.in/”
[4] Interfacing RF module with ATmega16, http://www.ablab.in/how-to-interface-
433mhz-rf-with-avr-atmega16-microcontroller
[5] Momentary Push Button Switch, “https://en.wikipedia.org/wiki/Switch”
[6] Pin Diagram and Specifications sheet of ATMEGA 16,
http://www.atmel.com/images/atmel-8271-8-bit-avr-microcontroller-
atmega48a-48pa-88a-88pa-168a-168pa-16-16p_datasheet_summary.pdf
[7] Pin Diagram and Specifications sheet of ATMEGA 328P,
http://www.atmel.com/images/atmel-8271-8-bit-avr-microcontroller-
atmega48a-48pa-88a-88pa-168a-168pa-328-328p_datasheet_summary.pdf
[8] Pin Mapping, https://www.arduino.cc/en/Hacking/PinMapping168
[9] Block Diagram, http://www.mouser.in/new/atmel/atmelatmega328/
[10] Schematic Layout of FT232RL,
www.ftdichip.com/Documents/DataSheets/ICs/DS_FT232R.pdf
[11] Arduino IDE, https://en.wikipedia.org/wiki/Arduino
[12] Basic Concepts of Arduino, “http://www.arduino.cc/”
[13] Charles Platt, “Make: Electronics”, 1st Edition, O’Reilly Media Inc., Dec 2009
[14] Paul Horowitz & Winfield Hill, “The art of electronics”, 2nd Edition, Cambridge
University Press, 1989
[15] John Catsoulis, “Designing Embedded Hardware”, 2nd Edition, O’Reilly Media
Inc., May 2005

47

You might also like