You are on page 1of 67

TECHNOLOGICAL UNIVERSITY (MEIKTILA)

DEPARTMENT OF ELECTRONIC ENGINEERING

DESIGN AND IMPLEMENTATION OF ARDUINO BASED


MEDICINE REMINDER

BY
MA EI MYAT MON

GRADUATION THESIS

OCTOBER, 2018
MEIKTILA
TECHNOLOGICAL UNIVERSITY (MEIKTILA)
DEPARTMENT OF ELECTRONIC ENGINEERING

We certify that we have examined, and recommend to the University Steering


Committee for acceptance of the graduation thesis entitled: “DESIGN AND
IMPLEMENTATION OF ARDUINO BASED MEDICINE REMINDER”
submitted by, Ma Ei Myat Mon, Roll No. VI.EC-3 (December, 2017) to the
Department of Electronic Engineering in partial fulfilment of the requirements for the
Degree of Bachelor of Engineering (Electronics).

Board of Examiners:

1. Dr. Khine Myint Mon


B.E.(EC), MTU; M.E.(EC), YTU;
Ph.D.(EC), MTU
Professor and Head
Department of Electronic Engineering ……………………………………
Technological University (Meiktila) (Chairman)

2. Dr. May San Hlaing


B.E.(EC), M.E.(EC), TU(Mandalay);
Ph.D.(EC), MTU
Assistant Lecturer
Department of Electronic Engineering ……………………………………
Technological University (Meiktila) (Supervisor)

3. Daw Hay Man Oo


B.E.(EC), TU (Meiktila); M.E.(EC), MTU
Lecturer
Department of Electronic Engineering ……………………………………
Technological University (Meiktila) (Co-Supervisor)
TECHNOLOGICAL UNIVERSITY (MEIKTILA)
DEPARTMENT OF ELECTRONIC ENGINEERING

DESIGN AND IMPLEMENTATION OF ARDUINO BASED


MEDICINE REMINDER

BY
MA EI MYAT MON

A THESIS
SUBMITTED TO THE DEPARTMENT OF
ELECTRONIC ENGINEERING
IN PARTIAL FULFILMENT OF THE REQUIREMENTS
FOR THE BACHELOR DEGREE
(ELECTRONICS)

OCTOBER, 2018
MEIKTILA
i

ACKNOWLEDGEMENT

First, the author would like to express her deep gratitude to Union Minister Dr.
Myo Thein Gyi, Ministry of Education, for opening the Bachelor Degree of
Engineering at Technological University (Meiktila) and his invaluable permission.
The author would like to express her gratitude to Dr. Aung Myo Thu, Pro-
Rector, Technological University (Meiktila), for his kindness and suggestions for
completion of this thesis.
The author is deeply grateful to Dr. Khine Myint Mon, Professor and Head,
Department of Electronic Engineering, Technological University (Meiktila), for her
suggestions, kind encouragements, permission and help till the completion of this
thesis.
The author would like to express special thanks to her supervisor, Dr. May
San Hlaing, Assistant Lecturer, Department of Electronic Engineering, Technological
University (Meiktila), for her patient guidance, constructive comments, criticism,
encouragement and willingness to share ideas during a long period of this thesis.
The author wishes to acknowledge especially to her co-supervisor, Daw Hay
Man Oo, Lecturer, Department of Electronic Engineering, Technological University
(Meiktila), for her guidance, valuable help, encouragement and editing this thesis.
The author is much obliged to the members of the board of examiners and the
groups of checking format and language for the absolute perfection of thesis book, for
their effective suggestions and sharing their valuable experience.
Special thanks go to all the teachers from Technological University (Meiktila)
who have taught her other supporting subjects including English and Mathematics.
Last but not least, the author is deeply grateful to her parents, aunt and brother
for their supports and encouragement to attain her destination without any trouble and
all her friends who help in any situation.
ii

ABSTRACT

This thesis investigates the Arduino based medicine reminder system. This
system includes DS1307 Real Time Clock (RTC) module, L298N motor driver, DC
motor, I2C Liquid Crystal Display (LCD) module, four push buttons and buzzer.
Arduino UNO is used to activate the whole system. Four push button enters the time
for the person to take medicine. The clock module is used to set up time and LCD is
used to display time for the taking medicine. The buzzer is used to alarm the time for
taking medicine. The motor driver is used to drive the DC motor which controls the
opening and closing function of the medical box.
iii

TABLE OF CONTENTS
Page
ACKNOWLEDGEMENT i
ABSTRACT ii
TABLE OF CONTENTS iii
LIST OF FIGURES vi
LIST OF TABLES viii
LIST OF ABBREVIATIONS ix

CHAPTER TITLE
1 INTRODUCTION 1
1.1. Introduction to Alarm System 1
1.2. Aim and Objectives 2
1.3. Scope of Thesis 3
1.4. Implementation Programs 3
1.5. Outline of Thesis 3
2 LITERATURE REVIEW 4
2.1. Historical Background of Pill Dispenser 4
2.2. Smart Pill Boxes 5
2.2.1. Adhere Tech’s Smart Pill Bottle 5
2.2.2. iMediPac 6
2.2.3. Memo Box 6
2.2.4. uBox 7
2.2.5. Glow Cap and Glow Packs 8
2.2.6. Med Minder 8
2.2.7. ePill’s Monitored Med Smart PLUS 8
2.2.8. Philips Medications Dispensing Service 9
3 HARDWARE COMPONENTS OF MEDICINREMINDER 10
3.1. Required Components 10
3.2. Overview of Arduino 10
3.2.1. Types of Arduino Boards 11
3.2.2. Arduino UNO 11
3.2.2.1. Summary of technical specification 12
3.2.2.2. Power 13
iv

3.2.2.3. Memory 14
3.2.2.4. Input and output 14
3.2.2.5. Communication 15
3.2.2.6. Programming 15
3.2.2.7. Automatic (Software) reset 16
3.2.2.8. USB over current protection 16
3.2.2.9. Physical characteristics 17
3.3. Power Supply 17
3.3.1. Full Wave Bridge Rectifier 18
3.3.2. 7805 Regulator 18
3.4. Real Time Clock (RTC) Module 20
3.4.1. Features of DS1307 RTC Module 21
3.4.2. Pin Diagram and Pin Description of DS1307 RTC 22
3.5. Liquid Crystal Display (LCD) 23
3.5.1. LCD Work 24
3.5.2. Features of 16×2 LCD Module 25
3.6. Motor Driver 26
3.7. DC Motor 27
3.8. Push Button 28
3.9. Buzzer 29
4 SOFTWARE AND HARDWARE IMPLEMENTATION 30
4.1. Medicine Reminder Process 30
4.2. Overall Circuit Diagram 31
4.3. Overall Operation 32
4.4. Components List of Arduino Based Medicine Reminder 32
4.5. Software Implementation 33
4.5.1. Software Implementation for RTC Module 33
4.5.2. Software Implementation for Medical Box
Open and Buzzer ON 33
4.5.3. Software Implementation for Medical Box
Close and Buzzer OFF 33
4.6. Overall System Flowchart 34
5 TEST AND RESULTS 36
v

5.1. Test and Results 36


5.1.1. Testing of Arduino Based Medicine Reminder 36
5.1.2. Output DC voltage Testing for Power Supply Section 36
5.1.3. Testing of Select Time 37
5.1.4. Testing of Select Time 4AM 37
5.1.5. Testing of Select Time 5AM 38
5.1.6. Testing of Select Time 6AM 38
5.1.7. Testing of Select Time 7AM 39
5.1.8. Result of Medical Box Open and Buzzer ON 39
6 DISCUSSIONS AND CONCLUSION 40
6.1. Discussions 40
6.2. Conclusion 40
6.3. Further Extension 41
REFERENCES 42
APPENDIX 43
vi

LIST OF FIGURES

Figure Page
1.1. Overall Block Diagram of Arduino Based Medicine Reminder 2
2.1. Shapes of Pills 4
2.2. Adhere Tech’s Smart Pill Bottle 5
2.3. iMediPac Pillbox 6
2.4. Memo Box Pillbox 6
2.5. uBox Pillbox 7
2.6. Exploded View of the uBox Pillbox 7
2.7. Glow Cap and Glow Pack Pillbox 8
2.8. Med Minder Pillbox 8
2.9. ePill's Monitored Med Smart PLUS Pillbox 9
2.10. Philips Medications Dispensing Service 9
3.1. Arduino UNO Board 11
3.2. Pin Specification of Arduino UNO Board 12
3.3. 5V Regulated Power Supply 17
3.4. Full Wave Bridge Rectifier 18
3.5. 7805 Regulator 20
3.6. DS1307 RTC Module 21
3.7. Pin Diagram of DS1307 22
3.8. 16×2 LCD Module with I2C Module 23
3.9. 16×2 LCD Module with I2C Module 24
3.10. L298N Motor Driver 26
3.11. Pin Diagram of L298N IC 26
3.12. DC Motor 28
3.13. Push Button 28
3.14. Buzzer 29
4.1. Medicine Reminder Process 30
4.2. Overall Circuit Diagram 31
4.3. Overall System Flowchart 34
5.1. Testing of Arduino Based Medicine Reminder 36
5.2. Output DC Voltage Testing for Power Section 37
5.3. Testing of Select Time 37
vii

5.4. Testing of Select Time 4AM 37


5.5. Testing of Select Time 5AM 38
5.6. Testing of Select Time 6AM 38
5.7. Testing of Select Time 7AM 39
5.8. Result of Medical Box and Buzzer 39
vi
viii

LIST OF TABLES

Table Page
3.1. Pin Description of DS1307 22
3.2. Pin Description of LCD 24
3.3. Pin Description of L298N Motor Driver 26
4.1. Components List of Arduino Based Medicine Reminder 32
ix

LIST OF ABBERVIATIONS

Abberviations Description
AC Alternating Current
AREF Analog Read Reference
DC Direct Current
DFU Device Firmware Update
DIP Dual In line Package
DTR Data Terminal Ready
EEPROM Electrically Erasable Programmable Read Only Memory
FTDI Future Technology Devices International
GPL General Public License
GSM Global System for Mobile
I2C Inter Integrated Circuit
IC Integrated Circuit
IDE Integrated Development Environment
ISP In System Programming
LCD Liquid Crystal Display
LED Light Emitting Diode
LGPL Lesser General Public License
MISO Master In Slave Out
MOSI Master Out Slave In
NV Nonvolatile
OCR Optical Character Recognition
PWM Pulse Width Modulation
RAM Random Access Memory
RTC Real Time Clock
RX Receiver
SCK Serial Clock
x

SCL Serial Clock


SDA Serial Data
SOIC Small Outline Integrated Circuit
SPI Serial Peripheral Interface
SQW/OUT Square Wave/Output
SQWE Square Wave Enable
SRAM Static Random Access Memory
SS Slave Select
TTL Transistor Transistor Logic
TX Transmitter
UART Universal Asynchronous Receiver Transmitter
UL Underwriters Laboratory
USB Universal Serial Bus
CHAPTER 1
INTRODUCTION

1.1. Introduction to Alarm System


In day to day life most of the people need to take medicines which was not
there in past couple of years and the reason behind this diseases are increasing in large
amount. So sooner or later, many people come in contact with these diseases. Some
diseases are temporary diseases while many are permanent life threatening diseases.
Life threatening diseases gets mixes with the human body in such a way that they
can’t leave the body ever and they increases in rapid time. Life span of humans
became less because of such diseases and to overcome or to live a better life and
taking medicine is needed regularly and also in large amount.
A large number of patients fail to comply with their prescribed medication
schedules. This causes disease complications, lower quality of life and even mortality.
To overcome these issues the automatic medicine reminder is used. This system is
very simple to operate and update therefore a person of any age group uses it. This
system is also useful in hospital where number of patients is present and sometimes it
is difficult to remember the medicine and dosage by the staff. So this system with
some updates is also used in hospitals. The problem such as maintaining the regularity
of prescribed dosage is difficult to be remembered in busy schedule, remembering the
name of medicine to be taken is really difficult and due to above two reasons the
patient’s life can get more complicated. These above problems are arising to everyone
due to non adherence of medications. Therefore, there is a growing need and urgency
for in home healthcare devices and technologies in order to provide patients with the
electronic tools to support medication self management.
In the thesis, Arduino based medicine reminder is constructed. Smart medicine
box which uses real time clock. The main objective of the thesis is to remind and
dispense medicine at right time to the person automatically from a single machine.
The proposed prototype system consists of Arduino UNO, LCD, push button, RTC
system and alarm system. The brain of the system is Arduino controller.
2

Arduino UNO consists of microcontroller which controls the function of the


system and performs all the tasks. No external peripheral devices and memory devices
are required. Initially the Arduino interfaces with push button and LCD display. By
using the keypad enter the time for the dosage as prescribed in the prescription, the
dosage comes out from the box. The operation for RTC system displays on LCD. The
motor driver drives the DC motor and the DC motor controls the opening and closing
function of the medical box. Figure 1.1 shows the overall block diagram of Arduino
based medicine reminder.

RTC L298N motor


Motor
driver

Switch 1
16x2 LCD

Switch 2 Arduino UNO

Switch 3
Buzzer

Switch 4

Figure1.1. Overall Block Diagram of Arduino Based Medicine Reminder

1.2. Aim and Objectives


The main aim and objectives of this thesis are as follows:
 To remind the medicine at the right time to the person automatically
 To understand the use of microcontroller Arduino
 To understand the other components that are used in this system
 To construct the prototype form of Arduino based medicine reminder

1.3. Scope of Thesis


The goal of this thesis is to construct the medical reminder using Arduino
microcontroller. This system includes DS1307 Real Time Clock (RTC) module,
L298N motor driver, DC motor, I2C Liquid Crystal Display (LCD) module, four push
3

buttons and buzzer. Real Time Clock (RTC) and switches use as input devices for
setting time. L298N motor driver, DC motor, 16×2 Liquid Crystal Display (LCD) and
buzzer use for output devices. DC motor is used to draw the medicine box. LCD is
used to display date and time. Buzzer is used to alarm to take the medicine for the
user.

1.4. Implementation Programs


In this thesis, the medical reminder using Arduino is considered by the
following procedures:
 Studying the basic concepts of Arduino microcontroller.
 Designing the overall block diagram of Arduino based medicine reminder.
 Analyzing the components of that are used in this system.
 Testing the software development for this system.
 Constructing the prototype model for Arduino based medicine reminder.

1.5. Outline of Thesis


There are six chapters in this thesis. In chapter one, introduction of medicine
reminder system, aim and objectives, scope of the thesis, implementation programs
and outline of thesis are also expressed. In chapter two, literature review of medicine
reminder system is expressed. In chapter three, the components that are used in the
system are mentioned and how they work are discussed. In chapter four, system
overview, circuit operation, pin connection are defined. In chapter five, test and
results of Arduino based medicine reminder is discussed. In chapter six, discussions
and conclusion of Arduino based medicine reminder are discussed.
CHAPTER 2
LITERATURE REVIEW

2.1. Historical Background of Pill Dispenser


The invention of the pill date is back to roughly 1500 BC as a liquid from.
This date refers ancient Egyptian times and according to researches many recipes are
found from ancient Egyptian living areas. After that, development of pill continued in
ancient Greece because roman scholar Pliny has found katapotia and he lived from
23-79 AD. Also Roman’s pill making equipment is being on display in the British
Museum. In 17th century England and thereafter, pill manufactures were granted
special patent rights from the king. After these developments, patient people have
begun to choose this kind of treatment because this method has some advantages such
as calibration of dose easily and pill is suitable to treatment a wide variety of diseases
so that manufacturing of pill industry have begun to grow rapidly. In 1867’s August
H.Wiez developed the first patented pill making machine. Most important
development of making pill machines was in between interwar 1918 to 1939 so that
many factories has been establish around the world to produce many types of pills.
After these developments, taking of pill has spread around the world and pill industry
has evolved accordingly. At the same time, some problems began to appear. First
problem is swallowing of pill because difficulty swallowing tablets and capsules can
be a problem for many individuals and can lead to a variety of events and can show
negative effect on the patient with treatment method. Figure 2.1 shows the shape of
pills.

Figure 2.1. Shapes of Pills [16Mua]


5

