Smart Medicine Reminder System
Time-Based Automation with Arduino Uno, DS3231 RTC, & LCD Alert Interfaces
This embedded prototype is designed to alert users at scheduled daily intervals to take their medication. Utilizing high-accuracy tracking via a DS3231 Real-Time Clock (RTC) module and an Arduino Uno processor, the device compares local time coordinates continuously. When a scheduled time is reached, an active buzzer triggers alongside a visual 16x2 LCD alert prompt until acknowledged by a tactile cancel switch.
To construct this clinical notification alarm prototype, gather the following physical elements:
| Target Component Label | Structural Allocation Quantity | Functional Deployment Purpose |
|---|---|---|
| Arduino Uno | 1 Unit | Primary system processor managing polling loops, temporal evaluations, and peripheral signaling. |
| DS3231 RTC Module | 1 Unit | High-precision timekeeper keeping accurate system hours even when the primary board is unpowered. |
| 16x2 LCD with I2C Module | 1 Unit | Primary user display output showing real-time clock cycles and specific alert messages. |
| Active Buzzer | 1 Unit | Generates high-frequency acoustic feedback during alarm status. |
| Tactile Push Button | 1 Unit | Provides interactive button control to clear and silence the ongoing buzzer cycle. |
Connect your structural hardware units to the Arduino Uno exactly as structured in the deployment table below:
| Device Terminal Pin Out | Arduino Target Pin Mapping | Functional Context |
|---|---|---|
| RTC SDA / LCD SDA | Analog Input Pin A4 | I2C Bus Serial Data Shared Channel |
| RTC SCL / LCD SCL | Analog Input Pin A5 | I2C Bus Serial Clock Shared Channel |
| Buzzer positive (+) | Digital Output Pin D8 | Active Output Pin driving acoustic alarms |
| Push Button Terminal | Digital Input Pin D7 | Configured via Internal Pull-up (D7 to GND) |
Flash this firmware code directly onto your target MCU within the Arduino IDE environment to boot your hardware system:
#include <Wire.h>
#include <RTClib.h>
#include <LiquidCrystal_I2C.h>
RTC_DS3231 rtc;
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Pins
const int buzzerPin = 8;
const int buttonPin = 7;
// Alarm state
bool alarmActive = false;
// Medicine Times
const int medHour[] = {8, 14, 20}; // 8 AM, 2 PM, 8 PM
const int medMinute[] = {0, 0, 0};
void setup() {
pinMode(buzzerPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
digitalWrite(buzzerPin, LOW);
lcd.init();
lcd.backlight();
Serial.begin(9600);
if (!rtc.begin()) {
lcd.print("RTC Error!");
while (1);
}
// Uncomment ONLY once to set RTC to your PC's time,
// then comment it again and upload.
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Medicine");
lcd.setCursor(0, 1);
lcd.print("Reminder");
delay(2000);
}
void loop() {
DateTime now = rtc.now();
// Display Current Time
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Time ");
if (now.hour() < 10) lcd.print("0");
lcd.print(now.hour());
lcd.print(":");
if (now.minute() < 10) lcd.print("0");
lcd.print(now.minute());
lcd.print(":");
if (now.second() < 10) lcd.print("0");
lcd.print(now.second());
lcd.setCursor(0, 1);
lcd.print("Waiting...");
// Check Medicine Times
for (int i = 0; i < 3; i++) {
if (now.hour() == medHour[i] &&
now.minute() == medMinute[i] &&
now.second() < 10) {
alarmActive = true;
}
}
// Alarm
while (alarmActive) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("TAKE MEDICINE");
lcd.setCursor(0, 1);
lcd.print("Press Button");
digitalWrite(buzzerPin, HIGH);
if (digitalRead(buttonPin) == LOW) {
digitalWrite(buzzerPin, LOW);
alarmActive = false;
delay(1000);
}
}
digitalWrite(buzzerPin, LOW);
delay(500);
}
RTClib (by Adafruit) and LiquidCrystal_I2C libraries to your local library environment prior to compiling this project.
.png)
0 Comments