Build it step by step
0 of 8 donePrepare the sound files
Record clips and name them 0001.mp3, 0002.mp3 on the card.
Wire the player
Connect the speaker and the serial lines with the resistor.
Test one track
Play track 1 from a simple sketch.
Set the RTC
Use a library example once.
Set the dose times
Edit the DOSES list.
Upload
At the dose time the clip plays.
Confirm
Press the button to stop the repeats.
Check a missed dose
Leave it and see it repeat every five minutes.
How do you build a talking pill reminder?
A reminder speaks the name of the pill at dose time for people with low vision. You need Arduino Nano, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, SanDisk microSD card 32 GB (A1, Class 10), DS3231 RTC module, Tactile push button 6 mm and Resistor 1 kΩ. It takes 8 steps and about 120 minutes.
- Level
- Beginner
- Time
- About 120 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- InterfacesBuy
- Motors & ActuatorsBuy
- SBC AccessoriesBuy
- SensorsBuy
- SwitchesBuy
- PassivesBuyResistor 1 kΩ × 1
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| DFPlayer VCC | Nano 5V | Power |
| DFPlayer GND | Nano GND | Ground |
| DFPlayer RX | 1 kΩ resistor then Nano D11 | Commands to the player |
| DFPlayer TX | Nano D10 | Status from the player |
| DFPlayer SPK1 and SPK2 | Speaker | Audio output |
| DS3231 VCC and GND | Nano 5V and GND | Power |
| DS3231 SDA and SCL | Nano A4 and A5 | I2C |
| Button | Nano D2 and GND | Confirm the dose |
Code
This is a reminder aid and not a medical device. It does not know whether a pill was taken and it must not replace advice from a doctor or a pharmacist, so check with a caregiver for important medicines. Record short voice clips (for example "Morning tablet, one white tablet") with a phone, save them as 0001.mp3, 0002.mp3 and so on on a FAT32 card, and set the times in the DOSES list; set the RTC once using a library example. The 1 kΩ resistor on the DFPlayer RX line cuts the noise from the 5 V serial signal. If the volume is too low, raise player.volume up to 30. Keep the pill box and the speaker where the person can find them by touch. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Libraries: DFRobotDFPlayerMini, RTClib (Adafruit). SD card files: 0001.mp3, 0002.mp3 ...
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
#include <Wire.h>
#include <RTClib.h>
SoftwareSerial pSerial(10, 11); // RX, TX
DFRobotDFPlayerMini player;
RTC_DS3231 rtc;
struct Dose { byte hour; byte minute; byte track; };
const Dose DOSES[] = { {8, 0, 1}, {14, 0, 2}, {21, 0, 3} }; // track 1 = "Morning tablet", and so on
const byte N = sizeof(DOSES) / sizeof(DOSES[0]);
const byte BTN = 2;
bool pending[N];
byte lastDay = 255;
unsigned long lastPlay[N];
byte repeats[N];
void setup() {
Serial.begin(9600);
pSerial.begin(9600);
pinMode(BTN, INPUT_PULLUP);
rtc.begin();
if (!player.begin(pSerial)) { Serial.println("DFPlayer not found, check the card and wiring"); while (1) {} }
player.volume(20);
}
void loop() {
DateTime now = rtc.now();
if (now.day() != lastDay) { lastDay = now.day(); for (byte i = 0; i < N; i++) { pending[i] = false; repeats[i] = 0; } }
for (byte i = 0; i < N; i++) {
if (now.hour() == DOSES[i].hour && now.minute() == DOSES[i].minute && !pending[i] && repeats[i] == 0) {
pending[i] = true; repeats[i] = 1; lastPlay[i] = millis();
player.play(DOSES[i].track);
}
if (pending[i] && repeats[i] < 4 && millis() - lastPlay[i] > 5UL * 60000UL) { // repeat every 5 minutes, up to 3 more times
repeats[i]++; lastPlay[i] = millis(); player.play(DOSES[i].track);
}
}
if (digitalRead(BTN) == LOW) { // pressing the button confirms every pending dose
for (byte i = 0; i < N; i++) pending[i] = false;
player.stop();
delay(300);
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
DFPlayer not found, check the card and wiring
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| At a dose time | The clip plays |
| Button pressed | Clip stops and no repeats |
| Ignored | Repeats every five minutes up to three more times |
| Next day | Doses are reset |
If it does not work
DFPlayer not found
Check the card format, files and the TX and RX wiring.
No sound
Check the speaker wiring and the volume.
Clicks and noise
Add the 1 kΩ resistor and keep the speaker wires away from the signal.
Wrong time
Set the RTC again.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the talking pill reminder?
Arduino Nano, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, SanDisk microSD card 32 GB (A1, Class 10), DS3231 RTC module, Tactile push button 6 mm and Resistor 1 kΩ.
How long does the talking pill reminder take to build?
About 120 minutes for a beginner maker, in 8 steps.
How do I know the talking pill reminder works?
At a dose time: The clip plays. Button pressed: Clip stops and no repeats. Ignored: Repeats every five minutes up to three more times.
DFPlayer not found: what should I check?
Check the card format, files and the TX and RX wiring.
No sound: what should I check?
Check the speaker wiring and the volume.
Clicks and noise: what should I check?
Add the 1 kΩ resistor and keep the speaker wires away from the signal.
Wrong time: what should I check?
Set the RTC again.
