Due to my natural laziness it took a lot of time to find a good case for LED-matrix based clock, but recently I got an old “Elektronika 6.15M” clock (Fig. 1). The LED-matrix and all other stuff would fit perfectly into its nice wooden case.
New clock is going to have fantastic functionality in our time: it won’t connect to Internet, show weather and so on… It will display Time only. Hours and minutes. Nothing more.
DIGISPARK ATTINY85 board becomes a brain of this project (Fig. 2). All six pins are used. The main problem here may be the thing when the board comes from a factory with P5 connected to RESET of ATTINY85, which does not allow utilising this pin as usual GPIO-pin. Fortunately, this can be fixed by adjusting fuses of ATTINY85: http://thetoivonen.blogspot.com/2015/12/fixing-pin-p5-or-6-on-digispark-clones.html
Also the project incorporates RTC DS3231 module (Fig. 3) with battery holder to keep the IC going when there is no external power source. It works using I2C protocol.
And the clock’s “face” – 32x8 LED module with MAX7219 drivers (Fig. 4).
The circuit is shown in Fig. 5.
To compile the code of the project be sure to have libraries DS3231 and LedControl installed (Fig. 6). They can be found in Library Manager within ARDUINO IDE.
The project itself incorporates the main program (clock), files with definition and implementation of “button” class and a file with representation of digits in form of arrays (symbols, Fig. 7).
To debug the code I used ARDUINO Uno board because unlike DIGISPARK ATTINY85 board you don't have to reconnect it each time you need to flash it. Notice, that the code below is ready for ATTINY85.
It is recommended to flash the ATTINY85 before connecting it to other modules.
Some photos of the final assembly in Elektronika’s case:
To set the time:
1) long press the button to enter hour setting mode;
2) adjust hours pressing the button normally (each press increments hours by 1);
3) long press the button to enter minute setting mode;
4) adjust minutes pressing the button normally (each press increments minutes by 1);
5) long press the button to get back into normal mode.
The clock at night:
Comments