Loading...
Showing posts with label DS1307. Show all posts
Showing posts with label DS1307. Show all posts

Saturday, January 17, 2015

8x32 LED Matrix Real Time Clock Circuit with Alarm - 18F2550

Most of electronic enthusiasts are very much interest about the LED matrix displays. So if you are one of them this is for you. If you are not familiar with LED matrices at all, please read these two experimental tutorials Basics of LED matrix display and scrolling text message on an LED matrix .

8x32 LED Matrix Clock
LED Matrix Clock

LED matrix displays are very popular in these days and most of people are love it but wonder how it can construct. So that I decide to provide this post for you. This project is about constructing a mono-color LED matrix display based real time clock. It can display time, date, and room temperature alarm with chime function. You can control this clock using four switches (Mode, Enter, Up, Down) and can changed the speed of scrolling by RV2.

8x32 LED Matrix Clock circuit
Matrix Clock

The main IC of this project is PIC16F2550 micro controller which controls all the sections, and display the LED matrix with the help of 74HC595 shift registers and DS1307 RTC IC. As amplifier I chose TDA7052 because of low cost and almost no component. But you can choose any amplifier for it. To react function keys you need to press and hold keys and remember to put 100-330 resistors between shift registers and displays if those are too bright.

This built in some events and according to it clock change its welcome massage and alarm tone.

The events are;
  • New Year – Jan 1  
  • Vesak  - May 
  • Christmas - Dec 25
  • Valentine – Feb 14 and
  • Birthday - User Define

You can add custom date for birthday by changing the values of Eeprom (1) for day and Eeprom (2) for month. Also used hex value for this.
Ex: for Jun 25 -> Eeprom (1) = 19 and Eeprom (2) = 06

LED Matrix Clock Preview

Tested and Working!

Saturday, November 8, 2014

DS1307 Real Time Seven Segment Alarm Clock Circuit - 16F88

Updates
  • 31/01/2016 - Added: Hourly chime restriction function
  • 27/10/2019 - Fixed: Hourly chime delay error (v3)
  • 27/10/2019 - Fixed: Auto mode data showing time increased (v3)

DS1307 Alarm Clock
Alarm Clock

This is the newest clock I made using DS1307 real time clock IC. Not like other clock circuits I posted, this clock circuit built in all necessary function such as hourly chime, alarm, time drift correction, etc. In addition, it also include temperature sensor as optional function.

This clock has eight display modes (including standby mode).
  • Mode 1 – Display Seconds
  • Mode 2 – Display Time
  • Mode 3 – Display Date
  • Mode 4 – Display Year
  • Mode 5 – Display Alarm
  • Mode 6 – Display Temperature
  • Mode 7 – Show Time, Date and Temperature continuously
  • Mode 8 – Stand By Mode

DS1307 Alarm Clock
DS1307 Alarm Clock

This PIC project uses PIC16F88 micro-controller, DS1307 Real Time Clock, LM35 temperature sensor, and SSD-5461AG common cathode seven segment display. (If you cannot find that display then use four common cathode seven segment displays).

The PIC16F88 used its internal oscillator and it runs at 8MHz. We can reduce cost and complexity of circuit and can save micro-controller’s pin by using internal oscillator.RA0 and RA1 configured as digital and analogue alternatively to drive seven segment and read voltage of LM35.

The DS1307 (RTC) Real Time Clock is an 8-pin device using an I2C interface. It has eight read/write registers that store the information. This IC will do the timekeeping and it not only keeps track of time but also the date and the day of the week. DS1307 RTC is fully Binary Coded Decimal (BCD) clock/calendar. Therefore, the data read from DS1307 should be converted to BCD format. The most important is the Clock Halt Bit (CH), which is, bit 7 of address 0. This is the register that controls 'seconds' and the CH bit has to be preserved otherwise the chip stops the clock. Writing zero to this bit resets the CH bit so that the clock runs. So when the first usage we must set ‘seconds’. Otherwise clock fail to run.

DS1307 Alarm Clock circuit
Alarm Clock's Internal

Time Setting

Using MODE button you can change the display mode and the current status will save to Eeprom.
SET button can be used for edit the time, date, alarm etc. When you pressed the SET button, clock entered to the Edit mode and two displays will turn off. You can be able to edit values on other display by pressing UP and DOWN buttons. To edit turn off displays value pressed SET button again. Press the SET button again to return clock to normal mode. If the clock is in normal mode UP button also can used to change the time format (12hr or 24hr) and DOWN button can used to turn on or off alarm.

