source of inspiration my final project idea
"I'm developing a medicine reminder system that also serves as an educational tool to inform patients about the correct way to take their medications—whether before or after meals. To implement the reminder functionality efficiently, I'm utilizing the Millis() function to track time for one drug then send educational message for patient using LCD Screen
Google: For searching about different code
YouTube: For searching and gathering inspiration
project hub : inspiration
Tinkercad: A software to design and simulate electronic circuits
Electronic components: include an LED, buzzer, wires, Arduino, transistor, a breadboard, LCD screen and push button
The Arduino IDE versions 2, 3, and 4 will be used for writing and implementing the code for the project.
cardboard: for inclusion of electronic components
Components:
LCD Display (I2C 16x2) – Used to display reminders and messages.
Buzzer – Provides an audible alert for reminders.
Push Button – Likely used to acknowledge the reminder when press it the alarm is stopped, and next dose time appeared
LED with Resistor – A visual indicator that a reminder is active.
Jumper Wires & Breadboard – Used for wiring connections.
LCD Display (I2C) Wiring:
GND → Arduino GND
VCC → Arduino 5V
SDA → Arduino A4
SCL → Arduino A5
Buzzer Wiring:
One terminal of the buzzer is connected to an Arduino digital pin 8
The other terminal is connected to GND.
Push Button Wiring:
One leg of the button is connected to GND.
The other leg is connected to an Arduino digital pin 7
The anode (longer leg) of the LED is connected to an Arduino digital pin 9
The cathode (shorter leg) is connected to GND through a current-limiting resistor330Ω
part-1: 1Initialization & Setup (Setting Up Components)
This part initializes the LCD, buzzer, LED, and button. It also displays startup messages on the LCD.
1-Include Libraries
Wire.h: Enables I2C communication.
LiquidCrystal_I2C.h: Controls the LCD via I2C.
2-Define LCD Display
Uses address 0x27 for a 16×2 LCD.
3-Define Pin Constants
buzzerPin = 8 → Controls the buzzer.
ledPin = 9 → Controls the LED.
buttonPin = 7 → Input button.
4-Time and Logic Variables
previousMillis = 0 → Tracks time using millis().
interval = 6000 → Reminder interval (6 seconds).
alarmActive and alarmTriggered → Manage alarm states.
5-Setup Function (setup)
Set buzzerPin and ledPin as OUTPUT.
Set buttonPin as INPUT with internal PULLUP resistor.
6-Initialize LCD Display
Turn on backlight and clear screen.
Display messages sequentially:
"Medicine Reminder" (waits 3 seconds).
"Your Health" (waits 3 seconds).
"Is Matter" (waits 3 seconds).
This part continuously checks if the set interval has passed, triggering the alarm accordingly. It also listens for a button press to stop the alarm.
Uses millis() to check if 6 seconds have passed.
If so, it triggers the alarm.
If the button is pressed, it stops the alarm and displays the next dose reminder.
Track Time Continuously
currentMillis = millis(); → Stores the current time in milliseconds.
Check if the Reminder Interval Has Passed
if (!alarmTriggered && currentMillis - previousMillis >= interval) {
Ensures the alarm is not already triggered.
Checks if the set interval (6 seconds) has passed.
Actions:
Reset previousMillis to currentMillis.
Call triggerAlarm(); to activate the alarm.
Set alarmTriggered = true; to indicate the alarm is active.
Check if the Button is Pressed to Stop the Alarm
if (digitalRead(buttonPin) == LOW && alarmTriggered) {
Detects if the button is pressed (LOW state).
Ensures the alarm was triggered.
Actions:
Call deactivate Alarm(); to stop the alarm.
Call showNextDoseMessage(); to display the next reminder.
Reset alarmTriggered = false; to allow the next cycle.
Reset previousMillis = millis(); to start timing for the next reminder.
This part contains functions that handle the alarm (buzzer & LED) and LCD messages.
triggerAlarm: Turns on the buzzer & LED, and displays the medicine reminder.
deactivateAlarm: Turns off the buzzer & LED.
showNextDoseMessage: Informs the patient about the next dose.
I asked my instructor about my assigmnet idea and he tell me about millis function and guided me .
1-I encountered an issue where text on the LCD overlapped due to long messages being displayed without clearing the screen. To resolve this, I used lcd.clear() before printing new text, divided long sentences into shorter phrases to fit within the 16-character limit, and added delay(3000) between messages. This ensured each message was displayed clearly without overlapping, making the text easier to read.
2-Initially, the LCD screen didn’t work when I installed it. However, while troubleshooting the wiring, I discovered that I had mistakenly swapped the connections, wiring SDA to A5 and SCL to A4 on the Arduino.
I learned how to use the LCD screen library, how to work with the millis() function, and how to perform unit testing for each circuit component, which I plan to apply in my final project, inshallah.
Title of Media