Second problem is taking of pill on the right time so that manufacturers have
put pills inside special packed to remove them by one by with hand and take on the
time but it could be useless for some patients. Therefore, in 1964, David P. Wagner
has invented the first patent pill dispenser to control oral contraceptive pills of his
wife.
Significant development of pill dispenser has started to appear in 1980s
because of technological developments which have affected all devices because old
devices were not enough to make life easier. Therefore, in the 1980s, automated
dispensing devices appeared on the pill market. The invention and production of these
devices brought hopes of reduced rates of medication errors, increased efficiency for
pharmacy and nursing staff, ready availability of medications.

2.2. Smart Pill Boxes


Despite the short time pill boxes have been in the market many different
models can already be found with a wide range of different functionalities and
intended for disparate uses and contexts.

2.2.1. Adhere Tech’s Smart Pill Bottle


Adhere Tech’s smart pill bottle consists on a plastic bottle in which to store
the pills and some circuitry which allows for the bottle how many times the pillbox is
opened. It uses sensors for a precise measurement of remaining medication and can
send messages, calls or notifications to patient if pill is not taken. Its main weak
points are the impossibility of storing different pill types in one bottle as well as
having a lack of information on how the pillbox can be managed which may led to
believe it can only be implemented at hospital level. Figure 2.2 shows Adhere Tech’s
smart pillbox.

Figure 2.2. Adhere Tech’s Smart Pill Bottle [15Gui]


6

2.2.2. iMediPac
iMediPac is an intelligent pillbox in which pills are sorted by each day in a
disposable envelope which can be later inserted in the pillbox. Each day the pillbox
lights up the compartment which has to be taken that day and the user breaks and
retrieves the pills from inside the pillbox. If pills are not taken the pillbox alerts
relatives with notifications. On the down side, the pillbox is very bulky of a huge size
making it difficult for a person to carry it all day, while pills can probably have to be
taken throughout the day. It also shows in the promotional videos a complex method
of configuring personal data which may lead to elderly people not being able to
program it correctly. Finally it doesn’t solve the problem of pills complexity as
nurses, pharmacists, etc, have to spend huge amounts of time preparing the dose for
each day in the refill sheet as well as refills having to be constantly bought and
refilled. Figure 2.3 shows the iMediPac pillbox with are filling loaded with pills.

Figure 2.3. iMediPac Pillbox [15Gui]

2.2.3. Memo Box

Figure 2.4. Memo Box Pillbox [15Gui]

Memo Box is a small pillbox with just one compartment in which many
different pills can be stored. It possesses a portable size and can track when the
pillbox is forgotten at home. Whilst its simplicity can be very attractive it offers no
7

more functionality than the one which could be achieved with a normal pillbox and a
pill reminder application installed in the phone. Figure 2.4 shows the memo box
pillbox with different pills stored inside.

2.2.4. uBox
uBox is a really small pillbox which can be easily carried by its user. It
consists on a cylindrical structure with different compartments inside. It has a
childproof lock and can alert user and relatives if pills are not taken. Different pills for
each dose are stored in the same compartments which may be its only inconvenient.
Figure 2.5 shows an actual photograph of the pillbox while Figure 2.6 shows an
exploded view of the pillbox.

Figure 2.5. uBox Pillbox [15Gui]

Figure 2.6. Exploded View of the uBox Pillbox [15Gui]


8

2.2.5. Glow Cap and Glow Packs


Glow Cap is a smart pill bottle lid which can attach to the normal pill bottle
and comes with a wall plug device (Glow Pack) which lights up each time the user
has to take a pill. The pillbox lid has an interior button which can be pressed to
directly order pills to the drugstore. Figure 2.7 shows a photograph of both the Glow
Cap and the Glow Pack.

Figure 2.7. Glow Cap and Glow Pack Pillbox [15Gui]

2.2.6. Med Minder


Med Minder is a huge pillbox without the possibility of being portable due to
its size as well as having to be plugged into a wall outlet for it to work. Different pills
go in the same compartment for each one of the pill doses, therefore not improving
pill errors and for the pillbox to work it is required to pay a monthly fee. Figure 2.8
shows the Med Minder pillbox.

Figure 2.8. Med Minder Pillbox [15Gui]

2.2.7. ePill’s Monitored Med Smart PLUS


ePill’s Monitored Med smart PLUS offers a range of automatic pill dispenser
with none strong points as most of the require a monthly fee to work and are complex
to operate. As well they are not portable due to their size and have an outdated style.
9

Their elevated price also may dissuade the users to buy this pill dispenser. Figure 2.9
shows some of these pill dispensers.

Figure 2.9. ePill's Monitored Med Smart PLUS Pillbox [15Gui]

2.2.8. Philips Medications Dispensing Service


Philips medications dispensing service is a non portable pill dispenser oriented
towards elder users which stay at home. It is operated in a very simple way with the
use of one button and has voice prompts. It is equipped for emergencies with a large
pill storage and a battery backup system so it can supply pills to the user in case a
power outage. On its downside it is worth mentioning its nonportability and the use of
individual cups with each day pills, not reducing probability of confusing pills for the
caregivers. Figure 2.10 shows the Philips medications dispensing service pillbox.

Figure 2.10. Philips Medications Dispensing Service [15Gui]


CHAPTER 3
HARDWARE COMPONENTS OF MEDICINE REMINDER

3.1. Required Components


The required components of medicine reminder are:
 Arduino UNO
 5V regulated power supply
 DS1307 Real Time Clock module (RTC)
 L298N motor driver
 DC motor
 I2C Liquid Crystal Display (LCD)
 Push button
 Buzzer

3.2. Overview of Arduino


Arduino is an open source computer hardware and software company, circuit
and user community that designs and manufactures single board microcontrollers and
microcontroller kits for building digital devices and interactive objects that senses and
controls objects in the physical and digital world. The project's products are
distributed as open source hardware and software which are licensed under the GNU
Lesser General Public License (LGPL) or the GNU General Public License (GPL),
permitting the manufacture of Arduino boards and software distribution by anyone.
Arduino boards are available commercially in preassembled form or as do it (DIY)
kits. Arduino board designs use a variety of microprocessors and controllers. The
boards are equipped with sets of digital and analog (input and output) pins that may
be interfaced to various expansion boards or breadboards (shields) and other circuits.
The boards feature serial communications interfaces, including Universal Serial Bus
(USB) on some models which are also used for loading programs from personal
computers. The microcontrollers are typically programmed using a dialect of features
from the programming languages C and C++. In addition to using traditional compiler
11

tool chains, the Arduino project provides an Integrated Development Environment


(IDE) based on the processing language project. The name Arduino comes from a bar
in Ivrea, Italy, where some of the founders of the project used to meet. The bar was
named after Arduino of Ivrea who was the margrave of the March of Ivrea and king of
Italy from 1002 to 1014.

3.2.1. Types of Arduino Boards


There are many types of Arduino available to use for many circuits, such as
 Arduino UNO
 Arduino DUEMILANOVE
 Arduino ESPLORA
 Arduino NANO
 Arduino PRO
 Arduino ROBOT
 Arduino YUN

3.2.2. Arduino UNO

Figure 3.1. Arduino UNO Board [16Mua]

Figure 3.1 shows the Arduino UNO board. The Arduino UNO is a
microcontroller board based on the ATmega328 (datasheet). It has 14 digital input
and output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz crystal oscillator, a USB connection, a power jack, an ICSP header and a
reset button. It contains everything needed to support the microcontroller; simply
connect it to a computer with a USB cable or power it with a AC to DC
adapter or battery to get started. The UNO differs from all preceding boards in that it
does not use the FTDI USB to serial driver chip. Instead, it features the Atmega8U2
programmed as a USB to serial converter.
12

UNO means one in Italian and is named to mark the upcoming reference
versions of Arduino, moving forward. The UNO is the latest in a serious of USB
Arduino boards and the reference model for the Arduino platform for a comparison
with previous versions.

3.2.2.1. Summary of technical specification


Figure 3.2 shows the pin specification of Arduino UNO Board.

Figure 3.2. Pin Specification of Arduino UNO Board [16Mua]


13

Microcontroller ATmega328
Operating voltage 5V
Input voltage (recommended) 7V-12V
Input voltage (limits) 6V-20V
Digital I/O pins 14(of which 6 provide PWM output)
Analog input pins 6
DC current per I/O pin 40mA
DC current for 3.3V pin 50mA
Flash memory 32kB of which 0.5kB is used by bootloader
SRAM 2kB
EEPROM 1kB
Clock speed 16MHz

3.2.2.2. Power
The Arduino UNO can be powered via the USB connection or with an
external power supply. The power source is selected automatically. External (non
USB) power can come either from an AC to DC adapter (wall wart) or battery. The
adapter can be connected by plugging a 2.1mm center positive plug into the board’s
power jack. Leads from a battery can be inserted in the GND and VIN pin headers of
the power connector.
The board can operate on an external supply of 6V to 20V. If it is supplied
with less than 7V, however, the 5V pin may supply less than five volts and the board
may be unstable. If it is used more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7V to 12V.
The power pins are as follows:
 VIN: The input voltage to the Arduino board when it’s using an external
power source (as opposed to 5V from the USB connection or other
regulated power source). The voltage can be supplied through this pin or if
supplying voltage via the power jack, access it through this pin.
 5V: The regulated power supply used to power the microcontroller and
other components on the board. This comes either from VIN via an on-
board regulator or be supplied by USB or another regulated 5V supply.
 3.3V: A 3.3V supply generated by the on-board regulator. Maximum
current draw is 50mA.
14

 GND: Ground pins.

3.2.2.3. Memory
The Atmega328 has 32kB of flash memory for storing code (of which 0.5kB is
used for the bootloader); it has also 2kB of SRAM and 1kB of EEPROM (which can
be read and written with the EEPROM library).

3.2.2.4. Input and output


Each of the 14 digital pins on the UNO can be used as an input or output,
using pinMode(), digitalWrite() and digitalRead() functions. They operate at 5V. Each
pin can provide or receive a maximum of 40mA and has an internal pull-up resistor
(disconnected by default) of 20kΩ to 50kΩ. In addition some pins have specialized
functions:
 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL
serial data. These pins are connected to the corresponding pins of the
ATmega8U2 USB to TTL serial chip.
 External interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low value, a rising or falling edge or a change in value.
 PWM: 3, 5, 6, 9, 10 and 11. Provide 8 bits PWM output with the
analogWrite() function.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, although provided by the underlying hardware, is not
currently included in the Ardunio language.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin
is HIGH value, the LED is ON, when the pin is LOW, it is OFF.
The UNO has 6 analog inputs, each of which provide 10 bits of resolution (i.e.
1024 different values). By default they measure from ground to 5V though it is
possible to change the upper end of their range using the AREF pin and the analog
Reference() function. Additionally, some pins have specialized functionality:
 I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the
wire library.
There are a couple of other pins on the board:
 AREF: Reference voltage for the analog inputs. Used with analog
reference ().
15

 Reset: Bring this line LOW to reset the microcontroller. Typically used to
add a reset button to shield which block the one on the board.

3.2.2.5. Communication
The Arduino UNO has a number of facilities for communicating with a
computer, another Arduino or the ATmega328 provides UART TTL (5V) serial
communication which is available on digital pins 0 (RX) and 1 (TX). An ATmega8u2
on the board channels this serial communication over USB and appears as a virtual
com port to software on the computer. The 8U2 firmware uses the standard USB
COM drivers and no external drive is needed. However, on windows, an *.inf file is
required.
The Arduino software includes a serial monitor which allows simple textual
data to be sent to and from the Arduino board. The RX and TX LEDs on the board
will flash when data is being transmitted via the USB to serial chip and USB
connection to the computer (but not for serial communication on pins 0 and 1).
A software serial library allows for serial communication on any of the UNO’s
digital pins. The ATmega328 also supports I2C (TWI) and SPI communication. The
Arduino software includes a wire library to simplify use of the I2C bus .

3.2.2.6. Programming
The Arduino UNO can be programmed with the Arduino software
(download). Select Arduino UNO w/ATmega32 from the Tools > Board menu
(according to the microcontroller on the board). The ATmega328 on the Arduino
UNO comes preburned with a bootloader that allows to upload new code to it without
the use of an external hardware programmer. It communicates using the original
STK500 protocol.
The ATmega8U2 firmware source code is available. The ATmega8U2 is
loaded with a DFU bootloader which can be activated by connecting the solder
jumper on the back of the board (near the map of Italy) and then resetting the 8U2.
User can use Atmel’s FLIP software (Windows) or the DFU programmer (Mac OS X
and Linux) to load a new firmware. The ISP header can be used with an external
programmer (overwriting the DFU bootloader).
16

3.2.2.7. Automatic (Software) reset


Rather than requiring a physical press of the reset button before an upload, the
Arduino UNO is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of the
ATmega8u2 is connected to the reset line of the ATmega328 via a 100nF capacitor.
When this line is asserted (taken low), the reset line drops long enough to reset the
chip. The Arduino software uses this capability to allow us to upload code by simply
pressing the upload button in the Arduino environment. This means that the
bootloader can have a shorter timeout, as the lowering of DTR can be well
coordinated with the start of the upload.
This setup has other implications. When the UNO is connected to either a
computer running Mac OS X or Linux, it resets each time a connection is made to it
from software (via USB). For the following half second or so the bootloader is
running on the UNO. While it is programmed to ignore malformed data (i.e. anything
besides an upload of new code), it intercepts the first few bytes of data sent to the
board after a connection is opened. If a sketch running on the board receives one time
configuration or other data when it first starts, make sure that the software with which
it communicates waits a second after opening the connection and before sending this
data.
The UNO contains a trace that can be cut to disable the auto reset. The pads on
either side of the trace can be soldered together to re-enable it. The auto reset can also
be able to disable by connecting a 110Ω resistor from 5V to the reset line.

3.2.2.8. USB over current protection


The Arduino UNO has a resettable poly fuse that protects the computer’s USB
ports from shorts and over current. Although most computers provide their own
internal protection, the fuse provides an extra layer of protection. If more than 500mA
is applied to the USB port, the fuse automatically breaks the connection until the short
or overload is removed.

3.2.2.9. Physical characteristics


The maximum length and width of the UNO PCB are 2.7 inches and 2.1
inches respectively, with the USB connector and power jack extending beyond the
former dimension. Three screw holes allow the board to be attached to a surface or
17

case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16 inch), not an
even multiple of the 100 mil spacing of the other pins.

3.3. Power Supply


A power supply is an electronic device that supplies electric energy to an
electrical load. The primary function of power supply is to convert one form the
electrical energy to other and as a result, power supplies are sometimes referred to as
electric power converters. Some power supplies are discrete, standalone devices,
whereas others are built into larger devices along with their loads.
All power supplies have a power input which receives energy from the energy
source and a power output that delivers energy to the load. A DC power supply is one
that supplies a constant DC voltage to its load. Depending on its design, a DC power
supply may be powered from a DC source or from an AC source such as power
mains. All power supplies have a power input which receives energy from the energy
source and a power input that delivers energy to the load. In most power supplies the
power input and output consist of electrical connector or hardwired circuit
connections, through some power supplies employ wireless energy transfer in lieu of
galvanic connections for the power input or output. Some power supplies have other
types of inputs and outputs as well, for functions such as external monitoring and
control. Figure 3.3 shows power supply circuit [12Ano].

D1 D4
1 2
7805
Np:Ns
D2 D3 3
AC C1 5V Power
Supply

Figure 3.3. 5V Regulated Power Supply

3.3.1. Full Wave Bridge Rectifier


A diode bridge is an arrangement of four diodes in a bridge circuit
configuration that provides the same polarity of output for either polarity of input.
When used in its most common application, for conversion of an alternating current
18

(AC) input into a direct current (DC) output, it is known as a bridge rectifier. A bridge
rectifier provides full wave rectification from a two wire AC input, resulting in lower
cost and weight as compared to a rectifier with a three wire input from a transformer
with a center tapped secondary winding. Figure 3.4 shows full wave bridge rectifier.
Vp = 2 × Vrms -1.4 Equation (3.1)

D1
D4
AC +V

D2 Load
D3 DC

-V
0V

Figure 3.4. Full Wave Bridge Rectifier [12Ano]

3.3.2. 7805 Regulator


