Projects / Custom tune doorbell

Custom tune doorbell

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANODFPLAY

    Wire the DFPlayer

    TX to D10, RX to D11 through 1 kΩ, speaker on its SPK pins.

  2. NANODFPLAYSANDIS

    Load the songs

    FAT32 card with files 0001.mp3, 0002.mp3 and so on.

  3. NANODS323120:22

    Add the clock

    RTC on A4 and A5. The first upload sets the time, so upload just after compiling.

  4. NANO

    Add the button

    Doorbell push button between D2 and ground, on long wires to the front door.

  5. NANO

    Upload and test

    Press the button and a random track plays.

  6. NANODS323111:25

    Check quiet hours

    Temporarily set the RTC or the quiet times to test the lower volume.

  7. NANOUSB

    Fit it

    Put it in a box by the door and power it from a USB adapter.

In short

How do you build a custom tune doorbell?

Press the doorbell and a DFPlayer plays a random song from a microSD card, with quiet hours at night. You need Arduino Nano, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, Tactile push button 6 mm, DS3231 RTC module, SanDisk microSD card 32 GB (A1, Class 10), Resistor 1 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and 5 V 2 A USB adapter. It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
10

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
DFPlayer VCC and GNDNano 5V and GNDSupply
DFPlayer TXNano D10Data to the Nano
DFPlayer RXNano D11 through 1 kΩData from the Nano
DFPlayer SPK_1 and SPK_2SpeakerSound
RTC SDA and SCLNano A4 and A5Clock
Doorbell buttonNano D2 and GNDPress to ring
Power5 V USB adapterRuns from a wall socket through the adapter only

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "DFRobotDFPlayerMini" and "RTClib". Use songs you own or have the right to use, saved as 0001.mp3 and up on a FAT32 microSD card. The button is a low-voltage push button wired to the Nano and the whole circuit runs from a USB adapter, so there is no mains wiring.

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).

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
#include <Wire.h>
#include <RTClib.h>

SoftwareSerial ss(10, 11);
DFRobotDFPlayerMini dfp;
RTC_DS3231 rtc;
const byte BTN = 2;
const byte TRACKS = 8;                               // number of files on the card, 0001.mp3 up
unsigned long lockUntil = 0;

void setup() {
  pinMode(BTN, INPUT_PULLUP);
  ss.begin(9600);
  dfp.begin(ss);
  rtc.begin();
  if (rtc.lostPower()) rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  randomSeed(analogRead(A0));
}

void loop() {
  if (digitalRead(BTN) == LOW && millis() > lockUntil) {
    int h = rtc.now().hour();
    bool quiet = (h >= 21 || h < 6);                 // quiet hours from 9 pm to 6 am
    dfp.volume(quiet ? 8 : 24);
    dfp.play(random(1, TRACKS + 1));
    lockUntil = millis() + 5000;                     // ignore presses for 5 seconds
  }
  delay(20);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Press the buttonA random track plays
Press again within 5 sIgnored
During the dayLoud volume
After 9 pmQuiet volume

If it does not work

No sound

SD card not FAT32 or the files are not named as 0001.mp3.

Hiss or crackle

Use a good 5 V supply and keep the speaker leads short.

Wrong volume at night

RTC time is wrong. Reset it.

Always plays the same track

randomSeed uses an unconnected pin, which is fine. Check TRACKS matches the files.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the custom tune doorbell?

Arduino Nano, DFPlayer Mini MP3 module, Speaker 8 Ω 0.5 W, Tactile push button 6 mm, DS3231 RTC module, SanDisk microSD card 32 GB (A1, Class 10), Resistor 1 kΩ, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and 5 V 2 A USB adapter.

How long does the custom tune doorbell take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the custom tune doorbell works?

Press the button: A random track plays. Press again within 5 s: Ignored. During the day: Loud volume.

No sound: what should I check?

SD card not FAT32 or the files are not named as 0001.mp3.

Hiss or crackle: what should I check?

Use a good 5 V supply and keep the speaker leads short.

Wrong volume at night: what should I check?

RTC time is wrong. Reset it.

Always plays the same track: what should I check?

randomSeed uses an unconnected pin, which is fine. Check TRACKS matches the files.