Introduction: $5 Arduino Clock
Create an Arduino compatible clock inexpensively. This project is fun and easy to duplicate. It can be put into the enclosure or project of choice. I used a plastic electronics parts kit box. The base parts cost $5, but it also needs micro USB power. The sketch coded for 24 hour time.
Step 1: Parts
Part List - Links to AliExpress
Step 2: Digispark Support
Digispark needs a USB driver installed. Instructions for Windows 7 - 10
Add Arduino IDE board support for Digispark
Go to the "File" menu and select "Preferences"
In the box labeled “Additional Boards Manager URLs” enter: http://digistump.com/package_digistump_index.json and click OK
Go to the “Tools” menu and then the “Board” select “Boards Manager” and then from the type drop down select “Contributed”: Select the “Digistump AVR Boards” package and click the “Install” button.
After install completes, close the “Boards Manager” window and select “Digispark (Default - 16.5mhz)” from the Tools→Boards menu.
Step 3: Program With Arduino IDE
Go to Sketch, Include Library, then Manage Libraries. Make sure the following libraries are installed: tm1637 (Grove 4-Digit Display)
Open the sketch file and set the correct time on the rtc.adjust line. The numbers are: (Year, Month, Day, Hour, Minute, Second)
These Digispark style development boards work differently than Arduino boards. You will first hit upload then plug in the board when prompted. They are programmable for a few seconds after plugged in.
Attachments
Step 4: Assemble Parts
You will need to do some light soldering to install the pin headers onto the modules.
- Put CR2032 battery in in DS3231 RTC module
- Connect jumper wire from P0 to SDA on the RTC module
- Then connect P2 to SCL on RTC module
- Connect P3 to CLK on TM1637 Display module
- Then P4 to DIO on Display module
- Connect VCC and Ground to RTC module then VCC and Ground on other side to the display module.
All done! You can power it now. You can use a micro USB AC adapter or battery pack.

Participated in the
Clocks Contest
6 Comments
Question 4 years ago
Two Queries:
1.Fritz diagram and circuit explanation for connection P0-SCL and P2-SDA does not match.Which is correct?
2.Please cross check the sketch uploaded as it is not identified by the IDE.Telling that 'Couldnt create the sketch" !
Answer 1 year ago
P0 is connected to SDA and P2 is connected to SCL.
The code compiles with all the libraries present.
Tip 4 years ago
Private message me if you need tech support on this project
4 years ago
Thanks for the reply and update.I request you to kindly upload the libraries you have used in the sketch.
4 years ago
Ok in that case what might be the reason for
"Could not create the sketch" while opeining the sketch in IDE?
This the compiling error I got.
"
File name 5clock.ino is invalid: ignored
java.io.IOException: No valid code files found
at processing.app.Sketch.listSketchFiles(Sketch.java:117)
at processing.app.Sketch.(Sketch.java:54)
at processing.app.Editor.handleOpenInternal(Editor.java:1975)
at processing.app.Editor.(Editor.java:340)
at processing.app.Base.handleOpen(Base.java:822)
at processing.app.Base.handleOpen(Base.java:808)
at processing.app.Base.handleOpen(Base.java:804)
at processing.app.Base.handleOpen(Base.java:800)
at processing.app.Base.handleOpenPrompt(Base.java:787)
at processing.app.Editor$7.actionPerformed(Editor.java:547)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) "
I got the same error in my Win7 64bit PC and laptop.
can you pls help?
4 years ago on Step 4
Can you please tell me the extracted size of your code as i am getting the same error "Could not create the sketch" when it is run in the IDE.
The 5clock.zip file size is 567bytes.
The extracted folder5clock has 562 bytes.
The 5clock.ino skecth file has 962 bytes.
Pls confirm the file sizes.