LED Matrix Alarm Clock (with MP3 Player)

by cermakmara in Circuits > Clocks

10400 Views, 98 Favorites, 0 Comments

LED Matrix Alarm Clock (with MP3 Player)

IMG_5999.jpeg
IMG_5987.jpeg

This Arduino based alarm clock has everything you would expect from your alarm - possibility to wake you with every song you like, snooze button and its easy to control through three buttons. There are three main blocks - LED matrix, RTC module and MP3 shield with speaker.

Material & Tools

  • LED Matrix
  • Arduino Uno
  • MP3 shield DHF player Mini
  • RTC module DS1307
  • Any Speaker
  • 3 buttons (with pullup/pulldown resistors 10k)
  • Wires
  • Plexi (or any material from which you want your box)
  • 3D printer (for printing matrix boxes)
  • DC power supply connector
  • USB B female connector.

I believe that you can modify this material list based on your possibilities (definitely you can use different MP3 Shields, different RTC modules and everything should work just fine:)

LED Matrix

IMG_5978.jpeg
IMG_5979.jpeg
IMG_4818.jpeg

As an inspiration, I used this instructables to build LED matrix, I only decided not to use prototyping board and design my own PCB. You can find my project in circuit maker here. You can also use schematics and if you want to send gerber data (rather then generate it from circuit maker project by our own) let me know I will provide it to you:). Some few tips - firstly I used very cheap LED but after I solder all diodes and run the arduino code, turned out the variance of LED diode color was not acceptable so I needed to order different ones and do another LED matrix. I will explain the working principle in Part arduino. Anyway, to find out if you did good job and display is working, just replace the constants in DisplayChar function in main arduino loop ( e.g. instead of DisplayChar(1, letA); use DisplayChar(0, 9); which will write number 9 starting from 1st column), you dont need to comment anything else.

Other HW

DFPlayer_Mini_SKU_DFR0299-DFRobot - Mozilla Firefox 2020-04-19 19.48.06.png
I2C DS1307 AT24C32 Real Time Clock Module with Battery - Mozilla Firefox 2020-04-19 19.47.30.png
IMG_5983.jpeg

The other HW components to build alarm clock are: RTC module, MP3 shield, Buttons and arduino UNO.

For RTC module I used module DS1307 and library MD_DS1307.h its quite simple everything works smoothly, but I would recommend probably use more precise RTC module like 3231 or other - if I let it without power for about few days it started to loose some seconds.

MP3 shield DHF player Mini - This MP3 shield is really easy, you can upload some mp3 to SD card, connect any speaker you find and then it can be operated in two ways either through serial communication, or by I/O pins. To be honest from some reason I wasn´t successful in serial communication (it didnt work together with SPI and I2C communication used for other componets) but I was kind a OK just to use IO pins (I used ADKEY1 connected to arduino Digital output as a trigger to play song and than pin USB+ to stop the music).

As you can see on picture, I used three simple buttons on prototyping board connected to Digital Inputs of arduino with pull down 10kOhm resistors.

The wiring for arduino can be clearly seen in Arduino code:)

Mechanical Parts

IMG_5941.jpeg
IMG_5937.jpeg
IMG_5065.jpeg
IMG_5723.jpeg

To create view of nice regular display, you need to use some grid to define the exact shape for each LED. I used simple 3D printed grid which works just fine - It is made from two parts, left and right, you can find the STL data in attachment.

The box is milled on CNC machine from milk plexi. It is totally up to you from which material you make in, only one recommendation, if you will use the similar material as I did, put some semipermeable layer to part which is directly on LEDs to prevent LEDs being visible as a point source of light. You can see that in side wall there is a space for DC power supply connector and USB to upload better ideas of code:) I used standard glue for plastics to glue plexi parts together. In attachment there are STL files for all parts (Thanks my friend Peshi for designing this super cool box:) )

Arduino Part

LED_Matrix_Clock_v03 _ Arduino 1.8.5 2020-04-19 20.48.29.png

In part related to arduino I would just like to briefly describe the main loop algorithm and then few words to controlling the Shift registers through SPI and Alarm setup.

In the main loop you just basically check whether some button is pressed, check whether the RTC send you newly updated values of minutes and whether its time to play some pink floyd song:) and if not, you just periodically turn on and off LEDs with set numbers.

Controlling the LED matrix - For better understanding it is good to follow instructables for LED matrix I mentioned at beginning, but just briefly - it is important to understand that to show numbers or letters in this Matrix, you need to periodically choose which LED from set row will need to be turned on, and then turn the all LEDs from row for some time. In the next step you will turn off this row and prepare second row and this again and again. What this mean? - dont use any delays! - otherwise it wont show you numbers but just blinks:)

I use quite different and I would say easier way to control shift registers (thanks to my friend Krystof who wrote this smooth function). So first step (preparing the data for shift register is happening in function DisplayChar, where you just find the wanted symbol from array of constant and prepare data for registers. And when the function UpdateDisplay is called the data are shifted to outputs (for more info see screen from arduino IDE)

Alarm Setup. There are three buttons, left, middle, and right. When you doublepress right and middle, you will enter the alarm menu. In Alarm menu there are following functions available - left button (Set alarm for hours) middle button (Set alarm for minutes) Right button long press ( confirming alarm), long press of middle and right button (erasing existing alarm).

When the alarm is set (you can recognize this by the fact the alarm turn on mark LED in bottom right) and Clock will start to play your favourite morning song:) there are following functions avaliable - left button (Snooze for another 5minutes), middle button (cancel alarm).

Completing Alarm

LED Matrix Alarm Clock
IMG_5982.jpeg
IMG_5998.jpeg

At the end, I just glue everything inside together:) and close the glue the back part of alarm. In the attached video, you can see the control mechanism of this alarm. Just note to the video, in the video it looks like its blinking, its caused by the principle of turning on and off LEDs and camera caption frame rate - in reality your eyes see this as turned on without blinking:)

For future I would like to try different material - ideally some black:) and to add some more functions, like showing the date, maybe temperature etc:)

Hope you will enjoy building your own alarm clock, and looking forward for your ideas:)