MARS, Medication Alarm Reminder System
Click to view full size
Preview 1

Description

This design is for a pillbox that automatically opens and closes 3 boxes based on a user input timer system. There is also an interrupt button that closes the boxes, a buzzer to alert users, and an LCD to display extra information to the user. The full arduino code is as follows : #include <Servo.h> #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 8); Servo myservo1; Servo myservo2; Servo myservo3; const int beeper = 13; int buttonState = 0; int opn = 40; int closed = 130; int pos1 = closed; int pos2 = closed; int pos3 = closed; int delay1=0; int delay2=0; int delay3=0; int delay4=0; int delay5=0; void setup() { myservo1.attach(10); myservo2.attach(9); myservo3.attach(6); lcd.begin(16, 2); lcd.clear(); myservo1.write(pos1); delay(1000); myservo2.write(pos2); delay(1000); myservo3.write(pos3); attachInterrupt(0, blink, CHANGE); pinMode(beeper, OUTPUT); Serial.begin(9600); Serial.println(" "); Serial.print("How many seconds from the start until Box 1 opens: "); delay(3000); if (Serial.available()) {delay1= Serial.parseInt(); } Serial.println(delay1); Serial.print("How many seconds between Box 1 and Box 2 opening: "); delay(3000); if (Serial.available()) {delay2= Serial.parseInt(); } Serial.println(delay2); Serial.print("How many seconds between Box 2 and Box 3 opening: "); delay(3000); if (Serial.available()) {delay3= Serial.parseInt(); } Serial.println(delay3); Serial.print("How many seconds between Box 3 opening and refilling pills: "); delay(3000); if (Serial.available()) {delay4= Serial.parseInt(); } Serial.println(delay4); Serial.print("How many seconds between refilling pills and Box 1 opening: "); delay(3000); if (Serial.available()) {delay5= Serial.parseInt();} Serial.println(delay5); delay1=delay1*1000; delay2=delay2*1000; delay3=delay3*1000; delay4=delay4*1000; delay5=delay5*1000; delay(delay1); } void loop() { if (pos1==closed){ for (int i=500; i>0; i--) { digitalWrite(beeper, HIGH); delayMicroseconds(i); digitalWrite(beeper, LOW); delayMicroseconds(i); } } pos1=opn; myservo1.write(opn); lcd.clear(); lcd.print("Take pills from"); lcd.setCursor(0,1); lcd.print("box "); if (pos1==opn){ lcd.print("1 "); } if (pos2==opn){ lcd.print("2 "); } if (pos3==opn){ lcd.print("3 "); } delay(delay2); if (pos2==closed){ for (int i=500; i>0; i--) { digitalWrite(beeper, HIGH); delayMicroseconds(i); digitalWrite(beeper, LOW); delayMicroseconds(i); } } pos2=opn; myservo2.write(pos2); lcd.clear(); lcd.print("Take pills from"); lcd.setCursor(0,1); lcd.print("box "); if (pos1==opn){ lcd.print("1 "); } if (pos2==opn){ lcd.print("2 "); } if (pos3==opn){ lcd.print("3 "); } delay(delay3); if (pos3==closed){ for (int i=500; i>0; i--) { digitalWrite(beeper, HIGH); delayMicroseconds(i); digitalWrite(beeper, LOW); delayMicroseconds(i); } } pos3=opn; myservo3.write(pos3); lcd.clear(); lcd.print("Take pills from"); lcd.setCursor(0,1); lcd.print("box "); if (pos1==opn){ lcd.print("1 "); } if (pos2==opn){ lcd.print("2 "); } if (pos3==opn){ lcd.print("3 "); } delay(delay4); pos1=opn; pos2=opn; pos3=opn; for (int i=500; i>0; i--) { digitalWrite(beeper, HIGH); delayMicroseconds(i); digitalWrite(beeper, LOW); delayMicroseconds(i); } myservo1.write(pos1); myservo2.write(pos2); myservo3.write(pos3); lcd.clear(); lcd.print("Refill the pills!"); delay(5000); pos1=closed; pos2=closed; pos3=closed; lcd.clear(); myservo1.write(pos1); myservo2.write(pos2); myservo3.write(pos3); delay(delay5); } void blink() { if (pos1==opn){ pos1=closed; myservo1.write(pos1); } if (pos2==opn){ pos2=closed; myservo2.write(pos2); } if (pos3==opn){ pos3=closed; myservo3.write(pos3); } lcd.clear(); for (int i=0; i<500; i++) { digitalWrite(beeper, HIGH); delayMicroseconds(i); digitalWrite(beeper, LOW); delayMicroseconds(i); } }

From NIH 3D

Model source and downloads

This page preserves searchable metadata and attribution. Use NIH 3D for the current files and source details.

Source creator
Genesis Team
Source license
Public Domain
Archived copies are shared under the license shown.
View/download on NIH 3D

Makes

See how others have printed this model

Comments

Share your thoughts and ask questions

Sign in to join the conversation

Sign In

MARS, Medication Alarm Reminder System

From NIH 3D
Likes
0
Views
0
Remixes
0

Category

learning

License

CC0

Published

8/31/2026

Availability

free on NIH 3D