loading

Hello everybody,

This is my first project using ATtiny85 microcontroller and also including a Real Time Clock (RTC) working with it.

The use of ATtiny85 is a very interesting way to shrink your Arduino projects in a final tiny version.

The Tri-Mode Digital Clock (see Video) includes a version with common decimal clock and also with two versions of binary clock.

One version of binary clock is traditional where each digit of hours and minutes are converted into binary for a LED display of 7 segments.

The last one is my favorite of an unusual version of binary clock where the first digit represents the hour, the second, the minutes and the third the seconds.

An interesting additional feature is about the use of internal memory of RTC that you can save the status of the mode of clock.

This feature is less known and is not applied commonly but give you an extra bonus card for your projects.

Let's see the project!

Note: This release was updated including the Arduino UNO R3.

04.Oct.2016

Step 1: Material

You will need for this project:

  • ATtiny85 microcontroller / Arduino UNO R3 or equivalent
  • Display TM1637 (4 Digits x 7 Segments)
  • RTC module (DS1307)
  • Push button switch
  • Breadboard
  • Wires
  • Power supply (3V to 5V)

Note:

You can use AA batteries (02x or 03x), for example, or any power supply of 5 Volts at maximum.

Step 2: Schematics & Program

  • Schematics

The circuit is shown on attached schematic.

It is very simple, just follow with care the wires connection.

  • Arduino Program

The program is shown on attached files (PDF and INO versions).

  • Programming ATtiny

Many programs of Arduino can be loaded to ATtiny, but in some situations you need an specific library to work on it.

In this project I needed to update Wire the library(support of I2C communications) to TinyWireM library.

With this library you can normally use the DS1307RTC.

Step 3: ATtiny85

- Basic information about ATtiny

Basically the ATtiny has 5 pins/ports to be used as digital, analogic or PWM as shown on diagrams.

The reset Pin#1 works as Reset and it can also be used as additional port, but you need to setup it with care using specific programs to manage the internal fuses and configuration of the microcontroller.

There are a lot information about ATtiny85 available on Internet and also here on Instructables.

With these information you will learn the steps to configure the Arduino to setup the first time the ATtiny.

In this first time you will burn the fuses of ATtiny to set the clock (internal or external and also the speed) and will also load the bootloader.

Take a look on these instructions:

https://www.instructables.com/id/Arduino-Attiny-Pro...

https://www.instructables.com/id/Program-an-ATtiny-...

https://www.instructables.com/id/ATtiny-Programming...

http://highlowtech.org/?p=1695

http://highlowtech.org/?p=1706


Note: I did my own version of ATtiny programming shield for Arduino UNO as you can see in the pictures.

- Loading program into ATtiny

To load a program to ATTiny using Arduino as ISP you just need follow these steps:

1- Load the program ArduinoISP into Arduino.

2- Change the board on Arduino as ATTiny, set the processor as ATtiny85 and set the clock as 8 MHz (internal) according the first setup of microcontroller.

3- Load to Arduino the program that you want to transfer to ATtiny.

4- Compile and load the program to ATtiny

Step 4: Using and Modes of Clock

  • Using the Clock

The clock is very simple to be used.

Each time you turn on the clock or you press the push button switch, the clock mode will be moved to the next status.

  • Modes of the clock:

1- Decimal digits

This is the traditional mode showing hours and minutes with direct reading.

2- Binary Mode 1 (each digit of time is coded to binary)

In this mode you can see each decimal digit converted into its binary corresponding number as follows:

Segments x Decimal Values:

A = 0 / B = 1 / C = 2 / D = 4 / E = 8 / F = 16 / G = 32

Example:

Time 14:21 hs is:

1 = B

4 = D

2 = C

1 = B

3- Binary Mode 2 (hours, minutes and seconds coded to binary)

In this mode the calculation is similar to mode 2 but here the hour is coded to binary, also the minutes and the seconds.

Note that in this case we can save two digits to represent hour and minutes.

With this I can include the seconds in the third digit of display and keeping one digit free of usage.

Example:

Time 14:21 hs is:

14 = C + D + E

21 = B + D + F


<p>please publish the link to download hedder files also</p>
<p>hi</p><p>thanks</p><p>showing error</p><p>C:\Users\RAJEEV\Documents\Arduino\attiny85\attiny85.ino:6:63: fatal error: DS1307RTC.h: No such file or directory</p><p> #include &lt;DS1307RTC.h&gt; //DS1307RTC (Real-Time Clock Library) </p>
<p>Thanks for sharing this project, but there are points to be highlighted:</p><p>to function properly with TinyWireM standard libraries you must set the Attiny85 clock as &quot;Internal 1Mhz&quot;.</p><p>It would be better to use two pullup resistors of 4,7K on pins 5 and 7 of the ATtiny85.</p>
<p>Hello, emax2000,</p><p>Thanks for you comments!</p><p>You are right about the pullup resistors, but the RTC modules as I have applied in this project already have them in their PCB. Thus, you don't need another additional pullup resistors.</p><p>About the clock, I had setup the Attiny85 to use 8 MHz internally and I have no issues with that as you can see in the video of this Instructable.</p><p>Regards,</p><p>LAGSILVA</p>
<p>Thank for your reply LAGSILVA ,</p><p>can you attach the TinyWireM library that you used for the project? Because with my library the rtc does not respond if I do not set the clock to 1Mhz.</p><p>Bye.</p>
<p>This library is installed on my Arduino IDE:</p><p><a href="https://github.com/adafruit/TinyWireM">https://github.com/adafruit/TinyWireM</a></p>

About This Instructable

3,156views

21favorites

License:

Bio: I am a Mechanical Engineer and an enthusiastic Maker. I like to develop new ideas combining electronics and programming.
More by lagsilva:Talking Clock with Arduino Stopwatch with Lap Time Counter Tri-Mode Digital Clock with ATtiny85 / UNO R3 and RTC 
Add instructable to: