Introduction: Arduino Small Tabletop Clock With Dot-matrix Display (easy Project)
My wife was looking for a small, basic clock for our bedroom, which had the following:
Large digits (about 1 inch tall)
No buttons or gizmos
After a quick search on the internet, I realized that I could build her a clock with those simple specifications in an evening, from scratch, using parts from my electronic stock. This is a simple project with very few components, and with the attached files, you should be able to do it too, in less time.
The clock uses a matrix display, an an Arduino. There are no bells and whistles, not even a battery backup or an alarm. That being said, using the Parola library, you could really go wild with special effects (fade, scroll, random, swipe....), but I wanted to keep it simple because all these effects can be disturbing while sleeping. However, you can upgrade the software to add those fancy effects, with only a few lines of code. And there are plenty of I/Os left on the Arduino to add a real time clock, battery, buzzer, GPS..... and turn the clock into whatever rocks your boat.
Step 1: Parts List
Parola compatible MAX7219 tile display, see e-bay link below
Arduino nano, see e-bay link below
3 x M3 6mm screws
5V power supply, with mini USB plug,
Access to a 3D printer (to print the case)
Step 2: The Hardware
If you want to use the components in the parts list, you can start by printing the case. It should take about 1:45 hours to print, plenty of time for you to build the hardware and program the Arduino, and have time left to spare.
The brain of the clock is an Arduino nano, which is cheap and has a small footprint. Originally, I was going to use a Trinket or ATtiny, but the software library to drive the dot-matrix display requires SPI, so those two options do not work. You can replace the nano with an a-Star, Teensy, Micro, Uno, but you will then have to make your own enclosure (mine is designed for the nano).
The dot-matrix display chosen has a 5 pin cable to connect the following signals to the Arduino:
Clock -> green wire -> D13
CS -> yellow wire -> D10
Din -> orange wire -> D11
GND -> red wire -> GND
VCC -> brown wire -> +5V
You can solder the wires directly to the pads on the Arduino and the display, or use connectors. I personally chose to solder wires to the SPI port of the Arduino (which has the +5V, GND, D13 and D11 signals) and extend a wire to D10, and use a connector to the display. I removed the right angle connector on the display and installed it instead on the back side of the PCB, facing inwards.
I have mounted the nano at the bottom of the case, using double sided tape. Then, carefully remove the leftmost and rightmost 8x8 displays, and install the dot-matrix PCB, using M3 screws. A bit of tape on top of the USB mini connector will prevent it from shorting the pins on the display. Then, put back the 8x8 displays, being careful not to bend pins and choosing the right orientation.
Step 3: The Software
The clock uses a couple of well documented libraries, the Parola by MajicDesigns
and the Time library by Michael Margolis
If you never used Arduino, you will want to install the IDE software here:
and configure it to program a nano (some additional drivers may be required, if you use the chinese copies with the CH340 chip). Please refer to this instructable:
The code is quite straightforward, with very little bells and whistles. The semi-colon is redefined, to be a bit bigger and the same width as a space, and used as a flashing seconds marker. The clock is set using the setTime method, setTime(hours, minutes, seconds, days, months, years);, so you have to program the starting time in the clock, and reprogram it inside the Arduino if there is a power failure. This may seems an inconvenient, but it saves on pushbuttons, design time, and prevent an accidental reset of the clock.
The format of the time is 12:00, I did not even bother to make an AM/PM indicator, which would be easily added. using the String library and adding an "a" or a "p". If you want to add special effects, read the Parola documentation.
Step 4: Conclusion
There you are, a quick project you can build in a couple of hours.
The case .stl file and Arduino code are included here: