You are on page 1of 40

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

JNANA SANGAMA, BELGAVI 590018

A
PROJECT REPORT
ON
PROJECT TITLE
“Improving Healthcare using Smart pill box for Medicine Remainder and
Monitoring System”

BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
SUBMITTED BY
NAME
Aysha Shazi M B 4KV18EC003
Nida Fathima 4KV18EC021
Pallavi K S 4KV18EC022
Poorvitha K M 4KV18EC024
Under the guidance of
Mrs. Aruna PG
Assistant Professor B.Tech, M.Tech
Dept of Electronics and communication Engineering
KVG College of Engineering Sullia

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
KVG COLLEGE OF ENGINEERING
Kurunjibhag, Sullia, D. K. 574327

Department of Electronics and Communication Engineering

Certificate
Certified that the Project Work entitled “Improving Healthcare using Smart pill box for
Medicine Reminder and Monitoring System” is a bonafide work carried out by Ms Aysha
Shazi M B (4KV18EC003), Ms Nida Fathima (4KV18EC021), Ms Pallavi K S
(4KV18EC022), Ms Poorvitha K M (4KV18EC024) in partial fulfillment for the award of
Bachelor of Engineering in Electronics and Communication Engineering of the Visvesvaraya
Technological University, Belgaum during the year 2021-2022. It is certified that all the
corrections/suggestions indicated for internal assessment have been in corporated in the
report deposited in the departmental library. The Project Report has been approved as it
satisfies the academic requirements in respect of Project Work prescribed for the said degree.

Signature of Guide Signature of HOD Signature of The Principal


[Aruna P G] [Dr. Kusumadhar S.] [Dr. Suresha V.]

Name of the Examiners Signature with Date

1.

2.
DECLARATION
We, Ms Aysha Shazi M B (4KV18EC003), Ms Nida Fathima (4KV18EC021), Ms Pallavi K S
(4KV18EC022), Ms Poorvitha K M (4KV18EC024) hereby declare that the project work
entitled “Improving Healthcare using Smart pill box for Medicine Reminder and Monitoring
System” has been independently carried out by us under the guidance of Mrs Aruna P G,
Assistant Professor, Department of Electronics and Communication Engineering, KVG College
of Engineering, Sullia, in partial fulfillment of the requirements of the degree of Bachelor of
Engineering in Electronics and Communication Engineering of Visvesvaraya Technological
University, Belgaum. We further declare that we have not submitted this report either in part
of in full to any other university for the reward of any degree.

Aysha Shazi M B
Nida Fathima
Pallavi K S
Poorvitha K M

Place: KVGCE, Sullia


Date:

ACKNOWLEDGEMENT
Behind every achievement there is an unfathomable sea of gratitude to those
who achieved it, without whom it would ever have been come into existence.
We are extremely grateful to almighty god for guarding and keeping us safe
from any misfortune befalling on us.
First and foremost we are thankful and express sincere gratitude to
our Mrs. Aruna P G Assistant Professor, Department of Electronics and
Communication Engineering for his valuable and Untiring help, Guidance,
Suggestions and Cooperation on through the emergent phase of project.
We express our gratitude to our project coordinator Mr. Lokesh P C, Assistant
Professor, Department of Electronics and Communication Engineering for his
valuable help and co-operation on through the emergent phase of project.
We also extremely grateful to Dr. KUSUMADHAR S., Professor and Head,
Department of Electronics and Communication Engineering, who was always a
source of inspiration and gave encouragement throughout the project.
We gratefully acknowledge for the help rendered by our beloved
Principal Dr. SURESHA V., for his constant encouragement to carry out this project.
We are indebted to Late. Dr. KURUNJI VENKATRAMANA GOWDA, Founder
President of A.O.L.E and Dr. RENUKAPRASAD K. V., General secretary, AOLE for all
the facilities he has provided that helped us in every means.
Finally, we take this opportunity to thank all the Teaching and Non-teaching
staff of the Department of Electronics and Communication Engineering, for
excellent cooperation and support they have provided.

ABSTRACT
Our project’s main aim is to make a Smart pill box for those users who regularly
take medicines and the prescription of their medicine is very long as it is hard to
remember to patients and also for their care giver. Also, Old age patients suffer from
problems of forget to take pills on proper time which causes certain health issues for
patients having Permanent diseases like diabetes, blood pressure, breathing problem,
heart problems, cancer diseases etc.

