MINIPROJECT
MINIPROJECT
1
This is to certify that the project entitled “Designing a Digital Clock With
Medicine Remainder alarm Using LPC2148” being submitted by J.VARUN
KUMAR(21331A0459),B.SRIDEVI(21335A0402),K.JASWANTH(21331A0461),D.ABHIV
ARSH(21331A0427),in fulfillment of the requirements for the award of the
Degree of Bachelor of Technology in Electronicsand Communication
Engineering is a record of bonafide work done by them undermy supervision
during the academic year 2023-2024.
2
ACKNOWLEDGEMENT
As a note of acknowledgement, with great solemnity and sincerity, we offer our profuse
thanks to Dr.H.SUDHA , Associate Professor, Department of ECE for guiding us
throughout our project work, giving a right direction and shape to our learning by extending
her expertise and experience in the field of education. Really, we are indebted to her for her
excellent and enlightened guidance.
We also thank Dr.Ramakrishnan Ramesh Principal, for extending his utmost support and
cooperation in providing all our provisions for the successful completion of the project.
With great solemnity and sincerity, we offer our profuse thanks to our management,
MANSAS for providing all the resources to complete the project. We sincerely thank all the
members of the staff in the Electronics and Communication Department for their sustained
help in our pursuits.
We thank all those who contributed directly and indirectly in successfully carrying out this
work.
J.VARUN KUMAR(21331A0459)
B.SRIDEVI(21335A0402)
K.JASWANTH(21331A0461)
D.ABHIVARSH(21331A0443)
3
Department of Electronics and Communication Engineering
Mission ad Vision of the Institute
Institute Vision:
Maharaj Vijayaram Gajapathi Raj College of Engineering strives to become a center par
excellence for technical education where aspiring students can be transformed into skilled
confidence and poise to meet the challenges in their chosen professional spheres.
that motivates learning as a social obligation which we owe to the students, their
parents/guardians and society at large and hence the effort is to leave no stone unturned in
the country training students in contemporary technologies meeting the standards of global
industry and to develop them into skillful engineers who are technologically superior and
4
Program Educational Objectives (PEOs):
PEO1: Graduates will have the ability to formulate and solve problems in
electronics and communication engineering domain with strong foundation in
mathematics, science and engineering fundamentals.
PEO2: Graduates will have required knowledge for a successful career in the
field of electronics and communication engineering.
5
TABLE OF CONTENTS
S.NO CONTENTS PAGE
NO
1 Problem 7
Statement
2 Abstract 8
3 Introduction 9
4 Block Diagram 12
5 Block Diagram 13
Explanation
6 Encryptionprocess 16
7 Source Code 12
8 Circuit Simulation 39
9 Working Principle 41
10 Result 44
11 Applications 50
12 Future scope 52
13 Conclusion 53
14 References 54
6
PROBLEM STATEMENT
Now a days so many persons are forgetting to take medicine on time due their busy
schedule .So, In order to take medicine on time we addressed to design a digital clock
attached with medicine remainder alarm on it by using LPC2148 microcontroller. In
this project connected a keypad and lcd display. When the alarm is set the it display
medicine remainder on lcd display.
7
ABSTRACT
This project proposes the development of a digital clock with an integrated
medicine reminder system to assist individuals in managing their medication
schedules effectively. The digital clock, beyond its conventional timekeeping
function, serves as a comprehensive tool for medication adherence,
particularly targeting users who require regular and timely intake of
prescribed medications due to chronic illnesses or age-related factors.
The key features of this digital clock with a medicine reminder include the
ability to input personalized medication schedules, set dosage timings, and
receive timely alerts for medication intake. Users can create profiles, input
their medications' details, including dosage instructions and frequency, and
customize reminder notifications according to their preferences. The system
ensures that users receive audible and visual alerts at the scheduled medication
times, promoting adherence and reducing the risk of missed doses.
Moreover, the digital clock with a medicine reminder system offers additional
functionalities such as tracking medication history, detecting missed doses,
providing guidance for missed doses, and facilitating user feedback and
engagement. The system aims to enhance user independence, confidence, and
accountability in managing their medication regimens, ultimately contributing
to improved health outcomes and quality of life.
8
INTRODUCTION
In today's fast-paced world, managing medication schedules can be a challenging
task, especially for individuals with chronic conditions or complex medication
regimens. Missing doses or taking medications at the wrong times can have serious
consequences on health outcomes. To address this issue, a digital clock with a
medicine reminder alarm system has been designed to help individuals effectively
manage their medication intake.
The digital clock with a medicine reminder alarm system combines the functionality
of a traditional clock with advanced features tailored for medication management.
Beyond its primary function of displaying time, this innovative device offers a user-
friendly interface for inputting medication schedules, setting dosage timings, and
receiving timely reminders for medication intake.
This introduction explores the key features and benefits of the digital clock with a
medicine reminder alarm system, highlighting its potential to improve medication
adherence, enhance user independence, and contribute to better health outcomes.
Key Features:
Time Display: The digital clock accurately displays the current time in hours and
minutes, ensuring users can track time effectively.
Medication Schedule Input: Users can input their medication schedules into the
system, including the name of the medication, dosage instructions, frequency of
intake, and specific times for each dose.
Customizable Alarm Settings: The alarm system allows users to set personalized
reminders for medication intake. Users can choose from a variety of alarm tones and
9
adjust volume settings based on their preferences.
Timely Reminders: The digital clock triggers audible and visual reminders at the
scheduled medication times, ensuring users do not miss their doses.
Missed Dose Alerts: In case of a missed dose, the system generates alerts to notify
users and provides guidance on how to proceed, such as taking the missed dose within
a specified timeframe or consulting a healthcare provider.
Medication History Tracking: The device maintains a record of medication intake
history, allowing users to track their adherence over time and share relevant
information with healthcare professionals if needed.
User-Friendly Interface: The interface is designed to be intuitive and easy to use,
catering to individuals with varying levels of technological proficiency.
Benefits:
Improved Medication Adherence: The timely reminders and alerts help users
adhere to their medication schedules, reducing the risk of missed doses and
improving treatment outcomes.
Enhanced User Independence: Users gain greater control and independence in
managing their medication regimens, leading to increased confidence and peace of
mind.
Healthcare Support: The device facilitates communication and collaboration
between users and healthcare providers by providing accurate medication history data
and adherence insights.
Convenience and Peace of Mind: The digital clock with a medicine reminder alarm
system offers convenience and peace of mind to users and caregivers, ensuring
10
medication management is efficient and stress-free.
In summary, the digital clock with a medicine reminder alarm system represents a
significant advancement in healthcare technology, addressing the critical need for
effective medication management. Its combination of timekeeping functionality with
medication reminders makes it a valuable tool for individuals seeking to maintain
optimal health and well-being
11
BLOCK DIAGRAM
12
BLOCK DIAGRAM EXPLANATION
LPC2148:
The LPC2148 is an ARM7TDMI-S based 32-bit RISC Microcontroller with Thumb
extensions 512KB on-chip Flash ROM with In-System Programming (ISP) and InApplication
Programming (IAP), 32KB RAM, Vectored Interrupt Controller, Two 10bit ADCs with 14
channels, USB 2.0 Full Speed Device Controller, Two UARTs, one with full modem interface.
Two I2C serial interfaces, Two SPI serial interfaces Two 32-bit timers, Watchdog Timer, PWM
unit, Real Time Clock with optional battery backup, Brown out detect circuit General purpose
I/O pins. CPU clock up to 60 MHz, On-chip crystal oscillator and On-chip PLL.
13
KEYPAD:
The 4*4 matrix keypad usually is used as input in a project. It has 16 keys in total, which means
the same input values. The 4*4 Matrix Keypad Module is a matrix non- encoded keypad
consisting of 16 keys in parallel. The keys of each row and column are connected through the
pins outside – pin Y1-Y4 as labeled beside control the rows, when X1-X4, the columns.
14
ENCRYPTION PROCESS
The Digital clock with medicine remainder alarm integrates LPC2148
microcontroller for encryption. It utilizes a keypad for user input and authentication.
Upon entering the time, it display’s “Medicine Remainder” automatically. The
LPC2148 ensures secure data transmission by encrypting communication between
the keypad and the microcontroller. Additionally, an LCD screen displays Clock with
time. Construction involves assembling components including LPC2148
microcontroller, keypad and LCD screen. Firmware development in C enables
encryption using LPC2148's built-in capabilities. Integration of encryption
algorithms ensures data security. The system offer’s to take medicine on time for all
ages .
15
SOURCE CODE:
MAIN PROGRAM:
#include<lpc213x.h>
#include<stdio.h>
16
void ISR_RTC(void) __irq
{
char str[20];
if(ILR & 0x01)
{
sec = CTIME0 & MASKSEC;
min = (CTIME0 & MASKMIN) >> 8;
hour = (CTIME0 & MASKHOUR) >> 16;
ILR = 0x01;
LCD_CMD(0x85);
sprintf(str,"%d: %d: %d",hour,min,sec);
LCD_INIT();
LCD_STRING(str);
}
else if(ILR & 0x02)
{
LCD_INIT();
LCD_STRING("Medicine Alarm");
UART0_Init();
UART0_Send_String("Medicine Alarm");
ILR = 0x02;
}
17
VICVectAddr = 0;
}
// RTC INITIALIZATION
void RTC_Init()
{
ILR = 0x01;
CCR = 0x02;
CIIR = 0x07;
PREINT = (int)(fpclk/32768)-1;
PREFRAC = (int)(fpclk-((PREINT+1)*32768));
SEC = 5;
MIN = 9;
HOUR = 11;
ALSEC = 11;
ALMIN = 9;
ALHOUR = 11;
CCR = 0x01;
VICIntSelect &= (~(1<<13));
VICVectCntl1 = 0x20 | 13;
VICVectAddr1 = (long)ISR_RTC;
VICIntEnable |= (1<<13);
}
18
// KEYPAD INTERRUPT INITIALIZATION
void keypad_interrupt_init()
{
PINSEL0 &=(~((1<<15)|(1<<14))); // P0.7
PINSEL0 |=(0x3)<<14;
EXTINT = 0x04;
EXTMODE = 0x04;
EXTPOLAR = 0x00;
VICIntSelect &= (~(1<<16));
VICVectCntl0 = 0x20 | 16;
VICVectAddr0 = (long)ISR_KEYPAD;
VICIntEnable |= (1<<16);
}
int main()
{
PINSEL2 = 0x00000000;
LCD_INIT();
LCD_CMD(0x80);
LCD_STRING("Time:");
LCD_CMD(0xC0);
LCD_STRING("Press EDIT");
19
RTC_Init();
keypad_interrupt_init();
while(1)
{
}
return 0;
}
EDITOR HEADER.H:
#include<lpc213x.h>
#include <string.h>
#include <stdlib.h>
#include "Keypad Header.h"
20
int c, p=0;
for (c = 1; c >= 0; c--)
{
p = p * 10 + str[c] - '0';
}
return p;
}
int edit_function()
{
strcpy(hr, "");
strcpy(mi, "");
strcpy(se, "");
strcpy(alhr, "");
strcpy(almi, "");
strcpy(alse, "");
LCD_INIT();
LCD_STRING("Edit 1. Time");
LCD_CMD(0xC0);
LCD_STRING("2. Alarm 3.Exit");
key_val = key_detect();
LCD_INIT();
LCD_DATA(key_val);
21
if (key_val == '1')
{
LCD_INIT();
LCD_STRING("Enter Hour : ");
LCD_CMD(0xC0);
for(j=0;j<2;j++)
{
hr[j]=key_detect();
LCD_DATA(hr[j]);
//delay_ms(50);
flag++;
if(flag==2)
{
flag = 0;
break;
}
}
HOUR = atoi(hr);
LCD_INIT();
LCD_STRING("Enter Minute: ");
LCD_CMD(0xC0);
for(j=0;j<2;j++)
22
{
mi[j]=key_detect();
LCD_DATA(mi[j]);
//delay_ms(50);
flag++;
if(flag==2)
{
flag = 0;
break;
}
}
MIN = atoi(mi);
LCD_INIT();
LCD_STRING("Enter Second: ");
LCD_CMD(0xC0);
for(j=0;j<2;j++)
{
se[j]=key_detect();
LCD_DATA(se[j]);
//delay_ms(50);
flag++;
23
if(flag==2)
{
flag = 0;
break;
}
}
SEC = atoi(se);
}
else if(key_val == '2')
{
LCD_INIT();
LCD_STRING("Alarm Hour : ");
LCD_CMD(0xC0);
for(j=0;j<2;j++)
{
alhr[j]=key_detect();
LCD_DATA(alhr[j]);
//delay_ms(50);
flag++;
if(flag==2)
{
flag = 0;
24
break;
}
}
ALHOUR = atoi(alhr);
LCD_INIT();
LCD_STRING("Alarm Minute: ");
LCD_CMD(0xC0);
for(j=0;j<2;j++)
{
almi[j]=key_detect();
LCD_DATA(almi[j]);
//delay_ms(50);
flag++;
if(flag==2)
{
flag = 0;
break;
}
}
ALMIN = atoi(almi);
25
LCD_INIT();
LCD_STRING("Alarm Second: ");
LCD_CMD(0xC0);
for(j=0;j<2;j++)
{
alse[j]=key_detect();
LCD_DATA(alse[j]);
//delay_ms(50);
flag++;
if(flag==2)
{
flag = 0;
break;
}
}
ALSEC = atoi(alse);
}
else if(key_val == '3')
{
LCD_INIT();
LCD_STRING("Exit Editing");
return 0;
26
}
return 1;
}
UART HEADER.H:
#include<lpc213x.h>
#define fpclk 15000000
#define BAUD_BPS 9600
27
VICVectAddr = (long)ISR_UART0; // Assigning the ISR value to the
VICVectAddr
VICVectCntl0 = (0x20 | 6) ;// Selecting the Vectored IRQ mode*/
}
char UART_Receive_Byte()
{
while((U0LSR & 0x01) == 0 );// Check (RDR bit)
// Wait till the complete data is received
return U0RBR; // return the received Byte which is stored in received
buffer
}
28
{
UART0_Send_Byte(*str++);
}
}
KEYPAD HEADER.H:
#include<lpc213x.h>
#define R0 (1<<24)
#define R1 (1<<25)
#define R2 (1<<26)
#define R3 (1<<27)
#define C0 0X10000000//(1<<28)
#define C1 0X20000000//(1<<29)
#define C2 0X40000000//(1<<30)
#define C3 0X80000000//(1<<31)
void keypad_init()
29
{
//PINSEL2 = 0x00000000;// Selecting the GPIO function of port 1 from P1.16
to P1.31
IODIR1 &= ~(C0|C1|C2|C3);// Take the columns as inputs
IODIR1 |= (R0|R1|R2|R3);// Take the columns as outputs
}
30
}
if((IOPIN1 & C2) == 0)
{
while((IOPIN1 & C2) == 0);
return keypad_matrix[0][2];
}
if((IOPIN1 & C3) == 0)
{
while((IOPIN1 & C3) == 0);
return keypad_matrix[0][3];
}
IOCLR1 = R1;
IOSET1 = R0|R2|R3;
if((IOPIN1 & C0) == 0)
{
while((IOPIN1 & C0) == 0);
return keypad_matrix[1][0];
}
if((IOPIN1 & C1) == 0)
{
while((IOPIN1 & C1) == 0);
return keypad_matrix[1][1];
}
31
if((IOPIN1 & C2) == 0)
{
while((IOPIN1 & C2) == 0);
return keypad_matrix[1][2];
}
if((IOPIN1 & C3) == 0)
{
while((IOPIN1 & C3) == 0);
return keypad_matrix[1][3];
}
IOCLR1 = R2;
IOSET1 = R1|R0|R3;
if((IOPIN1 & C0) == 0)
{
while((IOPIN1 & C0) == 0);
return keypad_matrix[2][0];
}
if((IOPIN1 & C1) == 0)
{
while((IOPIN1 & C1) == 0);
return keypad_matrix[2][1];
}
if((IOPIN1 & C2) == 0)
32
{
while((IOPIN1 & C2) == 0);
return keypad_matrix[2][2];
}
if((IOPIN1 & C3) == 0)
{
while((IOPIN1 & C3) == 0);
return keypad_matrix[2][3];
}
IOCLR1 = R3;
IOSET1 = R0|R1|R2;
if((IOPIN1 & C0) == 0)
{
while((IOPIN1 & C0) == 0);
return keypad_matrix[3][0];
}
if((IOPIN1 & C1) == 0)
{
while((IOPIN1 & C1) == 0);
return keypad_matrix[3][1];
}
if((IOPIN1 & C2) == 0)
{
33
while((IOPIN1 & C2) == 0);
return keypad_matrix[3][2];
}
if((IOPIN1 & C3) == 0)
{
while((IOPIN1 & C3) == 0);
return keypad_matrix[3][3];
}
}
}
LCD HEADER.H:
#include<lpc213x.h>
#include<stdio.h>
#define LCD (0x0F<<20)
#define RS (1<<17)
#define RW (1<<18)
#define EN (1<<19)
34
#define EN_Low() IOCLR1 = EN
int i;
35
EN_Low();
temp = (ch & 0x0F);
IOCLR1 = LCD;
IOSET1 = (temp<<20);
EN_High();
delay_ms(3);
EN_Low();
}
36
EN_High();
delay_ms(3);
EN_Low();
}
void LCD_INIT()
{
IODIR1 |= LCD | RS | RW | EN;
LCD_CMD(0x02);
LCD_CMD(0x28);
LCD_CMD(0x06);
LCD_CMD(0x0C);
LCD_CMD(0x01);
//LCD_CMD(0x);
}
37
void LCD_PRINT_NUM(int n)
{
char str[6];
sprintf(str,"%d",n);
LCD_STRING(str);
}
38
CIRCUIT SIMULATION
39
User Authentication and Display:
Upon initialization, the LCD display welcomes the user and prompt’s as
Edit 1. Time.
2. Alarm
3.Exit
The user enter number. If number entered is 1 then its asks to enter the hours,
minutes and seconds. If user enter the value it shows the time.
If number entered is 2 then it’s active the medicine remainder alarm and asks
to set the time. If the time occurs it display Medicine remainder and shows the
time again.
If the number entered is 3 the it gets exit and show time which was set in the
code.
Then the door automatically closes after sometime when the motor rotates
anticlockwise.
40
WORKING PRINCIPLE
Micro Controller:
In the project " Designing A Digital Clock With Medicine Remainder alarm Using
LPC2148" the microcontroller (LPC2148) plays a central role in controlling and
coordinating the different components of the system. Here's how the microcontroller
interfaces with the various parts of the project.
Keypad Interface: The microcontroller interfaces with a keypad through GPIO
(General Purpose Input/Output) pins. The keypad is connected to the microcontroller,
and when a user enters the number, the microcontroller reads the key presses and
processes them.
LCD Display Interface: The microcontroller interfaces with an LCD display
through GPIO pins. It sends commands and data to the LCD to display messages or
prompts to the user. The LCD display provides visual feedback to the user, such as
asking them to enter the number and display corresponding program written.
Seven-Segment Display Interface: The microcontroller interfaces with the seven-
segment display through GPIO pins. It show the message like Medicine remainder.
Keypad:
The LPC2148 microcontroller interfaces with the keypad to receive user input.
The keypad is typically arranged in a matrix format, with rows and columns of
buttons. The microcontroller configures the necessary GPIO (General Purpose
Input/Output) pins to scan the keypad matrix for button presses.
Matrix Configuration: The keypad is arranged in a matrix format, where the
41
rows and columns form a grid. Each key corresponds to a specific row-column
intersection.
Connection: The row pins of the keypad are connected to the output pins of the
microcontroller, while the column pins are connected to the input pins
Pull-Up Resistors: The column pins are usually pulled up to a high logic level
(e.g., 5V) using internal or external pull-up resistors. This ensures that when
no key is pressed, the column pins remain in a high state.
Scanning Process: The scanning process begins by selecting one row at a time
and setting it to a low logic level (e.g., GND) while keeping the other rows
high (pulled up). For example, Row1 is set to low, and Row2-Row4 are set to
high.
Column Scanning: With one row set to low, the microcontroller scans the state
of each column. It does this by sequentially setting each column pin as an input
and checking its logic level. If any key in the selected row-column intersection
is pressed, the corresponding column pin will be pulled down to a low logic
level.
Key Detection: By analyzing the state of the column pins, the microcontroller
can detect which key in the selected row is pressed. The specific row and
column combination determines the pressed key's identification.
Repeating the Process: The scanning process is repeated for all rows. Each row
is sequentially set low while the rest remain high, and the column scanning is
performed to detect key presses.
42
LCD:
The LCD (Liquid Crystal Display) is a crucial component in the displayed the
message as Medicine Remainer . It serves as the user interface, displaying prompts,
messages, and the current system status.
Display Initialization: Upon system startup, the LPC2148 microcontroller
initializes the LCD display. This process involves configuring the necessary
control pins and setting the display parameters such as character size, cursor
settings, and backlight control.
User Instructions and Prompts: The LCD display presents welcoming
messages and instructions for the user. It prompts the user to enter the number
to gain access.
Password Input Display: As the user enters the number through the keypad,
the LCD display shows asterisks or other symbols to mask the actual characters
for security purposes.
Authentication Feedback: After the user submits the values, the LPC2148
microcontroller perform the program written. The LCD display then provides
feedback to the user based on the authentication result.
If the number entered is 1, then it shows the time according to entered values.
If the number entered is 2, then it shows the required message “Medicine
Remainder” according to the alarm set by the user.
If the number entered is 3, then it exits and shows the time given in the code.
43
RESULT
Edit 1.
44
45
ALARM.2
46
47
48
EXIT.3
49
APPLICATIONS
Designing a digital clock with a medicine reminder feature using the LPC2148
microcontroller can be a great project with practical applications. Here are some key
features and applications you can consider for such a system:
Real-Time Clock (RTC) Functionality:
Utilize the LPC2148's built-in RTC module to keep track of the current time
accurately.Set the clock to display the time in a user-friendly format on an LCD
display.
Medicine Reminder System:
Create a database or storage system to store medicine schedules, including the name
of the medicine, dosage, and timing (e.g., morning, afternoon, evening).Use the RTC
module to trigger alarms or reminders at specified times for medication intake.
Display medicine reminders on the LCD screen along with the current time.
User Interface:
Implement a user interface using buttons or a keypad to allow users to set the clock
time, add/edit/delete medicine schedules, and acknowledge or snooze reminders. Use
LEDs or a buzzer as additional notification indicators for reminders.
Data Persistence:
Employ non-volatile memory (such as EEPROM or flash memory) on the LPC2148
to store user settings, medicine schedules, and other important data. This ensures that
data is retained even when the power is turned off.
Alarm and Notification System:
Design an alarm system that triggers visual and audible alerts when it's time for
50
medication. Implement a snooze function to allow users to postpone reminders if
needed.
Error Handling and Feedback:
Include error handling mechanisms to deal with scenarios such as incorrect input,
missed medication acknowledgments, or communication failures. Provide feedback
on the LCD display or through LEDs to indicate successful operations, errors, or low
battery status (if using a battery-powered system).
Low-Power Design:
Optimize the system for low power consumption, especially if it's intended for
portable or battery-operated use. Implement sleep modes or power-saving techniques
to conserve energy when the device is not actively in use.
Safety and Security:
Consider implementing features such as password protection or user authentication
to prevent unauthorized access to sensitive data like medication schedules. Ensure
the system is reliable and robust to avoid missed reminders or incorrect timekeeping,
especially in critical medical applications.
By integrating these features into your digital clock with a medicine reminder system
using the LPC2148, you can create a useful and practical device for individuals who
need regular medication schedules and reminders.
51
FUTURE SCOPE:
Future work will build upon the improvement of the current design. Time and
Date display will be added and we can have multiple alarm with different message
for each alarm. Also we can have a buzzer for alarm indication or even use a
Bluetooth speaker for alarm sound. The project will be further updated i if any
improvements are made.
52
CONCLUSION
Embedded systems and Internet of things is booming in today’s world. The world
is more connected than it was ever before. This project serves as a gateway to the
world of embedded systems and connected devices. The road ahead is certainly
interesting and challenging.
53
REFERENCES
1. https://github.com/sibaprasadchoudhury/digitalClock
2. https://www.engineersgarage.com/digital-clock-using-inbuilt-rtc-of-lpc2148-
arm7-part-8-9/
3. https://www.keil.com/dd/chip/3880.htm
54