Sei sulla pagina 1di 71

ProjectReport2016-17 Intelligent patient care system

CHAPTER 1
INTRODUCTION

The conventional manner of introducing drug to patient is in efficient and often lead to toxic
side effect.The dramatic advance in controlled and targeted drug delivery system over past few
decays have lead to enormous expectation for treatment.one class of such system is intelligent
medicine delivery system.Intelligent medical system are capable ofremainding patient to take
correct medicines at correct time in responds to physiological need.
The aim of this project is to remaind people who forget to take medicine on time. The
proposed system is best suited for elderly people and people who are very busy,as this device
will not only remaind them of their medicine with a buzzer sound but also deliver the proper
medicine.

1.1 OBJECTIVES
Remainding patients to have medicine at correct time.
Doctor can evaluate the patient had medicine or not.

1.2 NEED FOR THIS WORK

This system could effectively resolve the problem of negligence and mis operation when
medicine distribution, and as well avoid the accidental medicine taking for patient.

Department of ECE Page 1 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 2
LITERATURE SURVEY

In todays world of connections,people are becoming accustomed to easy access to


information .Henceforth on analyzing the proposed sections individually similar researches
have been found and their findings and suggestions have been reviewed here:

In paper [1] It has been reported that wrong medicine box has been delivered to patient
accidentally at hospital's Inpatient Department, so the patient may take the wrong medicine
and the medical incident occurs consequently. In order to resolving this problem, it is
necessary to design intelligent medicine box monitoring and management system. This system
integrates technologies involving network, RFID, and touch screen. At the network, the
system monitors and controls the releasing process of medicine box through RFID label ring;
and displays the medicine's name, dosing time, notes and other relevant information for
patients on the touch screen. Therefore the patient would be reminded to take the medicine
clearly and regularly. The system could effectively resolve the problem of negligence and miss
operation when medicine distribution, and as well avoid the accidental medicine taking for
patient.

In paper [2]Nowadays usually the drug delivery during the surgeries is done manually by
giving injection to the patient. During this drug delivery process some can commit minute
mistakes in the quantity of drug release which leads to critical condition and can influence the
health of the patient, so to decide and deliver the quantity of drug, it requires significant effort
from the clinical standpoint not guaranteeing an optimal performance. The proposed system
involves automated drug delivery to the patient based on some health parameters, such as
fever, sugar, etc. This system involves a linear actuation mechanism to deliver exact amount
of drug delivery based on the sensor data. Delivering adequate drug requires precise
automation in drug delivery system which will improve the patient safety, reduce the cost due
to minimal consumption of drug and will help in early post-operative recover.

Department of ECE Page 2 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 3
PROPOSED WORK
The aim of this project is to remaind people who forget to take medicine on time.
Elderly people because of their age usually forget to take their medicine. This project will help
to remaind the patient to take medicine at prescribed time. The proposed system is best suited
for elderly people and people who are very busy, as this device will not only remained them of
their medicine with a buzzer sound but also deliver the proper medicine.

3.1 BLOCK DIAGRAM AND BLOCK DIAGRAM DESCRIPTION

3.11.Power supply

230v
12V Bridge Filter Voltage
Adapter Rectifier Capacitor Regulator

Fig:3.1.powersupply

A power supply is a device that supplies electric powerto anelectricalload. The term is most
commonly applied toelectric power convertersthat convert one form of electrical energy to
another, though it may also refer to devices that convert another form of energy (mechanical,
chemical, solar) to electrical energy.

Aregulated power supplyis one that controls the output voltage or current to a specific value;
the controlled value is held nearly constant despite variations in either load current or the
voltage supplied by the power supply's energy source. The system requires a regulated +5v
supply for the Integrated circuits. These can be delivered from the 230V domestic supply.
Before applying this to the system we must step down this high voltage to an appropriate
value. After that it should be rectified. To achieve +5 V DC we should regulate this.All this
are run in the power supply circuitry.

Power supply is used to give sufficient power to the microcontroller. A step down
transformer and a bridge rectifier is used here to convert AC to DC. A regulator IC is also

Department of ECE Page 3 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

used here to give constant supply.7805 IC is used for power supply and it is connected to the
bridge rectifier.

A 12-0-12V step down transformer is connected to provide the necessary low voltage. The
transformer also works as an Isolator between the hot and cold end. The hot end refers to the
230v supply, which is hazardous one, and the cold one refers to the low ,safe voltage .Now
the hot portion appears only at the primary of the transformer. The secondary of the
transformer deliver 12v ac pulses along with a ground.

This ac supply goes to a center tap rectifier, which converts the ac into a unidirectional
voltage. The ripples in the resulting supply is filtered and smoothed by a 2200micro FD/25V
capacitor. The 0.1 microfarad capacitor bypasses any high frequency noises. The resulting
supply has magnitude above 17V.This voltage is given to the regulated IC 7805.This IC
provides a regulated 5V positive supply at its 3rd pin. This required input for this is more
than 7.5V.

Circuit diagram of the power supp

Fig:3.2.circuit diagram of power supply

The capacitors must have enough high voltage rating to safely handle the input voltage feed
to circuit. The circuit is very easy to build for example into a piece of Vero board.

Rectifiers

A rectifier is an electrical device that convertsalternating current(AC), which periodically


reverses direction, to direct current(DC), which flows in only one direction. The process is
known as rectification. Physically, rectifiers take a number of forms, including vacuum
tubediodes,mercury-arc valves, copper and selenium oxide rectifiers, semiconductor
diodes,silicon-controlledrectifiersand other silicon-based semiconductor switches.

Department of ECE Page 4 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Filters

Electronic filters are analog circuitswitch perform signal processingfunctions, specifically to


remove unwanted frequency components from the signal, to enhance wanted ones, or both.
The most common types of electronic filters are linear filters, regardless of other aspects of
their design.

Regulators

A regulator is a device which has the function of maintaining a designated characteristic. It


performs the activity of managing or maintaining a range of values in a machine. The
measurable property of a device is managed closely by specified conditions or an advance set
value; or it can be a variable according to a predetermined arrangement scheme. We are using
LM7812 & LM7805 regulators.

Fig:3.3.Pin out of the 7805 regulator IC

Pins are,

1. Unregulated voltage in
2. Regulated voltage out
3. Ground

If we need other voltages than +5V, we can modify the circuit by replacing the 7805 chips
with another regulator with different output voltage from regulator 78xx chip family. The last
numbers in the the chip code tells the output voltage. Remember that the input voltage must
be at least 3V greater than regulator output voltage, otherwise the regulator does not work
well.

Department of ECE Page 5 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

3.12 Block diagram

Mobile with
CLOUD
SERVER Android
App

GPRS Modem Medicine container

RS232
Interface

Buzzer Motor Motor


Driver

LCD Display Micro


PIR
Controller SENSOR

IR SENSOR

Fig 3.4: Block diagram

Department of ECE Page 6 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

3.13.Microcontroller

PIC micro controllers are low-cost computers-in-a-chip; they allow electronics designers and
hobbyists add intelligence and functions that mimic big computers for almost any electronic
product or project. The programming of the system is done using a PIC micro controller
16F877. This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35
single word instructions) CMOS FLASH-based 8-bit micro controller packs Microchip's
powerful PIC architecture into a 40-pin package and is upwards compatible with the
PIC16C5X, PIC12CXXX and PIC16C7X devices. It is has five ports. I.e. port A, port B, port
C, port D, port E. The PIC 16F877 has flash memory of 8K and Data memory of 368 bytes
Data EEPROM of 256 bytes.

WHY PIC IS USED?

Speed
High Performance RISC CPU
Instruction Set Simplicity
Integration Of Operation Features
Programmable Timer Options
Interrupt Control
Inbuilt Modules
EPROM/OTP/ROM Options
Low Power Consumption
Wide Operation Voltage Range :2.5to 6.0 Volt
Programmable Code Protection Mode
Power Saving Sleep Mode

PIC 16F877A- FEATURES


High performance CPU
Only 35 instructions
All single cycle instruction except for program branches. Operating speed DC-
20MHz,clock i/p DC-200ns instruction cycles
Up to 8Kx14 word of flash memory