We saw these problems in hospitals & people around us who have such kind of
diseases and thus based on these two problems we made smart pill box which solve these
problems by Setting up time table of prescribed medicines as given in prescription.
Therefore, at the time of taking medicine system generates Buzzer so as to remind the
patients to take medicines on time. So, patient can know the specific number of boxes
from which he has to take out medicines. All pill boxes are pre-loaded in the system
which patient needs to take at given time. Thus, final result of our system provides fast
curing of patient health by using our advantageous system.
Table of Content
CONTENT Page No.

ABSTRACT
CHAPTER 1 INTRODUCTION
CHAPTER 2 LITERATURE SURVEY
CHAPTER 3 METHODOLOGY
3.1 Block Diagram
3.2 Design Methodology
3.3 Hardware description
3.3.1 IR Obstacle sensor
3.3.2 Gear Motor
3.3.3 Motor Drive
3.3.4 Node MCU
3.3.5 ESP8266
3.3.6 Buzzer
3.3.7 LCD Display
3.4 Software Description
3.4.1 Flow Chart
3.4.2 Program Flow
3.4.3 Program Implementation
3.4.4 Integrated functional representation
3.4.5 Webserver API Implementation
3.5 App used
CHAPTER 4 RESULTS
CHAPTER 5 5.1 Advantages
5.2 Disadvantages
CHAPTER 6 CONCLUSION
CHAPTER 7 FUTURE SCOPE
REFERENCES
LIST OF FIGURES

FIGURE NO NAME OF FIGURE PAGE NO

3.1 Block Diagram


3.3.1 IR Sensor

3.3.2 Gear Motor

3.3.3 Motor Drive

3.3.4 Node MCU

3.3.5 ESP8266

3.3.6 Buzzer

3.3.7 LCD Display

3.4.1 Flow Chart

3.4.4 Functional Representation

3.5 App Used


CHAPTER 1

INTRODUCTION
Medication is the concern throughout the healthcare industry with doctors, healthcare
systems, since the elderly or senior patient’s medication has a big problem of drugs misuse. It
is very often that they may forget to take their pills on time. Mainly, those who take a greater
number of medications at the same time. Also, they might take wrong dosage accidentally
which may lead to death. This clearly proves that it is a widespread problem and clearly
related to adverse patient outcomes and higher healthcare costs. Unfortunately, people who
have to take multiple medicines at same time at once, they might forget to take medicines on
time or they may forget to take medicine at the particular prescribed time. This will result in
improper usage of medication, especially among the elderly patients. It is very serious issue
for them to take the medication as per the prescribed dose and duration. Considering this
issue, they may need family members help to remind them the medication schedule.

This project aims at creation of a prototype of a smart medication dispenser to help in


managing the treatments of older people. Besides that, we wanted to have a solution that
caregivers could easily use and that allowed them to remotely accompany the compliance to
the treatment. Elderly and sick people have to take medication due to their illness and various
diseases multiple times a day. Sometimes the number of medications will be more than three
four times a day. Typically, they are prescribed several different types of medicines those
must be taken in a different amount of dosages. Most of the elderly populations use the
minimum of three to four prescriptions on a daily basis all over the world, also they have to
keep track of the correct times in which they are told to take their medicines by their doctors.
Majority of elderly people may not have that much money to afford a full-time nurse to assist
them for their medication purpose.

The main purpose of system is to help the patients, primarily seniors, take their
medications on time in an easy way without the possibility of missing pills. It will reduce the
risk of accidental overdose. The medicine dispenser could solve such problems by informing
and alerting the patients to take the appropriate dose at the right time. Use of medicine
dispenser in a day to day life is making life much better. The motive is to keep the device
simple and cost-efficient. Specially designed for the elderly and sick people who need all day
medication and who cannot take proper medicines on their own. The benefit is flexibility and
extensibility. The software used is reliable and understandable. This is a simple initiative to
help the elderly and sick people who live alone and face problems taking their medicines time
to time properly.

Existing devices for organizing and delivering tablet to patients lack many key features,
many devices are too expensive to be purchased by the average consumer and mainly elderly
people who can’t afford to pay Expensive devices. Our medicine dispenser considers the
entire problem faced by the elderly population to take medication at proper time with less
expensive device.
CHAPTER 2