When time changed to 12hr mode LED will indicate the AM/PM status. Alarm on will indicated by the decimal point of last seven segment display. If you wish, you can also connect separate LED for it.

Error correction

Surprisingly making an accurate 32kHz oscillator is a difficult. This is because low speed oscillator drivers are designed for low power operation. That means high impedance and therefore low current, which makes the driver extremely sensitive to noise (or any nearby signals, which can capacitive couple to the crystal wire). Because that when using DS1307 we cannot get accurate time. Therefore, I added simple error correction mechanism for this clock

First, set the clock to current time (time of computer or internet) and keep it run up-to 24 hours.
After 24 hours, check the time of clock with time of computer. If time is drift, check how many seconds are drifted..?  (Use clock mode 1 to view seconds)

E.g. 1:  PC time:  16:30:00 Clock time:  16:30:05
+5 seconds drifted. So we have to reduce time.

I used Eeprom (2) to store this values and default value is 30 (0x1E).  See the Eeprom figure.
Now simply overwrite it with 25 (0x19). You must use hex values for it.

E.g. 2:  PC time:  16:30:00 Clock time:  16:29:58
-2 seconds drifted. So we have to increase time.
Overwrite Eeprom (2) value with 32 (0x20).

Hourly Chime Restriction

You can able to stop hourly chime function for specific time period using this setting. Device Eeprom address 6 and 7 use for this. default values are 0x00 and 0x18 (0 and 24)

Eeprom(6) ≤ Chime Restriction < Eeprom(7)

Eg: Stop Chime from 21.00 to 6.00
Eeprom(6) = 0x06 and Eeprom(7) = 0x15
6 ≤ Chime Restriction < 21

Eeprom of 16F88
Eeprom of 16F88

Sunday, March 3, 2013

DS1307 Real Time Seven Segment Clock Circuit - 16F88

DS1307 IC
DS1307 is a low power serial real time clock with full binary coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM (Non Volatile Static Random Access Memory). Data and Address are transferred serially through a bidirectional I2C bus.

The RTC provides year, month, date, hour, minute and second information. The end date of months is automatically adjusted for months fewer than 31 days including leap year compensation up to year 2100. It can operate either in 24-hour format or 12-hour format with AM/PM indicator.

DS1307 comes with built-in power sensing circuit which senses power failures and automatically switches to back up supply. We can provide a 3V CMOS Battery for that. The DS1307 RTC uses an external 32.768 kHz Crystal Oscillator and it does not requires any external resistors or capacitors to operate.

DS1307 Block Diagram
DS1307 Block Diagram

In this project, I used ds1307 as real time clock ic and PIC16f88 as micro-controller. To save micro-controller pins there are four input keys which are all connected to a single analogue input pin. This pin also drives one of the seven segment display LEDs so it has to be switched between input (to read the analogue voltage) and output (to drive the led). Each key pulls the analogue input to a different voltage level which you can easily read using the ADC (RA0).

DS1307 Real Time Clock circuit
Circuit Diagram

Set Time

Mode : Pressing mode button cycles the display showing 3 different data.

Mode 1 : Time only
Mode 2 : Seconds only
Mode 3 : Stand-by


Set : To change the value, set button must be pressed.

Set 1 :  Edit mode, show Minute
Set 2 :  Edit mode, show Hour
Set 3 :  Return to clock mode


Up and Down : After Pressing set button, you can change the values indicated on clock by using this buttons.

UP :  Values ++
In clock mode it will also change the 12/24Hr format.

Down :  Values --
In clock mode it will do nothing.

Clock Accuracy:

The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External circuit noise coupled into the oscillator circuit may result in the clock running fast.

To ensure the crystal oscillates correctly you must ensure that;
  • Crystal uses 12.7pf load capacitance (correct crystal type).
  • The crystal is close to the IC.
  • The tracks are short.
  • The chip supply has lots of decoupling (capacitors from +5V to GND). e.g. A 100n and a 10n
  • There are no signal tracks near to the crystal.
  • For a PCB: It has a guard ring and a ground plane and away from digital signals.

DS1307 Datasheet
PIC16F88 Datasheet

PIC16F88 pin
Pin Connection


I Used mikroC for compile this project.
Also you can get PCF8583 version from here.

 

on line

Labels

Recent comment

Visitors

Free counters!
Copyright © 2012 - Scorpionz™.,All rights reserved | Powered by Blogger