The 78xx (sometimes L78xx, LM78xx, MC78xx...) is a family of self-
contained fixed linear voltage regulator integrated circuits. The 78xx family is
commonly used in electronic circuits requiring a regulated power supply due to their
ease of use and low cost. For ICs within the family, the xx is replaced with two digits,
indicating the output voltage (for example, the 7805 has a 5V output, while the 7812
produces 12V). The 78xx line are positive voltage regulators: they produce a voltage
that is positive relative to a common ground. There is a related line of 79xx devices
which are complementary negative voltage regulators. 78xx and 79xx ICs can be used
in combination to provide positive and negative supply voltages in the same circuit.
78xx ICs have three terminals and are commonly found in the TO-220 form
factor, although they are available in surface mount, TO-92 and TO-3 packages.
These devices support an input voltage anywhere from around 5.5V over the intended
output voltage up to a maximum of 35V to 40V depending on the model and typically
provide 1A or 1.5A of current (though smaller or larger packages may have a lower or
higher current rating).
The advantages are as follows:
 78xx series ICs do not require additional components to provide a
constant, regulated source of power, making them easy to use, as well as
economical and efficient uses of space. Other voltage regulators may
19

require additional components to set the output voltage level or to assist in


the regulation process. Some other designs (such as a switched mode
power supply) may need substantial engineering expertise to implement.
 78xx series ICs have built in protection against a circuit drawing too much
current. They have protection against overheating and short circuits,
making them quite robust in most applications. In some cases, the current
limiting features of the 78xx devices can provide protection not only for
the 78xx itself, but also for other parts of the circuit.
The disadvantages are as follows:
 The input voltage must always be higher than the output voltage by some
minimum amount (typically 2.5V). This can make these devices unsuitable
for powering. Some devices from certain types of power sources (for
example, powering a circuit that requires 5V using 6V batteries will not
work using a 7805).
 As they are based on a linear regulator design, the input current required is
always the same as the output current. As the input voltage must always be
higher than the output voltage, this means that the total power (voltage
multiplied by current) going into the 78xx can be more than the output
power provided. The difference is dissipated as heat. This means both that
for some applications an adequate heat sink must be provided and also that
a (often substantial) portion of the input power is wasted during the
process, rendering them less efficient than some other types of power
supplies. When the input voltage is significantly higher than the regulated
output voltage (for example, powering a 7805 using a 24V power source),
this inefficiency can be a significant issue. Buck converters may be
preferred over 78xx regulators because they are more efficient and do not
require heat sinks, but they are more expensive.
 A voltage regulator is designed to automatically maintain a constant
voltage level. A voltage regulator may be a simple feed forward design or
may include feedback control. It may use an electromechanical mechanism
or electronic components. Depending on the design, it may be used to
regulate one or more AC or DC voltages.
20

 Electronic voltage regulators are found in devices such as computer power


supplies where they stabilize the DC voltages used by the processor and
other elements. In automobile alternators and central power station
generator plants, voltage regulators control the output of the plant. In an
electric power distribution system, voltage regulators may be installed at a
substation or along distribution lines so that all customers receive steady
voltage independent of how much power is drawn from the line. Figure 3.5
shows 7805 regulator.

Vin 78×× Vout

1000µF 100µF
GROUND

OUTPUT
INPUT

GND

Figure 3.5. 7805 Regulator [12Ano]

3.4. Real Time Clock (RTC) Module


Real time clocks, as the name recommends are clock modules. This tiny
module based on the clock chip DS1307 which support the I2C protocol. The DS1307
serial real time clock is a low power, full binary coded decimal (BCD) clock and
calendar plus 56 bytes of NV SRAM. Address and data are transferred serially
through an I2C bidirectional bus. The clock and calendar provides seconds, minutes,
hours, day, date, month and year information. The end of the month date is
automatically adjusted and including corrections for leap year. The clock operates in
either the 24 hour or 12 hour format with AM/PM indicator. The RTC module use the
I2C bus to communicate with Arduino. Using the DS1307 is primarily written to and
read the register of this chip. The memory contains all 64 DS1307 8 bit registers are
addressed from 0 to 63 (from 00H to 3FH the hexadecimal system). The first eight
21

registers are used for the clock register the remaining 56 vacant can be used as RAM
contains temporary variable if desired. The first seven registers contain information
about the time of the clock including: seconds, minutes, hours, secondary, date, month
and year. The DS1307 include several components such as power circuits, oscillator
circuits, logic controller and I2C interface circuit and the address pointer register (or
RAM). Figure 3.6 shows the DS1307 RTC module.

Figure 3.6. DS1307 RTC Module [16Urv]

3.4.1. Features of DS1307 RTC Module


Features of DS1307 RTC module are as follow:
 5V DC supply
 Programmable square wave output signal
 Consumes less than 500nAI battery backup module with oscillator running
 56 bytes, battery backed, nonvolatile (NV) RAM for data storage
 Two-wire I2C serial interface
 Valid up to the year 2100
 Automatic power fail detect and switch circuitry
 Optional industrial temperature range:-40◦C to +85◦C
 Available in eight pin DIP or SOIC
 Underwriters Laboratory (UL) recognized

3.4.2. Pin Diagram and Pin Description of DS1307 RTC


The DS1307 real time clock module is an eight pins device using an IC
interface. Figure 3.7 shows the pin diagram of DS1307 and Table 3.1 shows the pin
description of DS1307.
22

X1 1 5 VCC

X2 2 6 SQW/OUT
DS1307

VBAT 3 7 SCL

GND 4 8 SDA

Figure 3.7. Pin Diagram of DS1307 [16Urv]

Table 3.1. Pin Description of DS1307 [16Urv]


Pin Name Description
1, 2 X1, X2 32.768kHz crystal connection.
3 VBAT +3V battery power supply pin. Must be connected to a 3V
Lithium cell for backup supply.
4 GND Ground pin.
5 SDA Serial data pin. It is the data input/output pin of the I2C
interface. An external pull up of 5V is required usually
through a 10kΩ resistor.
6 SCL Serial clock input pin. It is the clock input pin of the I2C
interface. It must also be pulled up to 5V through a 10kΩ
resistor.
7 SQW/OUT Square wave/output pin. If not used, it can be left floating.
When enabled, the SQWE bit set to1, the SQW/OUT pin
outputs one of four square wave frequencies (1Hz, 4kHz,
8kHz, 32kHz).
8 Vcc The main supply pin.

3.5. Liquid Crystal Display (LCD)


A flat panel display or other electronic visual display that uses the light
modulating properties of liquid crystal is called liquid crystal display. A 16×2 LCD
23

display is very basic module and is very commonly used in various devices and
circuits. These modules are preferred over seven segments and other multi segment
LEDs. A 16×2 LCD means it can display 16 characters per line and there are 2 such
lines. Figure 3.8 shows 16×2 LCD module with I2C module.
The specifications of the LCD module is described below:
 Display format: 16 character × 2 line
 Viewing direction: 6 o’clock
 Input data: 4 bits or 8 bits interface available
 Display font: 5 × 8 dots
 Power supply: Single power supply (5V + (or) - 10 %)
Since less pin are needed for this thesis, LCM1602 I2C module is used
together with 1602A LCD.

Figure 3.8. 16x2 LCD Module with I2C Module [16Ano]

I2C (inter-integrated circuit) protocol uses Serial Data (SDA) and Serial Clock
(SCL) pins and it uses 0x27 address or 0x3F address (sometimes).
 Interface: I2C
 I2C address: 0x27
 Pin definition: VCC, GND,SDA,SCL
 Back lit (green with white char color)
 Supply voltage: Single power supply

3.5.1. LCD Work


The principle behind the LCD’s is that when an electrical current is applied to
the liquid crystal molecule, the molecule tends to untwist. This causes the angle of
light which is passing through the molecule of the polarized glass and also cause a
24

change in the angle of the top polarizing filter. As a result a little light is allowed to
pass the polarized glass through a particular area of the LCD. Thus that particular area
will become dark compared to other. The LCD works on the principle of blocking
light. While constructing the LCD’s, a reflected mirror is arranged at the back. An
electrode plane is made of indium tin oxide which is kept on top and a polarized glass
with a polarizing film is also added on the bottom of the device. The complete region
of the LCD has to be enclosed by a common electrode and above it should be the
liquid crystal matter[16Ano].
Next comes to the second piece of glass with an electrode in the form of the
rectangle on the bottom and, on top, another polarizing film. It must be considered
that both the pieces are kept at right angles. When there is no current, the light passes
through the front of the LCD it can be reflected by the mirror and bounced back. As
the electrode is connected to a battery the current from it causes the liquid crystals
between the common plane electrode and the electrode shaped like a rectangle to
untwist. Thus the light is blocked from passing through. That particular rectangular
area appears blank. Figure 3.9 shows the pin diagram of LCD display and Table 3.2
shows the pin description of LCD display.

Figure 3.9. Pin Diagram of Liquid Crystal Display [16Ano]

Table 3.2. Pin Description of LCD [16Ano]


Pin No Pin Name Description
1 Vss (Ground) Ground pin connected to system ground.
2 Vdd (+5 Volt) Powers the LCD with +5V (4.7V – 5.3V)
Decides the contrast level of display. Grounded to get
3 VE (Contrast V)
maximum contrast.
4 Register Select Connected to microcontroller to shit between command
25

and data register.


Used to read or write data. Normally grounded to write
5 Read/Write
data to LCD.
Connected to microcontroller pin and toggled between 1
6 Enable
and 0 for data acknowledgement.
7 Data Pin 0
8 Data Pin 1
9 Data Pin 2
10 Data Pin 3 Data pins 0 to 7 forms an 8-bit data line. They can be
11 Data Pin 4 connected to microcontroller to send 8-bit data.
12 Data Pin 5 These LCD’s can also operate on 4-bit mode in such
13 Data Pin 6 case data pin 4, 5, 6 and 7 will be left free.

14 Data Pin 7
15 LED Positive Backlight LED pin positive terminal

16 LED Negative Backlight LED pin negative terminal

3.5.2. Features of 16×2 LCD module


Features of LCD module are as follow:
 Operating voltage is 4.7V to 5.3V
 Current consumption is 1mA without backlight
 Alphanumeric LCD display module, meaning can display alphabets and
numbers
 Consists of two rows and each row can print 16 characters.
 Each character is built by a 5×8 pixel box
 Can work on both 8 bit and 4 bit mode
 It can also display any custom generated characters
 Available in green and blue backlight

3.6. L298N Motor Driver


The L298N is an integrated monolithic circuit in a 15mW and power SO20
packages. It is a high voltage, high circuit dual full bridge driver designed to accept
standard TTL logic levels and drive inductive loads such as relays, solenoids, DC and
26

stepping motors. Two enable inputs are provided to enable or disable the device
independently of the input signals. The emitters of the lower transistors of each bridge
are connected together and the corresponding external terminal can be used for the
connection of an external sensing resistor. An additional supply input is provided so
that the logic works at a lower voltage. Figure 3.10 shows the L298N motor driver
module and Figure 3.11 shows the pin diagram of motor driver. Table 3.3 shows the
pin description of L298N motor driver module.

Figure 3.10. L298N Motor Driver [00Ano]

Figure 3.11. Pin Diagram of L298N IC [00Ano]

Table 3.3. Pin Description of L298N Motor Driver [17Ano]


Pin Name Description
1 Sense A The sense resistor is connected between this pin and ground to
15 Sense B control the current of the load.
2 Out 1 Outputs of the bridge A; the current that flows through the load
27

3 Out 2 connected between these two pins is monitored at pin 1.

4 Vs Supply voltage for the power output stages. A non inductive


100nF capacitor must be connected between this pin and ground.
5 Input 1 TTL compatible inputs of the bridge A.
7 Input 2
6 Enable A TTL compatible enable input: the L state disables the bridge A
11 Enable B (enable A) and/or the bridge B (enable B).
8 GND Ground
9 Vss Supply voltage for the logic blocks. A 100nF capacitor must be
connected between this pin and ground.
10 Input 3 TTL compatible inputs of the bridge B.
12 Input 4

13 Out 3 Outputs of the bridge B; The current that flows through the load
14 Out 4 connected between these two pins is monitored at pin 15.

3.7. DC Motor
Almost every mechanical moment is accomplished by an electric motor.
Electric machines are means of converting energy. Motors take electrical energy and
produce mechanical energy. Nearly all types of DC motors have some internal
mechanism, either electromechanical or electronic, to periodically change the
direction of current flow in part of the motor. DC motors were the first type widely
used, since they could be powered from existing direct current lighting power
distribution systems. DC motor’s speed can be controlled over a wide range, using
either a variable supply voltage or by changing the strength of current in its field
windings. An example of small motor applications includes motors used in
automobile, robot, hand power tools and food blenders. Larger DC motors are used in
propulsion of electrical vehicles, elevator and hoists or in drives for steel rolling mills.
It has two power connections to supply the voltage, one is termed as positive and the
other is negative. The operation voltage is 3V to 6V DC. Reduction ratio is 1:48.
Figure 3.12 shows DC motor.
Specifications of DC motor are as follow:
 Operating voltage: 3V to 6V
28

 Speed: 2,650rpm at 3V
 Speed:5,000rpm at 6V
 Free running current: 0.04A at 3V
 Free running current: 0.04A at 6V
 Stall current: 0.14A at 3V
 Stall current: 0.29A at 6V
 Length without the shaft: 25mm
 Shaft length: 6.5mm
 Shaft diameter: 2mm
 Weight:19g

Figure 3.12. DC Motor [17Ano]

3.8. Push Button

Figure 3.13. Push Button [16Urv]

A push button (also spelled pushbutton) or simply button is a simple switch


mechanism for controlling some aspect of a machine or a process. Buttons are
typically made out of hard material, usually plastic or metal. The surface is usually
flat or shaped to accommodate the human finger or hand, so as to be easily depressed
29

or pushed. Buttons are most often biased switches, although many un-biased buttons
(due to their physical nature) still require a spring to return to their unpushed state.
Terms for the pushing of a button include pressing, depressing, mashing, hitting and
punching. Figure 3.13 shows push button.

3.9. Buzzer
A buzzer or beeper is an audio signaling device which may be mechanical,
electromechanical or piezoelectric (piezo for short). Typical uses of buzzers and
beepers include alarm devices, timers and confirmation of user input such as a mouse
click or keystroke. The electric buzzer was invented in 1831 by Joseph Henry. They
were mainly used in early doorbells until they were phased out in the early 1930s in
favor of musical chimes which had a softer tone. There are several different kinds of
buzzers. At future electronics, many of the most common types can be categorized by
type, sound level, frequency, rated voltage, dimension and packaging type. The most
common sizes for sound level are 80dB, 85dB, 90dB and 95dB. Buzzers carry up to
105dB of sound level. There are several types available including electro acoustic,
electromagnetic, magnetic and piezo, among others. Figure 3.14 shows buzzer.

Figure 3.14. Buzzer [16Urv]


CHAPTER 4
SOFTWARE AND HARDWARE IMPLEMENTATION

4.1. Medicine Reminder Process


Figure 4.1 shows medicine reminder process.

Start

LCD start showing “Select time”

Set time from user by pressing


push button

The current time reaches the


select time

Buzzer on and motor drive


forward

Press any button from user

Buzzer off and motor drive


backward

Display date and time on LCD

END

Figure 4.1. Medicine Reminder Process


31

Initially, LCD shows the select time. Then, the user set the select time by
pressing push button. When the current time reaches the select time, the buzzer is ON
state and the motor drive reaches forward condition. If the user press any button, the
buzzer is OFF state and the motor drive return to backward condition. Finally, the
current date and time display on LCD.

4.2. Overall Circuit Diagram


12V
OUT1
OUT1
GND
GND L298N OUT2 DC motor
L298N OUT2

IN1
IN2
IN1
IN2
Push Button
Buzzer

10k
10k
330
330
GND
6 7 2 3 4 5
D4
Np:Ns GND
D1
8

Arduino UNO
1 7805 2
AC Vcc
SDA SDA
3

RTC module
SCL SCL
D2
.
D3 1000µF 100µF
5V
GND Vcc
Vcc
A4 A5
GND
SDA
SCL
Vcc
GND

I2C module

16
16 xx 22 LCD
LCD

Figure 4.2. Overall Circuit Diagram

In this system,Arduino UNO is used for controlling the whole system. DS1307
real time clock chip is used for running the time accurate and to prevent the time after
light failure by using 3V li-on battery connected with this real time clock chip at pin
3. SDA and SCL pin of real time clock chip is directly connected with SDA and SCL
pin of Arduino respectively. The main supply VCC is connected with 5V DC supply
circuit. Liquid Crystal Display (LCD) is connected with I2C to reduce from 16 pin to
4 pin. SDA and SCL pin of I2C module is connected with A4 and A5 pin of Arduino
respectively. The power supply pin VCC is directly connected with 5V DC power
32

