-
First we use the Arduino IDE and the "setRTCTime-FirstTime.ino" to set the Time on the RTC module.
-
Adjust line 31 to the correct time and date and include this line for the first upload.
-
You can check your settings in the serial monitor.
-
Than you have to upload this sketch again but with the line 31 only as comment!! That's important so that the time and date wouldn't be reseted every time you switch on the Clock.
-
Now its time to programm the ATtiny with PlatformIO
-
Set the pins for the hour LEDs and the shift register for the minute LEDs
-
The data we receive from the RTC module is in binary coded decimal (=half byte). So the easiest way to use it is to convert it into decimal numbers.
-
Later on we convert the decimal into binary code and store it in arrays
-
For the hours we turn the LEDs on and of directly with digitalWrite and pinNumber (array).
-
For the minutes we use the shift register.
-
The last function resets the shift register so that no old values are displayed when you switch on the clock.
- This DIY binary clock runns on an ATtiny44 combined with a 74HC595N shift register and a RTC Module DS1307.
- We added 100 Ω resistors for the LEDs and a 4,7k Ω for the SDA pin of the ATtiny which is connected to the RTC Module (I2C protocol).
- The case is small enough to fit in a pocket but at the same time large enough for all the components you need. It is equipped with a M3 threaded insert for 3D printing, so you can open and close the lid as often as you like.
Get the Case: thingiverser
You like it? Then I would be very happy if you treat me to a coffee on ko-fi.com/pixeledi