LITERATURE SURVEY

[1] Juan Marcelo Parra 1 conducted experiment on Intelligent pill box: automatic and
programmable assistive technology device. "The Intelligent PillBox" allows the
organization of several medication schedules that health disorders presented in elderly need
basically. Arduino Mega 2560 was took as the principal controller. This prototype contains; a
programmable alarm system with an automatic opening and closing system, an interactive
user interface and a notification system through GSM network.
The development of this device is focused in the support of elderly people and other
vulnerable groups that may need for an assisted care.

[2] Ibrahim Adabara conducted an experiment on Patient Medication Reminder Circuit


Using ATMEGA328/P Microcontroller: Design and Implementation. This project patient
medication reminder is a system which helps in medication administration and monitoring.
This system consists of an ATMEGA328P microcontroller with an inbuilt EEPROM
and a real-time circuit. This system is driven by an embedded program that inputs predefined
parameters which are processed based on the input variables entered via a user interface
device such as the keypad. All the entries made on the keypad are 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 which displays the
medicine to be taken at the reminder time.

[3] Bharat Bhushan singh1, SahilUpadhyay2, MalikSumra3 Bharat made an attempt on


GSM Based Automatic Pill Dispenser. The proposed system is designed to help these
patients to take the required medicine in the right quantity at the right time. The basic
ideology is integrating the principle of 16x2 LCD with motor driver circuit on a normal pill
box. To make it more state-of-the-art, it is inbuilt with a GSM module for alerting the patient
and also the chemist at the needed instant.
[4] Vishal Tank conducted experiment on Dispensing Machine Using Raspberry Pi and
Arduino Controller. Accessibility to basic healthcare is an important cornerstone of
development towards building a healthy future. This paper presents machine designed to
provide such healthcare at areas where having a medical store may not feasible or possible. It
allows the user to select a medicine, pay the required amount after which it verifies the
amount received and dispenses the medicine. The amount is authenticated and identified
using an image processing unit controlled by Raspberry Pi, a credit card sized controller
capable of processing still images. The payment module and medicine dispensing module are
controlled by the Arduino, a microcontroller based development board. The communication
between the Raspberry Pi and Arduino controllers is serial, through a USB cable. The
machine is powered by a regular power outlet of 230V (alternating current).
Due to the physical and infrastructural limitations in establishing a medical store at
remote areas, this machine has been designed to be a standalone unit, requiring minimum
supervision to operate for long periods of time.

[5] Mrityunjaya D H1, Kartik J Uttarkar2, Teja B3, Kotresh Hiremath4 experimented on
Automatic Pill Dispenser. Geriatrics Rely on their medications to keep them healthy, but
complex medication schedules can lead to mistakes like missing doses, taking incorrect
amounts, or taking medicines at the wrong times. These mistakes could lead to unnecessary
doctor or hospital visits, illness and even death. Hence there is a need to design a Medication
Dispensing Device that can help Geriatrics to take medication on schedule.
This would prevent unplanned hospital or doctor visits related to incorrect medication
use. This paper proposes a design of a smart device which dispenses the medications on the
prescribed schedule.

[6] Wissam Antoun, Ali Abdo and Suleiman Al-Yaman and Abdallah Kassem, Mustapha
Hamad and Chady El- Abdo and Moucary experimented on Smart Medicine Dispenser
(SMD). This paper presents a Smart Medicine Dispenser (SMD) prototype. The main
purpose of this system is to help the patients, primarily seniors, take their medications on
time in an easy way without the possibility of missing pills, also reduce the risk of over or
under dosing accidentally. Not taking medications correctly can have serious consequences
such as delayed recovery, illness and even death. The smart medicine dispenser (SMD) could
solve such problems by informing and alerting the patients to take the appropriate dose at the
right time. Also, it provides direct communication between the patients and the Care givers as
it will immediately notify the caregiver in case the patient missed his/her pill. In addition,
SMD provides the user with a touch interface available as an application on their Smart
phone which will allow them to remotely manage and control pill schedules and usage data.
CHAPTER 3
METHODOLOGY
3.1 Block Diagram

Fig 3.1 Block Diagram