supply circuit. The pin 8 of Arduino is connected with buzzer. The ground pin of
buzzer is connected with ground pin of Arduino. Four push buttons are connected
with pin 2, 3, 4 and 5 of Arduino respectively. There are 15 pins in L298N motor
driver but only 6 pins are used in this system. IN1 and IN2 which is connected to pin
number 6 and 7 of Arduino respectively. OUT1 and OUT2 pin of L298N motor driver
is connected with DC motor. The power supply pin is connected with 12V DC power
supply. Figure 4.2 shows overall circuit diagram.

4.3. Overall Operation


To set alarm time for medication, push button connected with pin 2 of Arduino
is pressed. After pressing this button LCD showsselect time 4AM. At this time, green
LED connected with pin 7 of motor drive is high. And then, the time set select time
formedication by using push buttons connected with pin 3, 4 and 5 of Arduino. After
select time 4AM, LCD shows select time 5AM. Now using previous process set the
time again. And after second time set, LCD shows again select time reaches the select
time, buzzer is ON and L298N motor driver drives DC motor for the opening of
medical box. At this time, red LED connected with pin 6 of motor driver is high. By
pressing any push button the buzzer is OFF and medical box is closed. When alarm
occurs LCD indicates date and time.

4.4. Components List of Arduino Based Medicine Reminder


Table 4.1 shows the components list of Arduino based medicine reminder.

Table 4.1. Components List of Arduino Based Medicine Reminder


Name Required
Arduino UNO 1
5V regulated power supply 1

DS1307 Real Time Clock module (RTC) 1


L298N motor driver 1
DC motor 1
I2C Liquid Crystal Display (LCD) 1
push button 4
buzzer 1
33

4.5. Software Implementation


The software implementation is the Arduino IDE based software environment.
A program written with the Arduino IDE is called a sketch. Sketches are saved on the
development computer as text files with the file extension .ino. Arduino Software
(IDE) saved sketches with the extension .pde.
A minimal Arduino C/C++ program consist of only two functions:
 setup (): This function is called once when a sketch starts after power-up or
reset. It is used to initialize variables, input and output pin modes, and other
libraries needed in the sketch.
 loop (): After setup() function exits (ends), the loop() function is executed
repeatedly in the main program. It controls the board until the board is
powered off or is reset.

4.5.1. Software Implementation for RTC Module


The software programming language for the RTC module is very simple. RTC
module process is also done in setup loop. The setup function for RTC module is
declared select time of each button. These buttons are used to change select time.
if (digitalRead(2))selecttime=4;
if (digitalRead(3))selecttime=5;
if (digitalRead(4))selecttime=6;
if (digitalRead(5))selecttime=7;
.
4.5.2. Software Implementation for Medical Box Open and Buzzer ON
The programming language is written for medical box open and buzzer ON.
At the loop function includes the pin 6 of motor driver is high, pin 7 of motor driver is
low and buzzer is high. At this time, medical box is opened and buzzer is ON.
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);

