Bedside MP3 Alarm Letter Clock

by jandemunck in Circuits > Clocks

2564 Views, 37 Favorites, 0 Comments

Bedside MP3 Alarm Letter Clock

wordclock.jpg

For this project I wanted to make a convenient and fully functional bedside alarm word clock.

My personal prerequisites for a bedside alarm clock are:

  1. Readable at any light, while not blinding at night
  2. MP3 alarm tunes
  3. Attractive and small form factor
  4. Snooze function
  5. Memory function, so that time, alarm time, ringtone and volume are not lost anytime the power is cut off.
  6. Birthday function: At my birthday (and those of my family members) I want to get awakened by "happy birthday" rather than the standard ringtone

I could not find any instructable combining all of these; hence this instructable.

The clock is build around a 8X8 WS2812B Matrix. Because of the low amount of LED's, not all words can be made up of consecutive letters. Most 8x8 word clocks (like this nice one) solve this by grouping more letters over a single LED, though others have more creative solutions. I decided to go for a solution more like this one, where words are made from non-consecutive letters. This gives it some magical twist, as you do not see the words before they are lit. To increase readability, letters from the same word share the same color. It's a bit puzzling to read at first, but after a while you can read it in a blast. This is also why I call it a letter clock rather than a word clock. The clock wakes me up every morning and I'm still amazed by how the words are formed!

Supplies

Apart from the electronics, almost all components are reused or reclaimed items that I already had at home. The only tool you really need and probably do not have at hand for the clockface is a laser cutter. Luckily there are many fablabs and makerspaces that can help you with that. Thank you Makerspace De Prins!

Electronic components:

  • 8X8 WS2812B LED matrix
  • Arduino nano
  • DS3231 real time clock module
  • DFPlayer mini
  • micro SD card to put in the DFPlayer mini (smallest/cheapest you can find will do the job fine)
  • A photo diode
  • One RGB LED
  • 1000 F capacitator
  • a speaker as small as possible
  • generic wires, connectors, resistors, buttons
  • Some wood, MDF,.. for the box

Make the Box

IMG_20200415_203335.jpg
IMG_20200328_125430.jpg

For the box itself I did use some of-cuts from our wooden floor. These are nice 9mm thick oak boards. Using a miter saw I did cut 4 pieces of 10.5 x 8.6 cm (Actually I did cut some spare one to correct for mistakes to come!). Along the short edge, a 5 mm groove is made to hide the front and back panel. The long edges are cut in a 45° angle to make a nice square box. This is not a joint woodworkers get wild about, because of the small end grain glue area. But I like the look of the joint hidden in the corner and it is still plenty strong for the application. But this is just my solution with the materials I had at hand. Any box that holds the matrix will do the job fine. Before glueing the parts together we have to make and fit the electronics. So up to he next step.

The Clockface

DSC_0903.JPG
IMG_20200327_151103.jpg

No clock without a clockface. This is one of the more clever, fast and cheap ways to make the letters translucent, while blocking all other light. You only need a small piece (10 x 10 cm) of acrylic glass (AKA plexi), some spray paint and a laser cutter. I did start with a reclaimed clear acrylic glass; the thickness is unimportant, as long as it fits the recess of your box. On one side I did roughen a corner with some sandpaper and did cover it with some black spray paint. Don't worry about dripping paint and so on, as this will be the back side. The other side on the other hand, you have to keep as pristine as possible. Now you need access to a laser cutter to remove the paint and part of the acrylic glass, where the letters have to come using the SVG provided; do not forget that the letters have to be mirrored! Et voila: a cheap, fast and easy way to make a perfect looking faceplate, with virtually no light leakage! Probably you have to change the order of the letters, as these are designed for a dutch clock.

Now you have access to the laser, also cut a matrix (File attached as well) from some 6mm MDF. This goes in between the LED matrix and the face plate to diffuse the light and prevent light leakage to neighboring letters.

Soldering the Electronics

IMG_20191024_195157.jpg
IMG_20200324_195925.jpg
IMG_20200324_195940.jpg

Now it's time for the core of our clock; the electronics.

The heart of our project is the arduino nano. I did use an Atmega328P based one. This works, but during the software development I did run often into memory problems. So probably a nano every or even an ESP32 might be better suited.

Before soldering everything together it's wise to test all components and connections on a breadboard. Because of the large amount of components and necessary connections this will look messy. Then I transfer all components one by one to a perforated circuit board. Please keep the components close together as the box is relatively small and orient them in such a way that things as SD card, battery, ... are accessible by removing the back part. From the top everything looks nice and tidy, while the back is a spaghetti at its best. But by making and immediately testing all connections you can do this too! You can find some advice for this prototyping boards here.

Below you can find all connections to be made for the different components:

RTC (real time clock) DS3231: 4 pins are connected to the arduino directly

  • VCC to 5V
  • GND to GND of arduino
  • SDA to A4
  • SCL to A5

DFPlayer Mini: This one is a bit different than in most examples. To avoid I2C bus problems, I do attach it to the serial port of the arduino, rather than using a software bus. The micro SD card that goes into the DFPlayer Mini should contain 12 MP3 ringtones (named 0001.mp3, 0002.mp3,...) and a happy birthday ringtone named 0014.mp3 (13 did not want to function!?!).

  • VCC to 5V
  • GND to GND
  • RX to TX on arduino, not directly but over a 1 kohm resistor; do not connect the TX of the DFPlayer mini, we are not using the feedback from the module and it will mess up correct function of the clock!
  • spk1 & spk2 to the speaker

WS2812 led matrix:

  • Positive and negative are directly connected to the power jack
  • Din of the first LED/letter is connected to the D6 pin of the arduino, not directly but over a 330 ohm resistor

Capacitator of 1000 µF: This is to protect the LED's, probably it works fine without.

The positive leg is connected to the positive side of the LED matrix (and therefore also the DC jack); the negative leg is connected to the minus side of the LED matrix

RGB LED: The LED I use, does have built-in resistors, most of them do not, so include them if necessary.

  • The longest leg is connected to the ground
  • The other legs connect to pin D8, D9 and D10 of the arduino.

Photodiode:

  • One leg of the photodiode is connected to the 5V,
  • the other leg is connected to the A0 pin on the arduino and to the ground over a 4.7 kohm resitor

Buttons: you need 3 buttons; 1 big alarm button and 2 smaller ones for the up and down function. The buttons are connected to digital pins on the arduino. You also have to add 10kohm pull-down resistors as nicely explained in this instructable.

  • Alarm button is connected to pin D7
  • Up is connected to pin D12
  • Down buttons is connected to pin D11

Assembling the Clock

IMG_20200324_204549.jpg
IMG_20200327_151357.jpg
DSC_0897.JPG
IMG_20200328_210044.jpg
IMG_20200327_155135.jpg

Because of the limited space for all components, it's important to test fit all components. Therefore I did connect all components with connectors, to easily remove them from the main board. The alarm button I did use is too long and I did mount it in a very strange way. This because I disliked its red plastic. Now its positioned much deeper in the clock, to make room for a small wooden disc that acts as button now and fits better the look of the clock. The disk is actually cut from the handle of an old paint brush; you see I like reusing old stuff! The backplate is also a reused item: some cut-of from a gold dibond plate, that serves as backsplash in our kitchen. Just cut the backplate to size with your miter saw and drill a hole for the DC jack. It is mounted with screws to provide access to the internals later on. When all seems to fit and function it's time to glue the box. Glueing is easy, just tape all 4 sides together with masking tape, apply the glue and wrap together. The LED matrix is taped to the LED cover matrix and this friction fits into position. The faceplate is mounted on top with double sided tape. The first nights I did some "test nights" when everything was held together by rubber bands, And I felt that even at the lowest setting the LED's are too bright! This was solved by adding 2 layers of paper between the LED cover matrix and faceplate.

The Software

The software is were this clock differs from most others. As I intend to use it as my main alarm clock, I need many functions, to be controlled by only 3 buttons! I also prefer a standalone device, rather than to have to connect to it by wifi, bluetooth, ... for simple things as changing the ring tone, time,... and so on.

Here an overview of all functions I included.

  • Short pressing the alarm button activates / deactivates the alarm function. When the alarm is active the LED is red.
  • Upon activation of the alarm, the alarm time is shown and one can change the alarm time with the up and down buttons (hours when the red LED blinks, then minutes when the blue LED blinks)
  • To change the ring tone and volume; you have to activate the settings menu by simultaneously pressing the up and down button during the setting of the alarm time.
  • When the alarm is going, short pressing the alarm button will give you 5 minutes snooze time. To really switch off: press again, or long press until the alarm led switches off.
  • To change the time, you have to activate the settings menu by simultaneously pressing the up and down button during normal operation.
  • To change the date (used for the birthday function), you have to activate the settings menu by simultaneously pressing the up and down button during time setting.

  • And last some easter egg: long pressing the alarm button activates the rainbow mode. This looks not only cool, but can even serve as a night light!

The necessary arduino sketch is attached. But could benefit from a rewrite from scratch as it shows too much its organic growth and therefore lacks a little in logic. But as everything works I don't want to spend more time on it than I already did.

The most important function, that sets this clock apart is this one:

String TextToLED(String InputText, int animation, int StartLed)

It contains an algorithm that will lookup the necessary letters to lit up for you and alternates the colors at any space in the InputText. In most other clock all words are hard coded, meaning that when you change the clockface, you have to recode everything. Here it is just a matter of putting the correct letter order in the string

ClockFace = String("HETMISDTKWARVIENTBIJFGNAVOORHALFDNTWZEVRPHIAGERNALJFCHTSDUURAPMY"). And it is particulary convenient when changing the names for the birthday function.

Future Improvements

Even after several months of use, I'm still very happy with the build. For most of my projects I think:" This should be improved, or this would have been better,..." But this one, no; it feels and functions as I wanted it to do. One issue may be power consumption. This may be higher than the average alarm clock you buy. But it depends a lot on the amount of light during the day, as the LDR does its job very well. When it is completely dark ,my clock goes to night-mode; this means red and green letters at the dimmest setting. In this mode the clock takes 0.08 amp and so consumes about 0.4 Watt. In full day light this increases to 0.3 amp or about 1.5 Watt, while the rainbow mode even consumes 5 watt.

Anyway looking at the end result, I'm convinced it is worth all energy I did put into!

Don't forget to vote for me in the clocks contest! Thank you for reading until the end.