3.2 Design Methodology
This is the hardware connection. Two IR Sensors is used here, One is connected to D5 pin of
the controller unit and other IR Sensor is connected to D6 pin of controller unit. Buzzer is
connected to pin D7 of the node MCU. It consist of a Motor drive and we also use two gear
motor M1 and M2. M1 is connected to D3 pin through Motor Drive and M2 is connected to
D4 pin of the controller unit using motor drive. We have LCD display connected to D1 and
D2 pin of the controller. IR Sensors consist of 3 pins at which 1st pin is connected to 5V
power supply, 2nd pin is connected to controller unit and the 3rd pin is connected to ground.
Whereas buzzer has 2 pins of which one is connected to ground and other to D7 pin of the
controller. LCD has 4 pins, which contains SCL, SDA, 5V and ground. Motor Drive Requires
12V power Supply.
This model consists of two boxes for different tablets with eight compartments each. The box
are rotated using the gear motor which is connected behind. This whole model requires power
supply and WiFi connection to process. We need to update the tablet counts using the app
called Medicine Reminder. The prescribed time is pre added in the program. The specified
medicine from the particular box will be released in to the container at the time which already
added in the program. At 9:00 AM both tablets will be released into the container, At 2:00 PM
tablet 1 will be released and at 7:00 PM tablet 2 will be released into the container. After
every one hour the database will be updated and will showcase in the LCD . LCD will also
notify to refill the tablets.

3.3 Hardware Description