4.5.3. Software Implementation for Medical Box Close and Buzzer OFF
The programming language is written for medical box close and buzzer OFF..
At the loop function includes the pin 6 of motor driver is low, pin 7 of motor driver is
high and buzzer is low. At this time, medical box is closed and buzzer is OFF.
(digitalWrite(6,LOW);
34

digitalWrite(7,HIGH);
digitalWrite(8,LOW);

4.6. Overall System Flowchart

START

Initialize all I/O pin

LCD start showing


“ Select Time”

Set time from user

Reach selected No
time?

Yes

Buzzer ON and DC
motor drive forward

No
Press any button?

Yes

Buzzer OFF and DC motor


drive backward

Display LCD

END

Figure 4.3. Overall System Flowchart


35

Figure 4.3 shows overall system flowchart.


Step 1: Start
Step 2: Initialize the input and output pins
Step 3: Set time from user by pressing push button
Step 4: Check select time reaches. If the select time reaches, buzzer occurs ON
state and motor drives forward. Otherwise, the user set time again.
Step 5: Press any button.If press any button, buzzer occurs OFF state and the
motorgoes backward condition. Otherwise, buzzer is existing ON state and motor is
also existing forward condition.
Step 6: Date and time display on LCD
Step 7: Exit
CHAPTER 5
TEST AND RESULTS

5.1. Test and Results


This section is test and results of the whole system. At testing of the Arduino
based medicine reminder, LCD shows “select time”. Buttons use for setting time and
to start the real time clock module. When time reach to the set time, DC motor goes
forward and buzzer is ON. After pressing any button, DC motor goes backward and
buzzer is OFF. At the description of this section includes eight parts of test and
results.

5.1.1. Testing of Arduino Based Medicine Reminder


Figure 5.1 shows testing of Arduino based medicine reminder.

Figure 5.1. Testing of Arduino Based Medicine Reminder

5.1.2. Output DC Voltage Testing for Power Supply Section


This testing is output DC voltage for power supply section of Arduino based
medicine reminder system. Figure 5.2 shows output DC voltage testing for power
supply section.
37

Figure 5.2. Output DC Voltage Testing for Power Section

5.1.3. Testing of Select Time


This testing is the text of select time display on LCD when the incipient
condition of Arduino based medicine reminder system. Figure 5.3 shows testing of
select time.

Figure 5.3. Testing of Select Time

5.1.4. Testing of Select Time 4AM


38

Figure 5.4. Testing of Select Time 4AM


This testing is select time 4AM when the user press push button that is
connected with pin 2 of Arduino. Figure 5.4 shows testing of select time 4AM.

5.1.5. Testing of Select Time 5AM


Testing of select time 5AM occurs when the user press push button that is
connected with pin 3 of Arduino. Figure 5.5 shows testing of select time 5AM.

Figure 5.5. Testing of Select Time 5AM

5.1.6. Testing of Select Time 6AM


This testing is select time 6AM when the user press push button that is
connected with pin 4 of Arduino. Figure 5.6 shows testing of select time 6AM.
39

Figure 5.6. Testing of Select Time 6AM


5.1.7. Testing of Select Time 7AM
Testing of select time 7AM occurs when the user press push button that is
connected with pin 5 of Arduino. Figure 5.7 shows testing of select time 7AM.

Figure 5.7. Testing of Select Time 7AM

5.1.8. Result of Medical Box Open and Buzzer ON


This result condition is medical box open and buzzer ON when the time
reaches the selected time. Figure 5.8 shows result of medical box and buzzer.

Figure 5.8. Result of Medical Box and Buzzer


40

CHAPTER 6
DISCUSSIONS AND CONCLUSION

6.1. Discussions
Arduino based medicine reminder is a prototype design. But it is available for
using in family medical care processes. It have many advantages for elder mans who
helpless from their family and friends. Furthermore, this machine help for the
operations of medical checkup and medical take care at hospital. This machine is
reliable but don’t resist overflow of power. Because this machine use low DC power
consumed devices.

6.2. Conclusion
There are many systems which are serving for the same purpose. But these
systems are difficult to use, non mobile, expensive and complex process. The
proposed system overcomes these problems. The Arduino based medicine reminder is
simple to use, affordable, better accuracy. This system is helpful for every age group
and can also be used in hospital for a group of people. This system definitely reduces
the bad effect caused due to wrong intake of medicine. This system can be made more
effective by upgrading its few features. In future due to manual work, the available
system can become more time consuming. So in the give future, an attempt can be
made to implement fully automatic medication reminder system based on handwritten
character recognition. This is achieved with the help of artificial neural network.
Neural network is very effective to decipher any character of any language. The
accuracy of character recognition is more important. So accuracy of characters needs
to improve by adding probability to each character. For example, a character Q is very
less easy to find because character Q is more often mistaken with O in most of the
OCR systems. The proposed system only set the reminders in the built in calendar
application of the mobile. This reminder reminds user about their medicine in take
schedule. The system which are implementing to give the reminder about doctor’s
41

next appointment. It also tells the user of the end of the medicines. The scheduled
reminder don’t suggest any kind of medicine, dose of medicine, etc.

6.3. Further Extension


One more feature can be added to the present device that is Global System for
Mobile (GSM). By interfacing a GSM shield with Arduino and editing the program,
the system can be made more effective and simple to use. The medicine reminder can
be updated using GSM module. The new prescription given to the patient can be send
by doctor from mobile to GSM module used in medicine reminder and the system
gets updated itself.
REFERENCES

[17Ano] Anonymous: wiki.sunfounfer.cc/index.php?...Motor…,


https://www.st.com/.../motor-drivers/L298.., (2017).
[16Ano] Anonymous: https://data.kent-fei.tuke.sk/.../LCD/20..., (2016).
[16Mua] Muammer,G., Hakan,A., Abdullah,Y.: Ethernet Automated Pill
Dispenser, Easten Mediterranean University, 1-131, (2016).
[16Urv] Urvashi,S., Chetna,C., Himina,S., Anjila,S.: Arduino Based Medicine
Reminder, 37-45, (2016).
[15Gui] Guillermo, J., G.: Smart Pill Dispenser ForDepent People,
1-114, (2015).
[12Ano] Anonymous: www.geeetech.com/, (2012).
[00Ano] Anonymous: https://www.sparkfun.com/.../L298-H..., (2000).
APPENDIX
APPENDIX
DESIGN AND IMPLEMENTATION OF ARDUINO BASED MEDICINE
REMINDER

Software implementation OF ARDUINO BASED MEDICINE REMINDER


is shown as below.

%%% DESIGN AND IMPLEMENTATION OF ARDUINO BASED MEDICINE


REMINDER
%%% MA EI MYAT MON (VI EC-3)
%%% DEPARTMENT OF ELECTRONIC ENGINEERING
%%% TECHNOLOGICAL UNIVERISTY (MEIKTILA)
%%% October, 2018

#include<Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);//27 or 3F
const int DS1307 = 0x68; // Address of DS1307 see data sheets
byte second = 0;
byte minute = 0;
byte hour = 0;
byte weekday = 0;
byte monthday = 0;
byte month = 0;
byte year = 0;
int selecttime=6;
float hours;
void setup() {
pinMode(2,INPUT);pinMode(3,INPUT);pinMode(4,INPUT);pinMode(5,INPUT);
pinMode(6,OUTPUT); pinMode(8,OUTPUT);
lcd.begin (16, 2);
lcd.clear();
45

lcd.setCursor(0,1);
lcd.print("Select time?");
delay(3000);
if (digitalRead(2)) selecttime=4;
if (digitalRead(3)) selecttime=5;
if (digitalRead(4)) selecttime=6;
if (digitalRead(5)) selecttime=7;
delay(1000);
lcd.setCursor(0,1);
lcd.print("Select time=");
lcd.print(selecttime);lcd.print("am");
}
void loop()
{
readTime();
hours=hour+minute/60.0+second/3600.0;
lcd.setCursor(0,0);
lcd.print(monthday); lcd.print("/");
lcd.print(month); lcd.print("/");
lcd.print(year); lcd.print(" ");
lcd.print(hour); lcd.print(":");
lcd.print(minute); lcd.print(":");
lcd.print(second);
if (hours>selecttime&&hours<(selecttime+0.006) ||
hours>(selecttime+8)&&hours<(selecttime+8.006) ||
hours>(selecttime+16)&&hours<(selecttime+16.006) )
//Open
{
digitalWrite(6,HIGH);digitalWrite(7,LOW);digitalWrite(8,HIGH);
delay(500);delay(100);
}
if (digitalRead(2)||digitalRead(3)||digitalRead(4)||digitalRead(5))
//Close
{ digitalWrite(6,LOW);digitalWrite(7,HIGH);digitalWrite(8,LOW);
46

delay(500);delay(100);
}
}
byte bcdToDec(byte val) {
return ((val/16*10) + (val%16));
}
void readTime() {
Wire.beginTransmission(DS1307);
Wire.write(byte(0));
Wire.endTransmission();
Wire.requestFrom(DS1307, 7);
second = bcdToDec(Wire.read());
minute = bcdToDec(Wire.read());
hour = bcdToDec(Wire.read());
weekday = bcdToDec(Wire.read());
monthday = bcdToDec(Wire.read());
month = bcdToDec(Wire.read());
year = bcdToDec(Wire.read());
}
RTC software OF ARDUINO BASED MEDICINE REMINDER is shown as
below.
#include <Wire.h>
const int DS1307 = 0x68; // Address of DS1307 see data sheets
const char* days[] =
{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday"};
const char* months[] =
{"January", "February", "March", "April", "May", "June", "July",
"August","September", "October", "November", "December"};
// Initializes all values:
byte second = 0;
byte minute = 0;
byte hour = 0;
byte weekday = 0;
47

byte monthday = 0;
byte month = 0;
byte year = 0;
void setup() {
Wire.begin();
Serial.begin(9600);
delay(2000); // This delay allows the MCU to read the current date and time.
Serial.print("The current date and time is: ");
printTime();
Serial.println("Please change to newline ending the settings on the lower
right of the Serial Monitor");
Serial.println("Would you like to set the date and time now? Y/N");
while (!Serial.available()) delay(10);
if (Serial.read() == 'y' || Serial.read() == 'Y')
// This set of functions allows the user to change the date and time
{
Serial.read();
setTime();
Serial.print("The current date and time is now: ");
printTime();
}
Serial.println("Thank you.");
}
// Continuous function for converting bytes to decimals and vice versa
void loop() {
}
byte decToBcd(byte val) {
return ((val/10*16) + (val%10));
}
byte bcdToDec(byte val) {
return ((val/16*10) + (val%16));
}
// This set of codes is allows input of data
void setTime() {
48

Serial.print("Please enter the current year, 00-99. - ");


year = readByte();
Serial.println(year);
Serial.print("Please enter the current year, 00-99. - ");
year = readByte();
Serial.println(year);
Serial.print("Please enter the current month, 1-12. - ");
month = readByte();
Serial.println(months[month-1]);
Serial.print("Please enter the current day of the month, 1-31. - ");
monthday = readByte();
Serial.println(monthday);
Serial.println("Please enter the current day of the week, 1-7.");
Serial.print("1 Sun | 2 Mon | 3 Tues | 4 Weds | 5 Thu | 6 Fri | 7 Sat - ");
weekday = readByte();
Serial.println(days[weekday-1]);
Serial.print("Please enter the current hour in 24hr format, 0-23. - ");
hour = readByte();
Serial.println(hour);
Serial.print("Please enter the current minute, 0-59. - ");
minute = readByte();
Serial.println(minute);
second = 0;
Serial.println("The data has been entered.");
// The following codes transmits the data to the RTC
Wire.beginTransmission(DS1307);
Wire.write(byte(0));
Wire.write(decToBcd(second));
Wire.write(decToBcd(minute));
Wire.write(decToBcd(hour));
Wire.write(decToBcd(weekday));
Wire.write(decToBcd(monthday));
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));
49

Wire.write(byte(0));
Wire.endTransmission();
// Ends transmission of data
}
byte readByte() {
while (!Serial.available()) delay(10);
byte reading = 0;
byte incomingByte = Serial.read();
while (incomingByte != '\n') {
if (incomingByte >= '0' && incomingByte <= '9')
reading = reading * 10 + (incomingByte - '0');
else;
incomingByte = Serial.read();
}
Serial.flush();
return reading;
}
void printTime() {
char buffer[3];
const char* AMPM = 0;
readTime();
Serial.print(days[weekday-1]);
Serial.print(" ");
Serial.print(months[month-1]);
Serial.print(" ");
Serial.print(monthday);
Serial.print(", 20");
Serial.print(year);
Serial.print(" ");
if (hour > 12) {
hour -= 12;
AMPM = " PM";
}
else AMPM = " AM";
50

Serial.print(hour);
Serial.print(":");
sprintf(buffer, "%02d", minute);
Serial.print(buffer);
Serial.println(AMPM);
}
void readTime() {
Wire.beginTransmission(DS1307);
Wire.write(byte(0));
Wire.endTransmission();
Wire.requestFrom(DS1307, 7);
second = bcdToDec(Wire.read());
minute = bcdToDec(Wire.read());
hour = bcdToDec(Wire.read());
weekday = bcdToDec(Wire.read());
monthday = bcdToDec(Wire.read());
month = bcdToDec(Wire.read());
year = bcdToDec(Wire.read());
}

You might also like