Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Uno Smart Medicine Reminder with LCD Display and RTC

View and Edit Project In Cirkit DesignerImage of Arduino Uno Smart Medicine Reminder with LCD Display and RTC

Smart Medicine Reminder Circuit Documentation

Summary

The Smart Medicine Reminder circuit is designed to help users remember to take their medicine at scheduled times. The circuit includes an Arduino Uno R3 microcontroller, an LCD display, an RTC module, push buttons, a piezo buzzer, resistors, and a trimmer potentiometer. The user can set the time, number of dosages, and the next medicine time using the push buttons. The LCD displays the current time and settings, while the buzzer alerts the user when it's time to take their medicine.

Component List

  1. Pushbutton

    • Description: A simple pushbutton used for user input.
    • Pins: Pin 1 (in), Pin 2 (in), Pin 3 (out), Pin 4 (out)
  2. RTC DS3231

    • Description: Real-Time Clock module for keeping track of time.
    • Pins: 32K, SQW, SCL, SDA, VCC, GND
  3. Arduino Uno R3

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: D0/RX, D1/Tx, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, A0, A1, A2, A3, A4/SDA, A5/SCL, GND, 5V, 3.3V, Vin, RESET, IOREF, USB Jack, Power Jack
  4. Trimmer Potentiometer

    • Description: Adjustable resistor used to control the contrast of the LCD.
    • Pins: leg1, wiper, leg2
    • Properties: Resistance: 10k Ohms
  5. Piezo Buzzer

    • Description: Buzzer used to alert the user.
    • Pins: pin 1, pin 2
  6. Resistor

    • Description: Resistor used for current limiting.
    • Pins: pin1, pin2
    • Properties: Resistance: 200 Ohms
  7. LCD Display (16 pin)

    • Description: 16x2 character LCD display.
    • Pins: VSS, VDD, VO, RS, R_W, E, DB0, DB1, DB2, DB3, DB4, DB5, DB6, DB7, A, K

Wiring Details

Pushbutton 1

Pushbutton 2

Pushbutton 3

Pushbutton 4

RTC DS3231

Trimmer Potentiometer

Piezo Buzzer

Resistor 1

Resistor 2

Resistor 3

Resistor 4

Resistor 5

LCD Display (16 pin)

Documented Code

#include <LiquidCrystal.h>
#include <RTClib.h>
#include <Wire.h>

/*
 * Smart Medicine Reminder
 * This Arduino sketch controls an LCD display, RTC, push buttons, and a buzzer
 * to remind users to take their medicine at scheduled times. The user can set
 * the time, number of dosages, and the next medicine time using the push buttons.
 */

// LCD pins
const int rs = 12, en = 11, d4 = 6, d5 = 5, d6 = 4, d7 = 3;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// RTC
RTC_DS3231 rtc;

// Buzzer pin
const int buzzerPin = 13;

// Push buttons
const int button1Pin = A0;
const int button2Pin = 7;
const int button3Pin = 8;
const int button4Pin = 9;

// Variables to store settings
int setHour = 0;
int setMinute = 0;
int setDosages = 0;
DateTime nextMedicineTime;

void setup() {
  // Initialize LCD
  lcd.begin(16, 2);
  lcd.print("Medicine Reminder");
  delay(2000);
  lcd.clear();

  // Initialize RTC
  if (!rtc.begin()) {
    lcd.print("Couldn't find RTC");
    while (1);
  }
  if (rtc.lostPower()) {
    lcd.print("RTC lost power");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }

  // Initialize buzzer
  pinMode(buzzerPin, OUTPUT);

  // Initialize push buttons
  pinMode(button1Pin, INPUT_PULLUP);
  pinMode(button2Pin, INPUT_PULLUP);
  pinMode(button3Pin, INPUT_PULLUP);
  pinMode(button4Pin, INPUT_PULLUP);
}

void loop() {
  DateTime now = rtc.now();

  // Display current time
  lcd.setCursor(0, 0);
  lcd.print(now.hour(), DEC);
  lcd.print(':');
  lcd.print(now.minute(), DEC);
  lcd.print(':');
  lcd.print(now.second(), DEC);

  // Check push buttons for setting time and dosage
  if (digitalRead(button1Pin) == LOW) {
    delay(50); // Debounce delay
    if (digitalRead(button1Pin) == LOW) {
      // Code to set hour
      lcd.setCursor(0, 1);
      lcd.print("Set Hour: ");
      setHour = (setHour + 1) % 24; // Increment hour
      lcd.print(setHour);
      delay(1000); // Wait for 1 second to avoid multiple increments
    }
  }
  if (digitalRead(button2Pin) == LOW) {
    delay(50); // Debounce delay
    if (digitalRead(button2Pin) == LOW) {
      // Code to set minute
      lcd.setCursor(0, 1);
      lcd.print("Set Minute: ");
      setMinute = (setMinute + 1) % 60; // Increment minute
      lcd.print(setMinute);
      delay(1000); // Wait for 1 second to avoid multiple increments
    }
  }
  if (digitalRead(button3Pin) == LOW) {
    delay(50); // Debounce delay
    if (digitalRead(button3Pin) == LOW) {
      // Code to set number of dosages
      lcd.setCursor(0, 1);
      lcd.print("Set Dosages: ");
      setDosages = (setDosages + 1) %