3.3.1 IR OBSTACLE SENSOR
`In electronics, this sensor is analogous to human’s visionary senses which can be
used to detect an obstacle which is one of its common applications. In robotics, a group of
such modules are used so that a robot can follow a line pattern.

Fig 3.3.1 IR Sensor

WHAT IS AN IR SENSOR?
An IR sensor is a device which detects IR radiation falling on it. There are numerous
types of IR sensors that are built and can be built depending on the application. Proximity
sensors (Used in Touch Screen phones and Edge Avoiding Robots), contrast sensors (Used in
Line Following Robots) and obstruction counters/sensors (Used for counting goods and in
Burglar Alarms) are some examples, which use IR sensors.

WORKING MECHANISM
An IR sensor is basically a device which consists of a pair of an IR LED and a
photodiode which are collectively called a photo-coupler or an opto-coupler. The IR LED
emits IR radiation, reception and/or intensity of reception of which by the photodiode dictates
the output of the sensor.
Now, there are so many ways by which the radiation may or may not be able to reach the
photodiode. Let’s discuss a few.

Direct incidence
We may hold the IR LED directly in front of the photodiode, such that almost all the
radiation emitted, reaches the photodiode. This creates an invisible line of IR radiation
between the IR LED and the photodiode. Now, if an opaque object is placed obstructing this
line, the radiation will not reach the photodiode and will get either reflected or absorbed by
the obstructing object. This mechanism is used in object counters and burglar alarms.

Indirect Incidence
High school physics taught us that black color absorbs all radiation, and the color
white reflects all radiation. We use this very knowledge to build our IR sensor. If we place the
IR LED and the photodiode side by side, close together, the radiation from the IR LED will
get emitted straight in the direction to which the IR LED is pointing towards, and so is the
photodiode, and hence there will be no incidence of the radiation on the photodiode. Please
refer to the right part of the illustration given below for better understanding. But, if we place
an opaque object in front the two, two cases occur:

Reflective Surface
If the object is reflective, (White or some other light color), then most of the radiation
will get reflected by it, and will get incident on the photodiode. For further understanding,
please refer to the left part of the illustration below.

Non-reflective Surface
If the object is non-reflective, (Black or some other dark color), then most of the
radiation will get absorbed by it, and will not become incident on the photodiode. It is similar
to there being no surface (object) at all, for the sensor, as in both the cases, it does not receive
any radiation.
3.3.2 Gear Motor

Fig 3.3.2 Gear Motor


a gear motor is any electric motor coupled with a gear train. Gear motors use either AC
(Alternating Current) or DC (Direct Current) power. In most cases, the gear reducer is
intended to multiply the available output torque without increasing the power consumption of
the motor while maintaining a compact size. The trade off for torque multiplication is a
proportional reduction in the speed of the output shaft, and reduced overall efficiency. By
utilizing the proper gear technology and ratio for specific applications, the optimal output and
speed profiles can be obtained along with the perfect mechanical fit to unlock the maximum
value of your OEM equipment.

3.3.3 Motor Drive

Fig 3.3.3 Motor Drive

The DC motor drive is a type of amplifier or power modulator that integrate be-
tween the controller and a DC motor. It takes the low current and then converts
it into a high current which is appropriate for the motor. 
3.3.4 Node MCU

Fig 3.3.4 Node MCU

NodeMCU is an open-source Lua based firmware and development board specially targeted


for IoT based Applications. It includes firmware that runs on the ESP8266 Wi-Fi SoC from
Espressif Systems, and hardware which is based on the ESP-12 module.

3.3.5 ESP8266

Fig 3.3.5 ESP8266

An ESP8266 Wi-Fi module is a SOC microchip mainly used for the development of end-
point IoT (Internet of things) applications. It is referred to as a standalone wireless
transceiver, available at a very low price. It is used to enable the internet connection to
various applications of embedded systems. Espressif systems designed the ESP8266 Wi-Fi
module to support both the TCP/IP capability and the microcontroller access to any Wi-Fi
network. It provides the solutions to meet the requirements of industries of IoT such as cost,
power, performance, and design.
ESP8266 offers a complete and self-contained Wi-Fi networking solution, allowing it
to either host the application or to offload all Wi-Fi networking functions from another
application processor.

When ESP8266 hosts the application, and when it is the only application processor in the
device, it is able to boot up directly from an external flash. It has integrated cache to improve
the performance of the system in such applications, and to minimize the memory
requirements.

Alternately, serving as a Wi-Fi adapter, wireless internet access can be added to any
microcontroller-based design with simple connectivity through UART interface or the CPU
AHB bridge interface.

ESP8266 on-board processing and storage capabilities allow it to be integrated with


the sensors and other application specific devices through its GPIOs with minimal
development up-front and minimal loading during runtime. With its high degree of on-chip
integration, which includes the antenna switch balun, power management converters, it
requires minimal external circuitry, and the entire solution, including front-end module, is
designed to occupy minimal PCB area.

3.3.6 Buzzer

Fig 3.3.6 Buzzer

An audio signaling device like a beeper or buzzer may be electromechanical or piezoelec-


tric or mechanical type. The main function of this is to convert the signal from audio to
sound. Generally, it is powered through DC voltage and used in timers, alarm devices, print-
ers, alarms, computers, etc. Based on the various designs, it can generate different sounds like
alarm, music, bell & siren.

3.3.7 LCD Display

Fig 3.3.7 LCD Display


Liquid Crystal Display also called as LCD is very helpful in providing user interface
as well as for debugging purpose. The most common type of LCD controller is HITACHI
44780 which provides a simple interface between the controller & an LCD.
 
These LCD's are very simple to interface with the controller as well as are cost effect-
ive. The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 char-
acters), 2x16 (Double Line & 16 character per line), 4x20 (four lines & Twenty characters per
line).

3.4 Software Description


The system makes use of two software module to take control of the software functionalities
1. Node MCU programming using Arduino IDE.
2. Webserver API programming using PHP.

Node MCU PROGRAMMING USING ARDUINO IDE:


In order to make the microcontroller function based on our requirement for medical
dispenser we need to program the same. In this system Arduino IDE is used to program the
Node MCU microcontroller. The program flow chart and functional code block were
summarised below.

3.4.1 Flow Chart

The overall flow chart of the microcontroller program is shown below

Fig 3.4.1 Flow chart


3.4.2 Program Flow
1. Start the program.
2. Initialize the Input/Output ports and LCD.
3. If the current Time is 9.00AM then write the medicine set to be released at (AM to the
database
4. Else if the current Time is 2.00PM then write the medicine set to be release at 2PM to
the database
5. Similarly else if the program checks for current Time 7:00PM also.
6. If the medicine is not taken the buzzer will turn ON.
7. Finally, if none of these condition is currently satisfied or if any of the condition is
satisfied update the result into the database.
8. End the program.

3.4.3 Program Implementation


#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <Wire.h>
//#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const char* ssid = "MedicineAlert";
const char* password = "qwerty123456";

boolean medicine_released = 0;
int timer = 0;

#define sensor_1 D5
#define sensor_2 D6
#define buzzer D7

#define motor_1_p D3

#define motor_2_p D4

String alarm_time[] = {" "," "," "};

int tablet1[] = {1,1,0};


int tablet2[] = {1,0,1};
int tablet1_quantity = 7;
int tablet2_quantity = 7;

String data_in = "";


String update_url = "http://db.vitvara.com/api/medicine_reminder/update_data.php?
count_1=";
String get_url = "http://db.vitvara.com/api/medicine_reminder/get_data.php";
String api_url = "";
int hh=07, mm, ss;
boolean morning=0;
boolean afternoon=0;
boolean night=0;

int counter = 0;

void setup()
{
pinMode(motor_1_p,OUTPUT);
pinMode(motor_2_p,OUTPUT);
digitalWrite(motor_1_p, LOW);
digitalWrite(motor_2_p, LOW);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, 1);

lcd.begin();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" Welcome ");

digitalWrite(buzzer, 1);
delay(1000);
digitalWrite(buzzer, 0);
delay(1000);

pinMode(motor_1_p,OUTPUT);
// pinMode(motor_1_m,OUTPUT);
pinMode(motor_2_p,OUTPUT);
// pinMode(motor_2_m,OUTPUT);

// pinMode(hand_IR_sensor, INPUT_PULLUP);
pinMode(sensor_1,INPUT_PULLUP);
pinMode(sensor_2,INPUT_PULLUP);

Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Start..");

//Serial2.println("http://thantrajna.com/medicine_count/get_alarm.php");
Serial.println("http://thantrajna.com/medicine_count/get_alarm.php");

lcd.setCursor(0,0);
lcd.print(" WiFi ");
lcd.setCursor(0,1);
lcd.print("Connecting....... ");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(200);
}
lcd.setCursor(0,1);
lcd.print(" CONNECTED ");
delay(2000);
lcd.clear();

api_url = get_url;
connect_to_database();
}

void loop()
{

ss+=30;
if (ss==60)
{
ss=0;
mm++;
}

if (mm==60)
{
mm=0;
hh++;
}
if (hh==21)
{
hh=6;
}
lcd.clear();
lcd.setCursor(4,0);

if (hh<10)
{
Serial.print("0");
lcd.print("0");
}
Serial.print(hh);
lcd.print(hh);
Serial.print(":");
lcd.print(":");
if (mm<10)
{
Serial.print("0");
lcd.print("0");
}
Serial.print(mm);
lcd.print(mm);
Serial.print(":");
lcd.print(":");
if (ss<10)
{
Serial.print("0");
lcd.print("0");
}
Serial.println(ss);
lcd.print(ss);

if(mm==59)
{
api_url = get_url;
connect_to_database();
}

if(tablet1_quantity == 0 || tablet2_quantity == 0)
{
digitalWrite(buzzer , 0);
lcd.setCursor(0,1);
lcd.print("Plz!! Refill ");
delay(100);
}

else
{
check_alarm();
}

if (morning==0 && afternoon==0 && night == 0)


{
digitalWrite(buzzer , 0);
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(" Tab1:");
lcd.print(tablet1_quantity);
lcd.print(" Tab2:");
lcd.print(tablet2_quantity);
delay(100);
}
}

void check_alarm()
{
if((hh==9) && (mm==00) && (ss==00) )
{
release_tab_1();
release_tab_2();
update_tablet_count();
morning=1;
night = 0;
}

else if((hh==14) && (mm==0) && (ss==0))


{
release_tab_1();
update_tablet_count();
morning = 0;
afternoon=1;
}
else if((hh==19) && (mm==0) && (ss==0))
{
release_tab_2();
update_tablet_count();
afternoon = 0;
night=1;
}

else if(mm == 59)


{
morning = 0;
afternoon = 0;
night = 0;
}

if(morning==1 || afternoon==1 || night == 1)


{
if(mm < 15)
digitalWrite(buzzer , 1);

else
digitalWrite(buzzer , 0);

if(morning == 1)
{
lcd.setCursor(0,1);
lcd.print("Morning Tab ");

// if(digitalRead(sensor_1) == 1)
// {
// morning = 0;
// lcd.setCursor(0,1);
// lcd.print("Morning Done ");
// digitalWrite(buzzer , 0);
// }
}

else if(afternoon == 1)
{
lcd.setCursor(0,1);
lcd.print("Afternoon Tab ");

// if(digitalRead(sensor_2) == 1)
// {
// afternoon = 0;
// lcd.setCursor(0,1);
// lcd.print("Afternoon Done ");
// digitalWrite(buzzer , 0);
// }
}

else if(night == 1)
{
lcd.setCursor(0,1);
lcd.print("Night Tab ");

// if(digitalRead(ir_sensor_3) == 1)
// {
// night = 0;
// lcd.setCursor(0,1);
// lcd.print("Night Done ");
// digitalWrite(buzzer , 0);
// }
}
delay(100);
}
}

void release_tab_1()
{
tablet1_quantity -= 1; //decrement current table qnty (t1)
digitalWrite(motor_1_p,HIGH); //clock
// digitalWrite(motor_1_m,HIGH);
while(digitalRead(sensor_1)==HIGH); // wait till current white of 1st dispenser goes away
Serial.println("first white ends");
delay(10);
while(digitalRead(sensor_1)==LOW); //Wait till black of 1st dispenser ends
delay(1);
Serial.println("black ends");
digitalWrite(motor_1_p,LOW);
// digitalWrite(motor_1_m,LOW);
}

void release_tab_2()
{
tablet2_quantity -= 1; //decrement current table qnty (t1)
digitalWrite(motor_2_p,HIGH); //clock
// digitalWrite(motor_2_m,LOW);
while(digitalRead(sensor_2)==HIGH); // wait till current white of 1st dispenser goes away
Serial.println("first white ends");
delay(10);
while(digitalRead(sensor_2)==LOW); //Wait till black of 1st dispenser ends
Serial.println("black ends");
digitalWrite(motor_2_p,LOW);
// digitalWrite(motor_2_m,LOW);
}

void update_tablet_count()
{
String count_1 = String(tablet1_quantity);
String count_2 = String(tablet2_quantity);
api_url = update_url + count_1;
api_url = api_url + "&count_2=";
api_url = api_url + count_2;
Serial.println(api_url);
connect_to_database();
delay(3000);
medicine_released = 1;
timer = 20;
}

void connect_to_database()
{
// Serial.println("Connecting to WiFi");
//WiFi.begin(ssid, password);
// while (WiFi.status() != WL_CONNECTED)
// {
// Serial.print(".");
// delay(200);
// }
Serial.println("Wifi Connected");

Serial.println("\n\nConnecting to DB");
HTTPClient http; //Declare an object of class HTTPClient
api_url.replace("\n", "");
api_url.replace("\r", "");
api_url.replace(" ", "%20");
http.begin(api_url);
Serial.println(api_url);
int httpCode = http.GET(); //Send the request

if (httpCode > 0)
{
String server_response = http.getString(); //Get the request response payload
delay(100);
Serial.println(server_response);
if(server_response.startsWith("*"))
{
Serial.println("Updating tablet count");
decode_alarm_time_from_db(server_response);
}
}

http.end(); //Close connection


}

void decode_alarm_time_from_db(String input)


{
char med1 = input.charAt(1);
char med2 = input.charAt(2);
tablet1_quantity = med1 - '0';
tablet2_quantity = med2 - '0';
}

3.4.4 INTEGRATED FUNCTIONAL REPRESENTATION:

The below is the functional representation of the entire system when connected to the
web server.
Fig 3.4.4 Functional Representation

3.4.5 WEBSERVER API IMPLEMENTATION:

The microcontroller communicates with the webserver API via internet connected
with the help of the WiFi module. The webserver API is implemented in server side language.
Here in this system PHP script is used. The PHP script establishes connection with the
database. The monitoring unit can directly interact with the API and the API in turn interact
with the database and fetch the data from the database. These server side code implemented
with PHP is hosted in a webserver, using the domain name followed by the API name and
param the API can be accessed, and data can be fetched or updated. Here the communication
is established using HTTP protocol.

The implemented API endpoint are

1. API to update medicine count.


http://db.vitvara.com/api/medicine_reminder/update_data.php?
count_1=2&count_2=3

2. API to get medicine count.


http://db.vitvara.com/api/medicine_reminder/get_data.php

3.5 App Used

Fig 3.5 App Used


CHAPTER 4
RESULTS

The final result of our system will provide fast curing of patient health by using our
advantageous system. LCD will notify when the number of tablets reduces. All the
specifications of the device are programmable to suit the user’s requirements making it an
easy to implement and flexible system. Human interfacing is minimized because entire
operation is done through programming so maintenance is also lowered. It works
continuously with proper accuracy and gives consistency, LCD display is used which helps to
understand the operation and operation can be set at any location because it requires less
space.

Facility of measurement of various parameter is also provided and also it is very simple
circuit which is easy to understand, affordable at moderate price. It reminds patients to take
medicines and act as life saviours and can be used as modern smart medical equipment which
also even helps blind and partial deaf persons to take medicines without any assistance. So
this medicine dispenser is useful in most of the aspects
CHAPTER 5

5.1 ADVANTAGES:

 Human interfacing is minimized because entire operation is done through


programming.

 Human interfacing is minimized so maintenance is also lowered.

 Works continuously with proper accuracy & gives consistency.

 Operation can be set at any location because it requires less space.

 Simple circuit which is easy to understand.

 Moderate price.

5.2 DISADVANTAGES:

 Dust particles can be accumulated near the collector of dispenser system.

 If Medicine is not filled properly, microcontroller assumes medicine is already in tray.

 It Requires constant power supply and WiFi connection.


CHAPTER 6

CONCLUSION

Unfortunately, people who have to take multiple medicines at same time at once, they
might forget to take medicines on time or they may forget to take medicine at the particular
prescribed time. This may lead to bigger issue of medication misuse, especially among the
elderly patients. And Our Medicine dispensing system helps in solving this problem.
Prototype of a smart medication dispenser to help manage the treatments of older people is
created. Caregivers could easily use and that allowed them to remotely accompany the
compliance to the treatment. The medicine dispenser helps in informing and alerting the
patients to take the appropriate dose at the right time. Use of medicine dispenser in a day to
day life is making life much better. The software used is reliable and understandable. This is a
simple initiative to help the elderly and sick people who live alone and face problems taking
their medicines time to time properly so it will notify when number of pills in the box get
reduces or empty. All the specifications of the device are programmed to suit the user’s
requirements making it flexible system.
CHAPTER 7
FUTURE SCOPE

In the future, there is a hope that the application can be linked to med karts. If the tablets are
empty it directly sends a prescription message to the med kart in which they can help us
delivering the prescribed tablets to our door step. Scanning of prescription to load the app can
be done using image processing technology. The growing geriatric population across the
globe is projected the boost the demand for smart pill box as they find it difficult remember
things and suffer from severe chronic diseases that demand proper medication.
REFERENCES
[1] Juan Marcelo Parra 1, Wilson Valdez \ Andrea Guevara\ Priscila Cedillo2, Jose Ortiz-
Segarra 3, “INTELLIGENT PILLBOX: AUTOMATIC AND PROGRAMMABLE
ASSISTIVE TECHNOLOGY DEVICE”, Proceedings of the IASTED International
Conference Biomedical Engineering (BioMedical201 7)
February 20 - 21, 2017 Innsbruck, Australia.

[2] Ibrahim Adabara, “Patient Medication Reminder Circuit Using ATMEGA328/P


Microcontroller: Design and Implementation” Mediterranean Journal of Basic and
Applied Sciences (MJBAS) Volume 2, Issue 1, Pages 40-51, January-March 2018

[3] Bharat Bhushan Singh1 , SahilUpadhyay2 , MalikSumra3 , “GSM Based Automatic Pill
Dispenser”, International Journal of Advanced Research in Computer and Communication
Engineering ISO 3297:2007 Certified Vol. 5, Issue 7, July 2016

[4] Vishal Tank, “Medicine Dispensing Machine Using Raspberry Pi and Arduino
Controller”
Proc. IEEE Conference on Emerging Devices and Smart Systems (ICEDSS 2017) 3-4 March
2017, Mahendra Engineering College, Tamilnadu, India 978-1-5090-5555-5/17/2017 IEEE

[5] Mrityunjaya D H1, Kartik J Uttarkar2, Teja B3, Kotresh Hiremath, ”Automatic pill
dispenser”, International Journal of Advanced Research in Computer and Communication
Engineering ISO 3297:2007 Certified Vol. 5, Issue 7, July 2016.

[6] Wissam Antoun, Ali Abdo and Suleiman Al-Yaman, Abdallah Kassem, Mustapha Hamad
and Chady El-Moucary,”Smart Medicine Dispenser (SMD)”, 2018 IEEE 4th Middle East
Conference on Biomedical Engineering (MECBME), 978-1-5386-1462-4/18/2018 IEEE

You might also like