ATtiny Weekly Pill Reminder

by jbike in Circuits > Arduino

285 Views, 0 Favorites, 0 Comments

ATtiny Weekly Pill Reminder

20231210_082304.jpg
20231210_082317.jpg
Pill Reminder Alarm
20231210_140315.jpg

This device reminds a person to take their weekly (or other time) pill. It uses a super accurate clock module, and can be battery powered since most of the time the ATtiny85 and the display are sleeping. It uses only 170 micro amps in sleep, and around 20 mA in wake mode. It has a alarm acknowledge button, and a test button. The time must be set using a standard Arduino Uno initially, but should keep accurate time for at least a year on a CR2032 coin battery.

Supplies

1 ea. 128 x 64 oled display, Amazon, $8.99

1 ea. ATtiny85 8 pin microcontroller, $5, eBay

1 ea. DS3231 RTC clock module, $1.23 to $8, eBay

1 ea. development programmer board for ATtiny $1.23, eBay

1 ea. USBtinyISP bootloader for ATtiny $10, Amazon

2 ea. PCB tactile micro push buttons, assortment box, $8 Amazon

1 ea. 170 hole mini breadboard, $6, assortment of 6, Amazon

1 ea. assorted colors #22 AWG solid core wire kit $12 Amazon (jumper wires)

Build Steps

20231210_140315.jpg
20231210_082215.jpg
Resize Wizard-1.jpg
DS3231.jpg
tools.jpg
20240119_171452.jpg
20240119_171532.jpg

This project assumes you already have the free Arduino IDE app on your computer and an Arduino Uno board or similar for programming the DS3231 clock module for current time, day, and date using the DS3231 library example "set". The clock module connects to Arduino 5v, ground, and pins A4 and A5 (SDA, SCL) using male to female jumper wires. Check the time is correct by running the DS3231 example "now". Modify the board for battery power operation by desoldering and removing resistor pack 1. Remove clock module battery charging circuit diode or resistor (see photo) or else the non rechargeable CR2032 lithium coin cell will swell up (see photo) and probably explode. The non rechargeable battery will last a year or two; an expensive rechargeable battery is not needed.

Download the project code into a new Arduino sketch. The ATtiny85 needs the USBtinyISP programmer and programmer board to download code from the Arduino IDE app. Install the ATTinyCore in boards manager, and select the board ATtiny25/45/85 (no bootloader). Under tools, select the ATtiny85, speed 16MHz (PLL) (see photo) and select the programmer. Set up the drivers for the USBtinyISP per instructions that come with the device, then install the ATtiny in the programmer board (insuring the correct pin alignment so as to not burn it out) and attach to the USBtinyISP and USB cable to PC USB port. Back to the Arduino IDE, select Burn Bootloader from the tools menu (at the bottom). To program, select tab Sketch, then Upload Using Programmer.

Wire breadboard according to circuit diagram below. Note that power remains connected to the ATtiny and clock, but the display is powered by an ATtiny pin as it can't be shut down in software. The clock module draws very little power, a few micro amps, but needs a always energized pull up resistor on the SQW pin so that the clock alarm can pull SQW LOW to wake the ATtiny from sleep.

Power with either a USB charger (5 volts) or a 3 cell battery pack- example 3ea. AA batteries (total 4.5 volts). Press the test and acknowledge buttons and make sure the device works correctly. You can make a more compact version with perfboard and rearranging the modules. I mounted mine in a 3D printed clear ABS box with a red LED inside. The LED is hooked up to the same pin as the display and is visible from across the room.

Conclusion

This project reminds me to take a weekly pill before breakfast, then wait 30 minutes before eating. By pressing the acknowledge button, it starts a timer for 30 minutes, counting down to zero, turning off the display and LED, then going back to sleep for another week. The code can be modified to be set for weekly, daily, monthly, etc. alarms. You can remove the countdown code if it isn't needed.

Very interesting to see how battery powered Arduino projects can be made using an inexpensive and small microcontroller using the sleep mode, then waking up with an external interrupt from the clock module.