Department of ECE Page 7 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Up to 368x8 bytes of data memory


Up to 256x8 bytes of EEPROM data memory

Interrupt compatibility

Power on reset

Power up timer and oscillator start up timer

Watch dog timer with its own chip RC oscillator for reliable operation

Programmable code protection power saving SLEEP mode

Low power, high speed CMOS FLASH/EEPROM technology

In circuit serial programming capability via two pins

Processor read write access to program memory

Single 5v in circuit serial programming capability

In circuit debugging via two pins

Wide operating voltage range

High sink or source current

Low power consumption


Table:3.1.pic16F877A pinout description
Pin name Dip Plccpin # I/O/O Buffer type Description gfp
Pin # Type
Osc/clkout 13 14 1 St/cmos Osc crystal 30
Osc/clkout 14 15 0 - i/p 31
osc.crystal
o/p
MCLR/Vpp 1 2 i/p St Master clear 18
i/p or pgm
o/p

Department of ECE Page 8 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

RA0/AN0 2 3 I/O TTL Port A is bi 19


RA1/AN1 3 4 I/O TTL directional 20
RA2/AN2/VREF- 4 5 I/O TTL i/p 21
RA3/AN3/VREF+ 5 6 I/O TTL 22
RA4/TOCK1 6 7 I/O SL 23
RA5/SS/AN4 7 8 I/O TTL 24
RB0/INT 33 36 I/O TTL/STI Port B is a 8
RB1 34 37 I/O TTL bidirectional 9
RB2 35 38 I/O TTL i/p port. port 10
RB3/PGM 36 39 I/O TTL B can be 11
RB4 37 40 I/O TTL s/w pgmed 14
RB5 38 41 I/O TTL for pull up 15
RB6/PGC 39 42 I/O TTL/ST2 on. 16
RB7/PGD 40 43 I/O TTL/ST2 17

Fig:3.5.pinout diagram of pic 16f877A

Department of ECE Page 9 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

program memory

The pic 16f87x devices have a 13-bit program counter, capable of addressing an 8k x
14 program memory space. the pic 16f877 has 8kx 14 words of flash program memory. the
reset vector is at 0000h and the interrupt vector is at 0004h

data memory

Data memory is partition in to multiple banks which contain the general purpose
registers and special function registers. Bits RP1(status <6>) and RP0(status<5>) are the banks
bits.Each bank extends up to 7Fh (128bits). The lower location of each banks are

Table:3.2.data memory details

RP0 RP0 BANK

0 0 0
0 1 1
1 0 2
1 1 3

Reserved for the special function registers. About the special function registers are general
purpose registers, implemented as the static RAM. All implemented banks contain special
function registers .Some frequently used special function register from 1 bank may be
mirrored in another bank for code reduction and quicker access.
General Purpose Register
The register file can be accessed either directly, or indirectly through the file select register
(FSR
Special purpose register
The Special purpose registers are registers used by the CPU and peripheral modules for
controlling the desired operation of the devices. These devices are implemented as static
RAM. Some examples of the SFRs are INDF, OPTION_REG, FSR, PCLATHe.t.c

Department of ECE Page 10 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Status register

The Status register contains the arithmetic status of the ALU, the RESET status and the bank
select bits for data memory. The STATUS register can be the destination for any instruction,
as with any other register.

R/W-0 R/W-0 R/W-0 R-1 R-1 R/W-x R/W-x R/W-x

________ ________
IRP RP1 RP0 TO PD Z DC C
BIT 7 BIT 0

BIT 7 IRP: Register Bank select bit


1=Bank 2, 3(100h-1FFh)
0=Bank 0, 1(00h-FFh)
Bit 6-5 RP1:RP0: Register bank selects bits
Bit 4 TO: time out bit
Bit 3 PD: power down bit
Bit 2 Z: Zero bit
Bit 1 DC: Digit carry
Bit 0 C: Carry

i/o ports associated with pic 16f877


Some pins for these I/O ports are multiplexed with an alternate function for the peripheral
features on the device. PIC16F877 have FIVE ports (Port A, B,C, D, E).
PORT A& TRIS A registers
Port A is a 6-bit wide, bit wide, bi-directional port. The corresponding data direction register
is TRISA. Setting a TRISA bit will make the corresponding Port A pin as input. Clearing a
TRISA bit will make the corresponding Port A pin as output.
Pin RA4 is multiplexed with the Timer 0 module clock input to become the RA4/T0CK1 pin.
The RA4/T0CK1 pin is a Schmitt Trigger input and an open drain output. All other Port A
pins have TTL input levels and full CMOS output drivers. Other Port A pins are multiplexed
with analog input and analog Vref input. The operation of each pin is selected by
cleaning/setting the control bits in the ADCON1 register.
Department of ECE Page 11 MEA Engineering College
ProjectReport2016-17 Intelligent patient care system

TRISA register controls the direction of the RA pins, even when they are used as analog
inputs. The user must ensure the bits in the TRISA register are maintained set when using
them as analog inputs.
PORT B AND THE TRISB Register
PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is
TRISB. Setting a TRISB bit will make the corresponding PORTB pin an input. Clearing a
TRISB bit make the corresponding PORTB pin an output.
Three pins of PORTB are multiplexed with the Low Voltage Programming function:
RB3/PGN, RB6/PGC and RB7/PGD. The alternate functions of these pins are described in the
Special Features Section.
Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the
pull-ups. This is performed by cleaning bit RBPU (OPTION_REG<7>). The weak pull-up is
automatically turned off when the port pin is configured as an output. The pulls are disabled
on a Power-on Reset
Four of the PORTB pins, RB7:RB4 have interrupt on change feature. Only pins configured as
inputs can cause this interrupt to occur. The input pin (RB7:RB4) are compared with the old
value latched on the last read of PORTB. The Mismatch output of RB7:RB4 are ORed
together to generate the RBPORT change interrupt with flag bit RBIF (INTCON<0>).
This interrupt can wake the device from SLEEP. A mismatch condition will continue to set
flag bit RBIF. Reading PORTB will end the mismatch condition and allow flag bit RBIF to be
cleared
PORTC AND THE TRISTC Register
PORTC is an 8 bit wide, bi-directional port. The corresponding data direction register is
TRISC. Setting TRISC bit (=1) will make the corresponding PORTC pin an input. Clearing
TRISC bit (=0) will make the corresponding PORTC pin an output. PORTC is multiplexed
with several peripheral functions. PORTC pin have SCHMITT Trigger input buffers. When
the I2C module is enabled the PORTC<4:3> pin can be configure with normal I2C levels.
PORT D AND THE TRIS D Register
PORT D is an 8-bit port with Schmitt trigger input buffers. Each pin is individually
configurable as an input or output.
PORT E AND THE TRIS E REGISTER
PORT E has three pins which are individually configurable as input or output .The PORT E
pins becomes I/O control inputs for the microprocessor port when bit PSPMODE(TRIS<4>) is

Department of ECE Page 12 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

set .PORT E pins are multiplexed with analog input . TRISE controls the direction of the RE
pins.
3.14.LCD module
The LCD module, made by Crystallonics, is 16x2 line interactive displays. It needs a power
supply of +5v. The module has inbuilt controller chip, such as an HD44780, which acts as an
interface between CPU and the row and column drivers. The controller takes care of
generating characters, refreshing the display, and so on. The module has a back light driven by
a pair of pads separate from the interface pads .The LCD module works in two modes for
communicating with the micro controller - 8 bit (byte) mode & 4 bit (nibble) mode. In the
later case only the higher nibble i.e. pins DB4-DB7 is used for communication. For controlling
the LCD module we have used only the port D

Fig:3.6.LCD module

A variable voltage applied to this pin controls the contrast. Use a potentiometer and adjust
until you see the background.
Register Select:
This pin selects whether you are sending the module a command or data.
Read/Write:
This pin allows for bi-directional communications. For the discussions here, uni-directional
communications will be used. Ground this pin.
Enable:
This is the latch pin. A high-to-low transition causes the value on the data lines to be latched
by the module.

Department of ECE Page 13 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

DB0-DB7:
Apply the data or commands to these pins.The SPI module and a 74595 can be used to make a
serial interface. The same latch pin can be used for both because the '595 latches on LH while
the LCD latches on HL. Transmit the value via SPI the set the latch then clear it.

Fig:3.7.pinout diagram of LCD module


Structure
LCDs are fabricated by sandwiching liquid crystal material of 0.005 inch to 0.305 inch
between two glass plates. The glass plates have a preferential direction (produced by rubbing
or some other lithographic techniques) so that these directions orient the liquid crystal
molecules. The plates are oriented so that the preferential directions are perpendicular to each
other causing a 900( or even 270) twist in the liquid crystal molecules. Between liquid crystal
and glass plates, there are thin metal layers on the glass plates that are formed by metal
evaporation at vacuum and these forms the electrodes between which an alternating voltage is
applied across the liquid crystal sandwiched. The glass plates are separated by a spacer is
known as edge seal. The metal layer between glass plate and liquid crystal is transparent.
3.15.WIFI-module

Fig:3.8.WIFI module

Department of ECE Page 14 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

This is ultra low cost module that is easy to use and reliable based on ESP8266 chipset to be
used along with a microcontroller that configures and communicates through AT
commands.Till now embedded WiFi solutions was a bit pricey to implement for hobbyist.
This module is changing the trend rapidly. It gives excellent working range and opening wide
array of applications.

Applications

Internet of Things (IoT)


Wireless Remote Control
Wireless Sensor Networks
Web Server / Client
Wireless UART
Features
Built in Client-Server Mode
400 Meters Working Distance
On Board 2.4 Ghz Ceramic Antenna
IPX Connector for optional external antenna
Metal Shielding
ESP8266 is an impressive, low cost WiFi module suitable for adding WiFi functionality to an
existing microcontroller project via a UART serial connection. The module can even be
reprogrammed to act as a standalone WiFi connected devicejust add power! The feature list
is impressive and includes: 802.11 b/g/n protocol Wi-Fi Direct (P2P), soft-AP Integrated
TCP/IP protocol stack This guide is designed to help get started with new WiFi module.
Hardware Conn

The hardware connections required to connect to the ESP8266 module are fairly straight-
forward but there are a couple of important items to note related to power: The ESP8266
requires 3.3V powerdo not power it with 5 volts! The ESP8266 needs to communicate via
serial at 3.3V and does not have 5V tolerant inputs, so you need level conversion to
communicate with a 5V microcontroller.

Department of ECE Page 15 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Fig:3.9.WIFI pinout

Fig:3.10.Hardware connection diagram

3.16.PIR motion sensor

A Passive InfraRedsensor(PIR sensor) is an electronic device that measures


infrared (IR) light radiating from objects in its field of view. PIR sensors are often used in the
construction of PIR-based motion detectors. Apparent motion is detected when an infrared
source with one temperature, such as a human, passes in front of an infrared source with
another temperature, such as a wall.

Department of ECE Page 16 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Fig:3.11.PIR sensor

All objects emit what is known as black body radiation. It is usually infrared radiation that is
invisible to the human eye but can be detected by electronic devices designed for such a
purpose. The term passive in this instance means that the PIR device does not emit an infrared
beam but merely passively accepts incoming infrared radiation.

In a PIR-based motion detector (usually called a PID, for Passive Infrared Detector), the PIR
sensor is typically mounted on a printed circuit board containing the necessary electronics
required to interpret the signals from the pyroelectric sensor chip. The complete assembly is
contained within a housing mounted in a location where the sensor can view thearea to be
monitored. Infrared energy is able to reach the pyroelectric sensor through the window
because the plastic used is transparent to infrared radiation (but only translucent to visible
light). This plastic sheet also prevents the intrusion of dust and/or insects from obscuring the
sensor's field of view, and in the case of insects, from generating false alarms.

A few mechanisms have been used to focus the distant infrared energy onto the sensor surface.
The window may have multiple Fresnel lensesmolded into it.The PIR Sensor is a pyroelectric
device that detects motion by measuring changes in the infrared levels emitted by surrounding
objects. This motion can be detected by checking for a high signal on a single I/O pin.

3.17.IR obstracle sensor

The IR led keeps transmitting IR infrared rays up to some range (there is a potentiometer also
in the design with the help of which you can alter the range). When some object comes in the
(IR) infrared range, the IR waves hits the object and comes back at some angle, The Photo
diode next to IR led detects that IR infrared rays which got reflected from the object and hence
works as a proximity sensor.

Department of ECE Page 17 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Based on a simple basic Idea, this IR obstacle sensor, is easy to build, easy to calibrate and
still, it provides a detection range of 10- 30 cm. This sensor can be used for most indoor
applications where no important ambient light is present. It is the same principle in ALL Infra-
Red proximity sensors. The basic idea is to send infra red light through IR-LEDs, which is
then reflected by any object in front of the sensor.

Features

IR obstacle based detector.


Adjustable range with POT.
Logic output 1 or 0.
Sensitivity up to 30cm adjustable.

Applications

Industrial safety devices.


Wheel encoder.
Contact less tachometer.

Working

It is the same principle in ALL Infra-Red proximity sensors. The basic idea is to send infra red
light through IR-LEDs, which is then reflected by any object in front of the sensor.Then all
you have to do is to pick-up the reflected IR light. For detecting the reflected IR light, we are
going to use a very original technique: we are going to use another IR-LED, to detect the IR
light that was emitted from another led of the exact same type! This is an electrical property of
Light Emitting Diodes (LEDs) which is the fact that a led Produce a voltage difference across
its leads when it is subjected to light. As if it was a photo-cell, but with much lower output
current. In other words, the voltage generated by the leds can't be - in any way - used to
generate electrical power from light, It can barely be detected. that's why as you will notice in
stheschematic, we are going to use a Op-Amp (operational Amplifier) to accurately detect
very small voltage changes.

Department of ECE Page 18 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Sample Application:

IR sensor is interfaced to 89s52 if any obstacle is detected a message is displayed on LCD.

3.18. L293D driver IC


The Device is a monolithic integrated high voltage, high current four channel driver designed
to accept standard DTL or TTL logic levels and drive inductive loads (such as relays
solenoids, DC and stepping motors) and switching power transistors. To simplify use as two
bridges each pair of channels is equipped with an enable input. A separate supply input is
provided for the logic, allowing operation at a lower voltage and internal clamp diodes are
included. This device is suitable for use in switching applications at frequencies up to 5 kHz.
The L293D is assembled in a 16 lead plastic package which has 4 center pins connected
together and used for heat sinking. The L293D is assembled in a 20 lead surface mount which
has 8 center pins connected together and used for heat sinking.

Fig:3.12.Driver circuit L293D

Features
A output current per channel.
Enable facility.
Department of ECE Page 19 MEA Engineering College
ProjectReport2016-17 Intelligent patient care system

Over temperature protection.


Logical 0 input voltage up to 1.5 volt.
Internal clamp diodes.
High noise immunity.
600 mA output current capability per channel.
Pin connections
The Device is a monolithic integrated high voltage, high current four channel driver designed
to accept standard DTL or TTL logic levels and drive inductive loads (such as relays
solenoids, DC and stepping motors) and switching power transistors. To simplify use as two
bridges each pair of channels is equipped with an enable input. A separate supply input is
provided for the logic, allowing operation at a lower voltage and internal clamp diodes are
included. This device is suitable for use in switching applications at frequencies up to 5 kHz.
The L293D is assembled in a 16 lead plastic package which has 4 center pins connected
together and used for heat sinking
The L293D is assembled in a 20 lead surface mount which has 8 center pins connected
together and used for heat sinking.

Fig:3.13.pinout of L293D

Department of ECE Page 20 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

3.19.GPRS modem
A GPRS modem is a specialized type of modem which accepts a simcard, and operats over
subscription to a mobile operator, just like a mobile phone. When a GSM modem is connected
to a computer, this allows the computer to use GSM modem to communicate over the mobile
network. While this GPRS modem are most frequently used to provide mobile internet
connectivity, many of them can also be used for sending and receiving SMS and MMS
messages.
3.20.GSM (Global System for Mobile communications) modem
Here a GSM mobile hand set is used. GSM networks are originally from the most popular
standard for mobile phones in the world.GSM differs from its predecessors in that both
signaling and speech channels are digital, and thus is considered a second generation (2G)
mobile phone system. This has also meant that data communication was easy to build into the
system. GSM is a cellular network, which means that mobile phones connect to it by searching
for cells in the immediate vicinity

Fig:3.13.GSM module
GSM networks operate in a number of different frequency ranges .Most 2G GSM networks
operate in the 900 MHz or 1800 MHz bands. The controller communicates with the mobile
phone by AT comments. The Main AT commands to communicate via a serial interface with
the GSM subsystem of the phone. The comments that used in the controller is sent and
received by SMS (short message system).
Details of AT comments used
AT+CMGD (Delete message)
Description: Deletes message from preferred message <mem1> storage
Location<index>.

Department of ECE Page 21 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Execution command: AT+CMGD=<index>,<delflag>


AT+CMGR (Read message)
Description: Returns message with location value <index> from preferred message
storage<mem1> .
Execution command: AT+CMGR=<index>
AT+CPMS (Preferred message storage)
Description: Set command selects memory storage <mem1>, <mem2> and <mem3>
to be used for reading, writing, and so on.
Set command: AT+CPMS=<mem1>[,<mem2>[,<mem3>]]
ME for Phone message storage
SM for SIM message storage
AT+CMGF Message format
Description: Tells which input and output format of messages to use. <mode>
indicates the format of messages used with send, list, read and write commands and
unsolicited result codes resulting from received
messages. Mode can be either PDU mode or text mode
Set command: AT+CMGF=<mode>; 0 for PDU mode and 1 for text mode.
AT+CMGS( Send message)
Description: Sends message from a TE to the network (SMS-SUBMIT). Message reference
value <mr> is returned to the TE on successful messagedelivery.
Execution command: AT+CMGS=<length><CR><pdu><ctrl-Z/ESC>

3.21.Buzzer
A buzzer or beeper is signaling device, usually electronic, typically used in automobiles house
hold appliance. Initially the device was based on an elecro mechanical system which was
identical to electric bell without the metal gong(which make the ringing noise).

Fig:3.15.Buzzer
Department of ECE Page 22 MEA Engineering College
ProjectReport2016-17 Intelligent patient care system

3.21.RS232 interface

All IBM PC and compatible computers are typically equipped with two serial ports and one
parallel port. Although these two types of ports are used for communicating with external
devices, they work in different ways.A parallel port sends and receives data eight bits at a time
over 8 separate wires. This allows data to be transferred very quickly; however, the cable
required is more bulky because of the number of individual wires it must contain. Parallel
ports are typically used to connect a PC to a printer and are rarely used for much else. A serial
port sends and receives data one bit at a time over one wire. While it takes eight times as long
to transfer each byte of data this way, only a few wires are required. In fact, two-way (full
duplex) communications is possible with only three separate wires - one to send, one to
receive, and a common signal ground wire.

Bi-Directional Communications

The serial port on your PC is a full-duplex device meaning that it can send and receive data at
the same time. In order to be able to do this, it uses separate lines for transmitting and
receiving data. Some types of serial devices support only one-way communications and
therefore use only two wires in the cable - the transmit line and the signal ground.

Communicating by Bits

Once the start bit has been sent, the transmitter sends the actual data bits. There may either be
5, 6, 7, or 8 data bits, depending on the number you have selected. Both receiver and the
transmitter must agree on the number of data bits, as well as the baud rate. Almost all devices
transmit data using either 7 or 8 databits.Notice that when only 7 data bits are employed, we
cannot send ASCII values greater than 127. Likewise, using 5 bits limits the highest possible
value to 31. After the data has been transmitted, a stop bit is sent. A stop bit has a value of 1 -
or a mark state - and it can be detected correctly even if the previous data bit also had a value
of 1. This is accomplished by the stop bit's duration. Stop bits can be 1, 1.5, or 2 bit periods in
length.

Department of ECE Page 23 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

RS-232C

RS-232 stands for Recommend Standard number 232 and C is the latest revision of the
standard. The serial ports on most computers use a subset of the RS-232C standard. The full
RS-232C standard specifies a 25-pin "D" connector of which 22 pins are used. Most of these
pins are not needed for normal PC communications, and indeed, most new PCs are equipped
with male D type connectors having only 9 pins.

DCE and DTE Devices

Two terms you should be familiar with are DTE and DCE. DTE stands for Data Terminal
Equipment, and DCE stands for Data Communications Equipment. These terms are used to
indicate the pin-out for the connectors on a device and the direction of the signals on the pins.
Your computer is a DTE device, while most other devices are usually DCE devices.

RTS stands for Request To Send. This line and the CTS line are used when "hardware flow
control" is enabled in both the DTE and DCE devices. The DTE device puts this line in a mark
condition to tell the remote device that it is ready and able to receive data. If the DTE device is
not able to receive data (typically because its receive buffer is almost full), it will put this line
in the space condition as a signal to the DCE to stop sending data. When the DTE device is
ready to receive more data (i.e. after data has been removed from its receive buffer), it will
place this line back in the mark condition. The complement of the RTS wire is CTS, which
stands for Clear To Send. The DCE device puts this line in a mark condition to tell the DTE
device that it is ready to receive the data. Likewise, if the DCE device is unable to receive
data, it will place this line in the space condition. Together, these two lines make up what is
called RTS/CTS or "hardware" flow control. The Software Wedge supports this type of flow
control, as well as Xon/XOff or "software" flow control. Software flow control uses special
control characters transmitted from one device to another to tell the other device to stop or
start sending data. With software flow control the RTS and CTS lines are not used.

DTR standsfor Data Terminal Ready. Its intended function is very similar to the RTS line.
DSR (Data Set Ready) is the companion to DTR in the same way that CTS is to RTS. Some
serial devices use DTR and DSR as signals to simply confirm that a device is connected and is

Department of ECE Page 24 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

turned on. The Software Wedge sets DTR to the mark state when the serial port is opened and
leaves it in that state until the port is closed. The DTR and DSR lines were originally designed
to provide an alternate method of hardware handshaking. It would be pointless to use both
RTS/CTS and DTR/DSR for flow control signals at the same time. Because of this, DTR and
DSR are rarely used for flow control.

Null Modem Cables and Null Modem Adapters

If we connect two DTE devices (or two DCE devices) using a straight RS232 cable, then the
transmit line on each device will be connected to the transmit line on the other device and the
receive lines will likewise be connected to each other. A Null Modem cable or Null Modem
adapter simply crosses the receive and transmit lines so that transmit on one end is connected
to receive on the other end and vice versa. In addition to transmit and receive, DTR & DSR, as
well as RTS & CTS are also crossed in a Null Modem connection.

Synchronous and Asynchronous Communications

There are two basic types of serial communications, synchronous and asynchronous. With
synchronous communications, the two devices initially synchronize themselves to each other,
and then continually send characters to stay in sync. Even when data is not really being sent, a
constant flow of bits allows each device to know where the other is at any given time. That is,
each character that is sent is either actual data or an idle character. Synchronous
communications allows faster data transfer rates than asynchronous methods, because
additional bits to mark the beginning and end of each data byte are not required. The serial
ports on IBM-style PCs are asynchronous devices and therefore only support asynchronous
serial communications.
Asynchronous means "no synchronization", and thus does not require sending and receiving
idle characters. However, the beginning and end of each byte of data must be identified by
start and stop bits. The start bit indicates when the data byte is about to begin and the stop bit
signals when it ends. The requirement to send these additional two bits causes asynchronous
communication to be slightly slower than synchronous however it has the advantage that the
processor does not have to deal with the additional idle characters.

Department of ECE Page 25 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

An asynchronous line that is idle is identified with a value of 1 (also called a mark state). By
using this value to indicate that no data is currently being sent, the devices are able to
distinguish between an idle state and a disconnected line. When a character is about to be
transmitted, a start bit is sent. A start bit has a value of 0 (also called a space state). Thus,
when the line switches from a value of 1 to a value of 0, the receiver is alerted that a data
character is about to be sent.
Battery Operated DC Motors

Fig:3.16.battery operated DC motor


The direct current (DC) motor is one of the first machines devised to convert electrical power
into mechanical power. Permanent magnet (PM) direct current converts electrical energy into
mechanical energy through the interaction of two magnetic fields. One field is produced by a
permanent magnet assembly; the other field is produced by an electrical current flowing in the
motor windings. These two fields result in a torque which tends to rotate the rotor. As the rotor
turns, the current in the windings is commutated to produce a continuous torque output. The
stationary electromagnetic field of the motor can also be wire-wound like the armature (called
a wound-field motor) or can be made up of permanent magnets (called a permanent magnet
motor).
In either style (wound-field or permanent magnet) the commutator acts as half of a mechanical
switch and rotates with the armature as it turns. The commutator is composed of conductive

Department of ECE Page 26 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

segments (called bars), usually made of copper, which represent the termination of individual
coils of wire distributed around the armature. The second half of the mechanical switch is
completed by the brushes. These brushes typically remain stationary with the motor's housing
but ride (or brush) on the rotating commutator. As electrical energy is passed through the
brushes and consequently through the armature a torsional force is generated as a reaction
between the motor's field and the armature causing the motor's armature to turn. As the
armature turns, the brushes switch to adjacent bars on the commutator. This switching action
transfers the electrical energy to an adjacent winding on the armature which in turn
perpetuates the torsional motion of the armature.
Permanent magnet (PM) motors are probably the most commonly used DC motors, but there
are also some other type of DC motors (types which use coils to make the permanent magnetic
field also) .DC motors operate from a direct current power source. Movement of the magnetic
field is achieved by switching current between coils within the motor. This action is called
"commutation". Very many DC motors (brush-type) have built-in commutation, meaning that
as the motor rotates, mechanical brushes automatically commutate coils on the rotor. You can
use dc-brush motors in a variety of applications.
A simple, permanent-magnet dc motor is an essential element in a variety of products, such as
toys, servo mechanisms, valve actuators, robots, and automotive electronics. There are several
typical advantages of a PM motor.When compared to AC or wound field DC motors,PM
motors are usually physically smaller in overall size and lighter for a given power rating.
Furthermore, since the motor's field, created by the permanent magnet, is constant, the
relationship between torque and speed is very linear. A PM motor can provide relatively high
torque at low speeds and PM field provides some inherent self-braking when power to the
motor is shutoff. There are several disadvantages through, those being mostly being high
current during a stall condition and during instantaneous reversal. Those can damage some
motors or be problematic to control circuitry. Furthermore, some magnet materials can be
damaged when subjected to excessive heat and some loose field strength if the motor is
disassembled.
High-volume everyday items, such as hand drills and kitchen appliances, use a dc servomotor
known as a universal motor. Those universal motors are series-wound DC motors, where the
stationary and rotating coils are wires in series. Those motors can work well on both AC and
DC power. One of the drawbacks/precautions about series-wound DC motors is that if they are

Department of ECE Page 27 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

unloaded, the only thing limiting their speed is the windage and friction losses. Some can
literally tear themselves apart if run unloaded.
A brushless motor operates much in the same way as a traditional brush motor. However, as
the name implies there are no brushes (and no commutator). The mechanical switching
function, implemented by the brush and commutator combination in a brush-type motor, is
replaced by electronic switching in a brushless motor. In a typical brushless motor the
electromagnetic field, created by permanent magnets, is the rotating member of the motor and
is called a rotor. The rotating magnetic field is generated with a number of electromagnets
commutatated with electronics switches (typically transistors or FETs) in a right order at right
speed. In a brushless motor, the trick becomes to know when to switch the electrical energy in
the windings to perpetuate the rotating motion.This is typically accomplished in a brushless-
type motor by some feedback means designed to provide an indication of the position of the
magnet poles on the rotor relative to the windings. A hall effect device (HED) is a commonly
used means for providing this positional feedback. In some applications brushless motors are
commutated without sensors or with the use of an encoder for positional feedback.A brushless
motor is often used when high reliability, long life and high speeds are required. The bearings
in a brushless motor usually become the only parts to wear out.
In applications where high speeds are required (usually above 30,000 RPM) a brushless motor
is considered a better choice (because as motor speed increases so does the wear of the
brushes on traditional motors). A brushless motor's commutation control can easily be
separated and integrated into other required electronics, thereby improving the effective
power-to-weight and/or power-to-volume ratio. A brushless motor package (motor and
commutation controller) will usually cost more than a brush-type, yet the cost can often be
made up in other advantages. For example, in applications where sophisticated control of the
motor's operation is required. Brushless motors are seen nowadays in very many computer
application, they for example rotate normal PC fans, hard disks and disk drives. Sometimes
the rotation direction needs to be changed. In normal permanent magnet motors, this rotation
is changed by changing the polarity of operating power (for example by switching from
negative power supply to positive or by inter-changing the power terminals going to power
supply). This direction changing is typically implemented using relay or a circuit called an H
bridge. There are some typical characteristics on "brush-type" DC motors.
When a DC motor is straight to a battery (with no controller), it draws a large surge current
when connected up. The surge is caused because the motor, when it is turning, acts as a
Department of ECE Page 28 MEA Engineering College
ProjectReport2016-17 Intelligent patient care system

generator. The generated voltage is directly proportional to the speed of the motor. The current
through the motor is controlled by the difference between the battery voltage and the motor's
generated voltage (otherwise called back EMF). When the motor is first connected up to the
battery (with no motor speed controller) there is no back EMF. So the current is controlled
only by the battery voltage, motor resistance (and inductance) and the battery leads. Without
any back emf the motor, before it starts to turn, therefore draws the large surge current. When
a motor speed controller is used, it varies the voltage fed to the motor. Initially, at zero speed,
the controller will feed no voltage to the motor, so no current flows. As the motor speed
controller's output voltage increases, the motor will start to turn. At first the voltage fed to the
motor is small, so the current is also small, and as the motor speed controller's voltage rises, so
too does the motor's back EMF. The result is that the initial current surge is removed,
acceleration is smooth and fully under control. Motor speed control of DC motor is nothing
new. A simplest method to control the rotation speed of a DC motor is to control it's driving
voltage. The higher the voltage is, the higher speed the motor tries to reach.
In many applications a simple voltage regulation would cause lots of power loss on control
circuit, so a pulse width modulation method (PWM)is used in many DC motor controlling
applications. In the basic Pulse Width Modulation (PWM) method, the operating power to the
motors is turned on and off to modulate the current to the motor. The ratio of "on" time to
"off" time is what determines the speed of the motor. When doing PWM controlling, keep in
mind that a motor is a low pass device. The reason is that a motor is mainly a large inductor. It
is not capable of passing high frequency energy, and hence will not perform well using high
frequencies. Reasonably low frequencies are required, and then PWM techniques will work.
Lower frequencies are generally better than higher frequencies, but PWM stops being
effective at too low a frequency. The idea that a lower frequency PWM works better simply
reflects that the "on" cycle needs to be pretty wide before the motor will draw any current
(because of motor inductance). A higher PWM frequency will work fine if you hang a large
capacitor across the motor or short the motor out on the "off" cycle (e.g. power/brake pwm)
The reason for this is that short pulses will not allow much current to flow before being cut
off. Then the current that did flow is dissipated as an inductive kick - probably as heat through
the fly-back diodes. The capacitor integrates the pulse and provides a longer, but lower,
current flow through the motor after the driver is cut off. There is not inductive kick either,
since the current flow isn't being cut off. Knowing the low pass roll-off frequency of the motor
helps to determine an optimum frequency for operating PWM. Try testing your motor with a

Department of ECE Page 29 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

square duty cycle using a variable frequency, and then observe the drop in torque as the
frequency is increased. This technique can help determine the roll off point as far as power
efficiency is concerned.Besides "brush-type"DC motors, there is another DC motor
type:brushless DC motor. Brushless DC motors rely on the external power drive to perform
the commutation of stationary copper winding on the stator.
This changing stator field makes the permanent magner rotor to rotate.A brushless permanent
magnet motor is the highest performing motor in terms of torque / vs. weight or efficiency.
Brushless motors are usually the most expensive type of motor. Electronically commutated,
brush-less DC motor systems are widely used as drives for blowers and fans used in
electronics, telecommunications and industrial equipment applications.There is wide variety of
different brush-less motors for various applications. Some are designed to to rotate at constant
speed (those used in disk drives) and the speed of some can be controlled by varying the
voltage applied to them (usually the motors used in fans).
Some brushless DC motors have a built-in tachometer which gives out pulses as the motor
rotates (this applies to both disk drive motors and some computer fans). In general, users
select brush-type DC motors when low system cost is a priority, and brushless motors to fulfil
other requirements (such as maintenance-free operation, high speeds, and explosive
environments where sparking could be hazardous). Brush type DC motors are used in very
many battery powered appliances. Brushless DC motors are commonly used in applications
like DC powered fans and disk drive rotation motors.

Department of ECE Page 30 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 4

CIRCUIT DIAGRAM AND DESCRIPTION

Department of ECE Page 31 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Doctor/Authorized person can configure timing of Medicines via Android app using Cloud
communication. By using GSM data communication was easy to build into the system. When
a GSM modem is connected to a computer, this allows the computer to use GSM modem to
communicate over the mobile network. While this modem are most frequently used to provide
mobile internet connectivity, many of them can also be used for sending and receiving SMS
and MMS messages.RS232 is connected to GPRS modem and it is bi directionally connected
to micro controller. RS232 used to transferring and receiving the serial data between
devices.Once the start bit has been sent, the transmitter sends the actual data bits. There may
either be receiver and the transmitter must agree on the number of data bits, as well as the
baud rate. Time seletion,number of tray controlled by android mobile app. LCD display will
give more 5, 6, 7, or 8 data bits, depending on the number you have selected. Both information
about amount and number of tray.Apply the data or commands to DB0 to DB7 pins of LCD.
Automatic alarm alert the message at time of taking medicine. PIR sensor measure infrared
light radiating from patient or caregiver in its field of view. DC motor rotate the medicine
container and proper medicine will come out as instruction given in mobile app.L293D
driverIC used to convert 5v dc supply to 12v needed for dc motor to run. IR sensor sense
weather the patient taking medicine or not. If one do not take medicine after10 minutes from
container it will close automatically. And send alert messages to doctor or authorized persons
and they can reset the setting if wanted any change.

Department of ECE Page 32 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 5

PROGRAM DESIGNING
5.1.mikroc
5.11.intodunction

MikroC is a powerful, feature rich development tool for PIC microcontrollers. It is designed
to provide the programmer with the easiest possible solution for developing applications for
embedded systems, without compromising performance or control.

Fig:5.1.mikroc

PIC and C fit together well: PIC is the most popular 8-bit chip in the world, used in a wide
variety of applications, and C, prized for its efficiency, is the natural choice for developing
embedded systems. MikroC provides a successful match featuring highly advanced IDE,
ANSI compliant compiler, broad set of hardware libraries, comprehensive documentation, and
plenty of ready-to-run examples.

Department of ECE Page 33 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Feature

MikroC allows quickly develop and deploy complex applications:

Write our C source code using the built-in Code Editor (Code and Parameter Assistants,
Syntax Highlighting, Auto Correct, Code Templates, and more) Use the included
mikroC libraries to dramatically speed up the development: data acquisition, memory,
displays, conversions, communications Practically all P12, P16, and P18 chips are
supported.
Monitor program structure, variables, and functions in the Code Explorer.
Generate commented, human-readable assembly, and standard HEX compatible with all
programmers.
Inspect program flow and debug executable logic with the integrated Debugger.
Get detailed reports and graphs: RAM and ROM map, code statistics, assembly listing,
calling tree, and more
Provided plenty of examples for expand, develop, and use as building bricks in our
projects. Copy them entirely if we deem fit thats why we included them with the
compiler.

5.12.mikroc design programming

#define PIR RA0

#define IRTray RD0

#define IRTake RD1

#define TrayMotor1 RD4

#define TrayMotor2 RD5

#define Buzzer RD3

// ===================Variables:

Department of ECE Page 34 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

char i;

int TimeOut=0;

char
TimeSet=0,UpdateCurrentTime=0,Count=0,MCnt=0,TimeOk=0,TimeUpdate=0,MedOk=
0,MedUpdate=0;

char MTray1Select,MTray2Select,MTray3Select;

char NTray1Select,NTray2Select,NTray3Select;

char ETray1Select,ETray2Select,ETray3Select;

char Tray1Select,Tray2Select,Tray3Select,WhichTime,WhichTray;

bank1 char AllOk[7];

char Medicine1Count,Medicine2Count,Medicine3Count;

bank1 char
InputTime[6],LastMedicineTime[6],TempTime[6],CurrentTime[6],MorningTime[6],Noon
Time[6],EveTime[6];

bank1 char Tray1Name[5],Tray2Name[5],Tray3Name[5],MedicineName[5];

// ==============================

// ===================Functions:

void Beep (void) {

Buzzer=1;

Delay_Ms (100);

Buzzer=0;

Department of ECE Page 35 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Delay_Ms (100);

//------------------------------

void TrayRotate (void) {

int Sec=0;

Lcd_Out (1,0,"Rotating ");

// Tray1:====================================

while(IRTray==1) {

TrayMotor1=1;

TrayMotor2=0;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

while(IRTray==0){

TrayMotor1=1;

TrayMotor2=0;

Delay_Ms(10);

TrayMotor1=0;

Department of ECE Page 36 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

TrayMotor2=0;

Delay_Ms(50);

Beep ();

if (Tray1Select=='0') {

Lcd_Out(1,0," ");

Lcd_Out(1,0,Tray1Name);

while (IRTake==0);

Delay_Ms(50);

while (IRTake==1);

Lcd_Out (1,0,"Continue In :");

Sec=10;

while (Sec--) {

Lcd_Out_2Digit(1,14,Sec);

Delay_Ms(1000);

Medicine1Count--;

Lcd_Out (1,0,"Rotating ");

// Tray2:====================================

Department of ECE Page 37 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

while(IRTray==1) {

TrayMotor1=1;

TrayMotor2=0;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

while(IRTray==0){

TrayMotor1=1;

TrayMotor2=0;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

Beep ();

if (Tray2Select=='0') {

Lcd_Out(1,0," ");

Lcd_Out(1,0,Tray2Name);

Department of ECE Page 38 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

while (IRTake==0);

Delay_Ms(50);

while (IRTake==1);

Lcd_Out (1,0,"Continue In :");

Sec=10;

while (Sec--) {

Lcd_Out_2Digit(1,14,Sec);

Delay_Ms(1000);

Medicine2Count--;

Lcd_Out (1,0,"Rotating ");

// Tray3:====================================

while(IRTray==1) {

TrayMotor1=1;

TrayMotor2=0;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

Department of ECE Page 39 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

while(IRTray==0){

TrayMotor1=1;

TrayMotor2=0;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

Beep ();

if (Tray3Select=='0') {

Lcd_Out(1,0," ");

Lcd_Out(1,0,Tray3Name);

while (IRTake==0);

Delay_Ms(50);

while (IRTake==1);

Lcd_Out (1,0,"Continue In :");

Sec=10;

while (Sec--) {

Lcd_Out_2Digit(1,14,Sec);

Department of ECE Page 40 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Delay_Ms(1000);

Medicine3Count--;

// Done All Trays=============================

Beep ();

Beep ();

// Reach Reference:===========================

Lcd_Out (1,0,"Reversing ");

// Pass Tray 3:

while(IRTray==1) {

TrayMotor1=0;

TrayMotor2=1;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

while(IRTray==0) {

TrayMotor1=0;

Department of ECE Page 41 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

TrayMotor2=1;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

Beep ();

// Pass Tray 2:

while(IRTray==1) {

TrayMotor1=0;

TrayMotor2=1;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

while(IRTray==0) {

TrayMotor1=0;

TrayMotor2=1;

Delay_Ms(10);

Department of ECE Page 42 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

Beep ();

// Pass Tray 1:

while(IRTray==1) {

TrayMotor1=0;

TrayMotor2=1;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Delay_Ms(50);

while(IRTray==0) {

TrayMotor1=0;

TrayMotor2=1;

Delay_Ms(10);

TrayMotor1=0;

TrayMotor2=0;

Department of ECE Page 43 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Delay_Ms(50);

Beep ();

Beep ();

Lcd_Out (1,0,"Reached Reference");

Delay_Ms(2000);

Lcd_Out (1,0," ");

//-------------------------------------

void TrayStop (void) {

TrayMotor1=0;

TrayMotor2=0;

//-------------------------------------

void SendDataToIOT (int Type) {

Lcd_Out (1,0,"Sending Data ");

if (Type==1) {

Usart_Write_String ("*vibrate*Medicine is not Taken");

Department of ECE Page 44 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

else if (Type==2) {

Usart_Write_String ("*nothing*Normal");

else if (Type==3) {

Usart_Write_String ("*vibrate*Medicine 1 is Low");

else if (Type==4) {

Usart_Write_String ("*vibrate*Medicine 2 is Low");

else if (Type==5) {

Usart_Write_String ("*vibrate*Medicine 3 is Low");

Delay_Ms(2000);

Lcd_Out (1,0,"Data Sent ");

Delay_Ms(1000);

Lcd_Out (1,0," ");

//------------------------------

void DisplayTime (void) {

Department of ECE Page 45 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Lcd_Out (1,11,CurrentTime);

//-------------------------------------

void UpdateTime (void) {

TempTime[0]=InputTime[0];

TempTime[1]=InputTime[1];

TempTime[2]=':';

TempTime[3]=InputTime[2];

TempTime[4]=InputTime[3];

TempTime[5]='\0';

if (strcmp(TempTime,CurrentTime)!=0) {

CurrentTime[0]=TempTime[0];

CurrentTime[1]=TempTime[1];

CurrentTime[2]=':';

CurrentTime[3]=TempTime[3];

CurrentTime[4]=TempTime[4];

CurrentTime[5]='\0';

UpdateCurrentTime=0;

TimeSet=1;

Department of ECE Page 46 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

//-------------------------------------

void UpdateMTime (void) {

MorningTime[0]=InputTime[0];

MorningTime[1]=InputTime[1];

MorningTime[2]=':';

MorningTime[3]=InputTime[2];

MorningTime[4]=InputTime[3];

MorningTime[5]='\0';

AllOk[0]='1';

//-------------------------------------

void UpdateNTime (void) {

NoonTime[0]=InputTime[0];

NoonTime[1]=InputTime[1];

NoonTime[2]=':';

NoonTime[3]=InputTime[2];

NoonTime[4]=InputTime[3];

Department of ECE Page 47 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

NoonTime[5]='\0';

AllOk[1]='1';

//-------------------------------------

void UpdateETime (void) {

EveTime[0]=InputTime[0];

EveTime[1]=InputTime[1];

EveTime[2]=':';

EveTime[3]=InputTime[2];

EveTime[4]=InputTime[3];

EveTime[5]='\0';

AllOk[2]='1';

//-------------------------------------

void UpdateTray1Name (void) {

int i=0;

while (i<MCnt){

Tray1Name[i]=MedicineName[i];

Department of ECE Page 48 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

i++;

Tray1Name[i]='\0';

AllOk[3]='1';

//-------------------------------------

void UpdateTray2Name (void) {

int i=0;

while (i<MCnt){

Tray2Name[i]=MedicineName[i];

i++;

Tray2Name[i]='\0';

AllOk[4]='1';

//-------------------------------------

void UpdateTray3Name (void) {

int i=0;

Department of ECE Page 49 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

while (i<MCnt){

Tray3Name[i]=MedicineName[i];

i++;

Tray3Name[i]='\0';

AllOk[5]='1';

// AllOk[6]='\0';

//-------------------------------------

void ChangeTime (void) {

if (WhichTime=='1') {

UpdateMTime ();

else if (WhichTime=='2') {

UpdateNTime ();

else if (WhichTime=='3') {

UpdateETime ();

Department of ECE Page 50 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

// WhichTime='0';

//------------------------------------

void ChangeMedicine (void) {

if (WhichTray=='1') {

UpdateTray1Name ();

else if (WhichTray=='2') {

UpdateTray2Name ();

else if (WhichTray=='3') {

UpdateTray3Name ();

// WhichTray='0';

void ClearDataBuff (void) {

char i;

for (i=0;1<30;i++) {

DataBuff[i]=' ';

Department of ECE Page 51 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

void CheckSerialComm(void){

char DataBuff[25],DataCnt=0;

if (Usart_Data_Ready ()==1) {

while (Usart_Data_Ready ()==1) {

DataBuff[DataCnt++]=Usart_Read ();

if (DataCnt>=7) {

if(DataBuff[0]=='*') {

DataBuff[DataCnt]='\0';

DataBuff[14]='\0';

Lcd_Out(2,0," ");

Lcd_Out(2,0,&DataBuff[1]);

DataCnt=0;

else if (DataBuff[0]=='&') {

Lcd_Out (1,15,"T");

InputTime[0]= DataBuff[1];

InputTime[1]= DataBuff[2];

Department of ECE Page 52 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

InputTime[2]= DataBuff[4];

InputTime[3]= DataBuff[5];

// Usart_Write_String(InputTime);

UpdateCurrentTime=1;

DataCnt=0;

else if (DataBuff[0]=='#') {

Count=1;

if (DataBuff[Count]!='%') {

WhichTime=DataBuff[Count];

TimeOk=1;

Count++;

Count++;

else {

Count++;

if (DataBuff[Count]!='%' && TimeOk==1) {

InputTime[0]=DataBuff[Count];

Count++;

Department of ECE Page 53 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

else {

Count++;

if (DataBuff[Count]!='%' && TimeOk==1) {

InputTime[1]=DataBuff[Count];

Count++;

Count++;

else {

Count++;

if (DataBuff[Count]!='%' && TimeOk==1) {

InputTime[2]=DataBuff[Count];

Count++;

else {

Count++;

if (DataBuff[Count]!='%' && TimeOk==1) {

Department of ECE Page 54 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

InputTime[3]=DataBuff[Count];

TimeUpdate=1;

Count++;

Count++;

else {

Count++;

if (DataBuff[Count]!='%') {

if (TimeOk==1) {

if (WhichTime=='1') {

MTray1Select=DataBuff[Count];

else if (WhichTime=='2') {

NTray1Select=DataBuff[Count];

else if (WhichTime=='3') {

ETray1Select=DataBuff[Count];

// Tray1Select=InputString[Count];

Department of ECE Page 55 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Count++;

Count++;

else {

Count++;

if (DataBuff[Count]!='%') {

if (TimeOk==1) {

if (WhichTime=='1') {

MTray2Select=DataBuff[Count];

else if (WhichTime=='2') {

NTray2Select=DataBuff[Count];

else if (WhichTime=='3') {

ETray2Select=DataBuff[Count];

// Tray1Select=InputString[Count];

Count++;

Department of ECE Page 56 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Count++;

else {

Count++;

if (DataBuff[Count]!='%') {

if (TimeOk==1) {

if (WhichTime=='1') {

MTray3Select=DataBuff[Count];

else if (WhichTime=='2') {

NTray3Select=DataBuff[Count];

else if (WhichTime=='3') {

ETray3Select=DataBuff[Count];

// Tray1Select=InputString[Count];

Count++;

Count++;

Department of ECE Page 57 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

else {

Count++;

if (DataBuff[Count]!='%') {

WhichTray=DataBuff[Count];

MedOk=1;

Count++;

Count++;

else {

Count++;

if (DataBuff[Count]!='%' && MedOk==1) {

MCnt=0;

while (Count<DataCnt) {

MedicineName[MCnt++]=DataBuff[Count];

Count++;

Department of ECE Page 58 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

MedUpdate=1;

Count=0;

DataCnt=0;

void main(void) {

TRISA = 0b11111111;

TRISB = 0b00000001;

TRISC = 0b10010100;

TRISD = 0b11000111;

Buzzer=0;

TrayStop ();

Lcd_Init(&PORTB);

Usart_Init(9600);

Lcd_Out(1,0," MEA ");

Department of ECE Page 59 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

Lcd_Out(2,0," 2016-2017 ");

Delay_Sec(2);

Lcd_Out(1,0," MEDI-CARE ");

Lcd_Out(2,0," ");

Delay_Ms (1000);

Lcd_Out(1,0," ");

Lcd_Out(2,0," ");

AllOk[0]='0'; AllOk[1]='0'; AllOk[2]='0'; AllOk[3]='0'; AllOk[4]='0'; AllOk[5]='0';


AllOk[6]='\0';

Medicine1Count=5; Medicine2Count=5; Medicine3Count=5;

CurrentTime[0]='H';

CurrentTime[1]='H';

CurrentTime[2]=':';

CurrentTime[3]='M';

CurrentTime[4]='M';

CurrentTime[5]='\0';

LastMedicineTime[0]='H';

LastMedicineTime[1]='H';

LastMedicineTime[2]=':';

LastMedicineTime[3]='M';

Department of ECE Page 60 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

LastMedicineTime[4]='M';

LastMedicineTime[5]='\0';

Lcd_Out (1,0,"Waiting Time....");

TimeSet=0;

while (TimeSet==0) {

CheckSerialComm ();

if (UpdateCurrentTime==1) {

UpdateTime ();

// UpdateCurrentTime=0;

Lcd_Out (1,0," ");

while(1) {

CheckSerialComm ();

if (UpdateCurrentTime==1) {

UpdateTime ();

UpdateCurrentTime=0;

} if (TimeSet==1) {

DisplayTime ();

Department of ECE Page 61 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

if (TimeOk==1 && TimeUpdate==1) {

ChangeTime ();

TimeOk=0;

TimeUpdate=0;

if (MedOk==1 && MedUpdate==1) {

ChangeMedicine ();

MedOk=0;

MedUpdate=0;

Lcd_Out (1,0,AllOk);

if (TimeSet==1 && (strcmp (AllOk,"111111")==0)) {

if (Medicine1Count<2) {

SendDataToIOT (3);

if (Medicine2Count<2) {

SendDataToIOT (4);

if (Medicine3Count<2) {

Department of ECE Page 62 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

SendDataToIOT (5);

if((strcmp(LastMedicineTime,CurrentTime)!=0) && ((strcmp


(CurrentTime,MorningTime)==0) || (strcmp (CurrentTime,NoonTime)==0) || (strcmp
(CurrentTime,EveTime)==0))) {

Lcd_Out (1,0,"Its Time ");

if ((strcmp (CurrentTime,MorningTime)==0)) {

Tray1Select=MTray1Select;

Tray2Select=MTray2Select;

Tray3Select=MTray3Select;

else if ((strcmp (CurrentTime,NoonTime)==0)) {

Tray1Select=NTray1Select;

Tray2Select=NTray2Select;

Tray3Select=NTray3Select;

else if ((strcmp (CurrentTime,EveTime)==0)) {

Tray1Select=ETray1Select;

Tray2Select=ETray2Select;

Tray3Select=ETray3Select;

}
Department of ECE Page 63 MEA Engineering College
ProjectReport2016-17 Intelligent patient care system

TimeOut=20;

while (Adc_Read(PIR)<250 && TimeOut-- && ((strcmp


(CurrentTime,MorningTime)==0) || (strcmp (CurrentTime,NoonTime)==0) || (strcmp
(CurrentTime,EveTime)==0))) {

Beep ();

Delay_Ms(300);

// Lcd_Out_2Digit (1,0,TimeOut);

if (TimeOut==-1) {

SendDataToIOT (1);

else {

LastMedicineTime[0]=CurrentTime[0];

LastMedicineTime[1]=CurrentTime[1];

LastMedicineTime[2]=CurrentTime[2];

LastMedicineTime[3]=CurrentTime[3];

LastMedicineTime[4]=CurrentTime[4];

LastMedicineTime[5]=CurrentTime[5];

TrayRotate ();

SendDataToIOT (2);

}
Department of ECE Page 64 MEA Engineering College
ProjectReport2016-17 Intelligent patient care system

Department of ECE Page 65 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 6

ADVANTAGES &DISADVANTAGES

6.1ADVANTAGES

Doctor/Authorized person can configure timing of Medicines via Android app using
cloud communication.
Automatic alarm and alert message at time of taking medicine.
If one miss to take medicine ,it send alert messages to doctor and authorized persons

6.2 DISADVANTAGES

Cloud communications has following drawbacks;


loss of data,
spiteful activity,
denial service,
breach of data
It requires continuous data connections.
Any individual can take medicine rather than patient or caregiver.

Department of ECE Page 66 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 7

PLAN OF ACTION

Identification of scope
Literature survey
Finalization of block diagram
Component identification
Simulation
Assembling
Final report

Department of ECE Page 67 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 8

METHODS AND METHEDOLOGY

8.1 .Identification of scope

It has been reported that wrong medicine box has been delivered to patient accidentally at
hospital's Inpatient Department, so the patient may take the wrong medicine and the medical
incident occurs consequently. In order to resolving this problem, it is necessary to design
intelligent medicine box monitoring and management system. This system integrates
technologies involving network, RFID, and touch screen. At the network, the system
monitors and controls the releasing process of medicine box through RFID label ring; dosing
time, notes and other relevant information for patients. Therefore the patient would be
reminded to take the medicine clearly and regularly.

8.2.Literature review

At present, medicine distribution and medication errors occur every year in the field of
medical, which not only caused serious consequences to the patient, also led to the increased
cost of medical treatment. At hospital's inpatient department, nurse distributed the medicine
to patients every day. The nurse usually put the patient's medicine indifferent medicine
boxes, and then put the medicine boxes distribute to each patient, at the same time, described
method of taking the medicine, but each time distributed many medicine boxes, it is hard to
avoid mistakes. The medicine instructions are showed not enough detail, patients take the
wrong medicine, or can't remember dosing time and method, that might lead to serious
medical accidents. Therefore, with the use of the Internet of things technology, the present
paper designs a set of intelligent medicine box monitoring and management system to solve
the above problems

Department of ECE Page 68 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

8.3.Finalization of block diagram

The RTC will maintained the correct time of the microcontroller and the buzzer will ring at
scheduled time. The medicine container will come out and wait for some times. The PIR
sensor sense the patient presents, if the patient take medicine it automatically close or the
device will send the message to the doctor or authorized person if the patient fail to take
medicines. So,they can reprogrammed the device

Department of ECE Page 69 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

CHAPTER 9

CONCLUSION

From this project INTELLIGENT PAITENT CARE SYSTEM we can conclude that this
system will act as second hand to the patient . Therefore the patient would be reminded to take
the medicine timely. The system could effectively resolve the problem of negligence and mis
operation when medicine distribution, and as well avoid the accidental medicine taking for
patient.
9.1.RESULT

Fig:10.1.intelligent patient care system r

Department of ECE Page 70 MEA Engineering College


ProjectReport2016-17 Intelligent patient care system

REFERENCES

XuejiaoCAO School of Mechanical Engineering Tianjin University of Technology


and Education Tianjin, China e-mail: jiao20080120@126.com
Zhaohua LIU School of Mechanical Engineering Tianjin University of Technology
and Education Tianjin, China e-mail: liuzhaohuamail@163.com
Weixi XIA Tianjin ShangZhou technology co., LTD Tianjin, China e-mail:
flystarxwx@163.com
Zhou Yingfeng, Yang Honghong, Qin Wei,et al. Systematic evaluation on
prevention and nursing management strategies of medication errors in elderly
inpatients[J]. CHINESE NURSING RESEARCH, 2013(27):2548-2553.
Yu Lei, Lu Yang, Zhu Xiaoling, Feng Lin. Research advances on technology of
Internet of things in medical domain[J]. Application Research of Computers,
2012(29):1-7.
Wang Rui, Zhao Yan. RFID Technology and Structure of Its Application Systems[J].
Communications Technology, 2009(42):116118.
Yang Yuqin, Li Yaning. The Technology and Market Analysis of Touch Screen[J].
Information Recording Materials,2009(42):116-118
ttps://en.wikipedia.org/wiki/PIC_microcontroller
https://en.wikipedia.org/wiki/Serial_communication

Department of ECE Page 71 MEA Engineering College

Potrebbero piacerti anche