Introduction: From Counter to Clock With RTC DS-1302

Picture of From Counter to Clock With RTC DS-1302

This time I would like to modify from our previous counter to become a simple clock by using DS-1302 RTC chip.

DS-1302 uses 2 wire interface used by Atmel which is old version of I2C.

Since more space on the left side of the board is needed, we reassembly the component from the counter to the right. And for clarity, the 0.56" 7 segment will be used.

Step 1: Additional Component

Picture of Additional Component

- All component in counter

- Crystal 32 KHZ

- RTC DS1302 IC

- Resistors (3 X 10K for pull ups)

- 3V watch battery or 100uF capacitor with 1K pull ups

Or if you prefer you can use separate DS1302 module with battery and connect to to your breadboard.

Step 2: Place DS-1302 Chip

Picture of Place DS-1302 Chip

Since we used up all of our digital pins, and we still need 3 more pins for communicate with RTC. So we will use analog pins as GPIO. That way we can connect DS-1302 chip without extra hardware.

In image above we can also use 1 resistor from pin 4 to ground instead of pull ups. Also capacitor as substitute of watch battery (just for sake of prototyping, not to be used as production).

Step 3: Upload the Code

Picture of Upload the Code

Before upload the code, please change the set time to your current.

rtc.halt(false);

// Make a new time object to set the date and time.

// Sunday, September 22, 2013 at 01:38:50.

Time t(2013, 9, 22, 1, 38, 50, Time::kSunday);

// Set the time and date on the chip.

rtc.time(t);

After all finish then, upload program. to test.

If all ok, you can comment the "rtc.time(t)" so that it won't reset to particular time upon boot up.

Now you can show of the clock in your living room or put it in transparent box.

Cheers.

Comments

VincentT57 (author)2017-06-17

It's worth pointing out matching pin names (scheme => board labels):

CE = Reset

I/O = DAT

CLK = SCLK

About This Instructable

973views

9favorites

License:

Bio: Shares instructables for me in case I forgot and anyone interested in my work.
More by GandaU:Testing Chinese AD/DA Data Acquisition ModuleAtmel Studio with usbasp on Atmega 8 target.Firmware upgrade for USBASP clone - Fixing Error Setting USBASP ISP Clock
Add instructable to: