Arduino MP3 Alarm Clock





Introduction: Arduino MP3 Alarm Clock

A while ago, I stumbled over a component called DFPlayer. It's a tiny component that allows to play mp3 from an micro SD card (for less that 10€!).

Since I was sick of using my smartphone as an alarm clock just to have music to wake me, I decided to build an alarm clock with it.

Step 1: Required Components

  • 1x DFPlayer (7,80 Euro)
  • 1x Arduino UNI (20 Euro)
  • 1x LCD Display (20x4, ~10 Euro)
  • 4x 10k Resistors
  • 2x 1k Resistors
  • 1x 10k Poti
  • 1x Rotary Encoder (1,50 Euro)
  • 3x Push Buttons
  • 1x Visaton FRS 8 Speaker (10 Euro)
  • Some cables for wiring and circuit board(s)

Additionally you may want an adjusting knob for the rotary encoder, a frame for the display and a case. My father made an oak case for me which looks pretty nice.

Step 2: Arduino Setup

  • Connect the Arduino via USB to your PC.
  • Make sure that you have the Arduino IDE installed.
  • Download the .ino the attached .ino file and the additional 3x zip files
  • The Arduino IDE provides a wizard where can select the zip file to include a new library.(Sketch -> Include Libraries ...): Install all 3x libraries using this wizard

The .ino file should compile now and you can upload it to your arduino.

Step 3: Wire Components

Before soldering everything together, I recommend using a breadboard to prototype everything.

I created a fritzing image to help with that. You should check the correct wiring of the DFPlayer by using the provided link. You can find a description of the DFPlayer's pins there, but assuming the 5V+ pin is in the upper left corner, the wiring should match as shown on the picture.

Step 4: Build Everything Into the Case

The step varies depending on what case you have chosen to use. I've added some pictures here to show the steps I've done to wire everything into my oak case. I decided to build smaller circuits on smaller circuit boards to have checkpoints where I can verify that everything is still working.



    • Trash to Treasure

      Trash to Treasure
    • Paper Contest 2018

      Paper Contest 2018
    • Pocket-Sized Contest

      Pocket-Sized Contest

    We have a be nice policy.
    Please be positive and constructive.




    Thanks for a quick reply, I managed to upload your code, however I'm experiencing another problem. After wiring my lcd according to arduino, all I get on display are 2 rows of blocks (no characters) and no illumination. I checked the specification for my lcd here
    And I can tell that the backlight pins are 15 and 16, whereas pin 15 on your diagram goes to arduino and does something else I presume.
    I assume that other pins will be different too.
    I'd appreciate it if you can help me out here, otherwise I'll just give up with this project.

    This is a simple yet beautiful project. I love it! :3

    anyone can confirm this instructable works?
    building it atm, got the screen working but using some old parts...
    so would be nice if someone can confirm and i have to check parts

    had it working but started up and it was frozen in ouhr menu, now i fried my 10k pot ;-p
    waiting for parts


    Hi, Time.h attached to this tutorial is outdated. The new one can be found here:

    Hi again, Ive been trying to upload your program to my Arduino and it keeps saying

    Arduino: 1.6.8 (Windows 7), Board: "Arduino/Genuino Uno"

    C:\Users\Golomp\Desktop\mephisto_V\mephisto_V.ino:3:19: fatal error: Timer.h: No such file or directory

    #include "Timer.h"


    compilation terminated.

    exit status 1

    I installed some Time library but it hasnt resolved the issue.

    Also I see that you have included a

    #include <DFPlayer_Mini_Mp3.h> Library, where do I get it from?

    Sorry to be a pain, I'm not a programmer so I dont have a clue.


    To be honest, I can only guess since I only have some basic skills and I had to play around with rotary encoders a lot before I got a successful combination of code and hardware. My approach would be to connect the rotary encoder to the arduino and play around with the connections. Create a separate sketch for it using this logic:


    * The rotary encoder implementation


    void updateEncoder(){

    int MSB = digitalRead(encoderPin1); //MSB = most significant bit

    int LSB = digitalRead(encoderPin2); //LSB = least significant bit

    int encoded = (MSB << 1) |LSB; //converting the 2 pin value to single number

    int sum = (lastEncoded << 2) | encoded; //adding it to the previous encoded value

    //if(sum == 13 || sum == 4 || sum == 2 || sum == 11) encoderValue ++;

    if(sum == 2) encoderValue --;//skip updates

    //if(sum == 14 || sum == 7 || sum == 1 || sum == 8 ) encoderValue --;

    if(sum == 1) encoderValue ++;//skip updates


    Use the Serial.print to log the encoderValue and check if it is working as expected (I had to google this code, but can't remember where I got it).

    Hi, I'm preparing to make this mp3 player, I have almost all needed parts. I'm just wondering how to connect my encoder as it seems to have a different pinout than yours. Here is the eBay auction number
    Many thanks in advance.

    Are these momentary switch buttons or latch switch?