Introduction: LED Matrix Alarm Clock (with MP3 Player)
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.
Step 1: Material & Tools
- LED Matrix
- Arduino Uno
- MP3 shield DHF player Mini
- RTC module DS1307
- Any Speaker
- 3 buttons (with pullup/pulldown resistors 10k)
- 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:)
Step 2: LED Matrix
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.
Step 3: Other HW
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:)
Step 4: Mechanical Parts
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:) )
Step 5: Arduino Part
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).
Step 6: Completing Alarm
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:)
Second Prize in the