DS1302 Real Time Clock
1. DS1302 Real Time Clock
DS1302 특징:
- Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year with Leap-Year Compensation Valid Up to 2100
- Serial I/O for Minimum Pin Count
- 2.0V to 5.5V Full Operation
- Uses Less than 300nA at 2.0V
- Single-Byte or Multiple-Byte (Burst Mode) Data Transfer for Read or Write of Clock or RAM Data
- Board Size: 44mm x 24mm
Time 라이브러리를 이용한 시간 데이터 사용은 아래와 같은 하드웨어를 지원합니다.
- Time library for dates and times that can be used with and without external hardware
- DCF77
- DCF77 – DCF77 Library – Set internal clock to atomic time
- DCF77 Library description Documentation and full explanation of DCF77 library.
- Articles on DCF Hardware and DCF Signal
- A tutorial for a DCF77-based radio clock
- Tutorial Arduino DCF77 v0.2 Code
- DCF77 weather info from meteotime
- DCF77 Clock – a binary DCF77 clock with good noise tolerance.
- The Clock – a DCF77 clock with extraordinary noise tolerance.
- DS1302
- DS1306
- Use the Dallas/Maxim DS1306 Real-time Clock chip with Arduino.
- DS1307
- I2C for RTC DS1307 Real Time Clock – Interfacing with the DS1307 date/time keeping clock – Great for logging events.
- Library to control the RTC DS1307 with Arduino. Also an example is supplied and how to connect it. RTC DS1307 Library
- RealTimeClockDS1307: Yet another (more elaborate) library for working with the DS1307. Includes methods for access to the battery-backed RAM, square wave generator, correct 24h-AM/PM conversion, etc. Example sketch allows interactive control of most functions via Serial Monitor.
- Sketch to set the DS1307 of the logshield by means of NTP.
- Library for the I2C DS1307 RTC with NV-RAM support. With v1.20 you can calculate with the time and a program has been added to modify the RTC over the serial port.
- Syncing an RTC to your computers time using python Syncing RTC using python
- Comparing RTC DS1307 and PCF8563 and using DS1307 with an optimized code. I2C RTC DS1307 and Arduino
- Setting the time on your DS1307 RTC using a Windows application. Set RTC time from PC App
- Use the CMax CMMR-6P WWVB Receiver with Arduino
- Sleep and Watchdog functions for battery operated equipment Nightingale example
- Interface to IBM AT RTC bq3287 and compatable with 8bit bi-directional bus code and description
- Interface to a Maxim-IC DS3231 I2C chip
- Guide for beginners to using the DS1302 RTC in the nuelectronics.com datalogging shield. Could help other users of the DS1302 also.
- Library for the DS1340Z RTC with sample sketch to read and write time code. (Low voltage operation supported). For more information please check out the DS1340Z Inmojo Arduino Shield product page.
- PCF8563 RTC Library with examples.
- MicroCLK: A stand alone RTC controlled clock with LCD display
- DS3234
- The libary creates software interface to communicate with DS3234 RTC.
- It allows for using any pins as MOSI, MISO, CLK and SS, for communication with the DS3234, thus conflicts with SD and Ethernet libraries are no longer a problem.
- The libary is based on the example offered by Sparkfun.
- Library offers reading date and time, setting it, and also as a bonus it allows to read the temperature.
- PCF8563
- Using I2C RTC PCF8563 at I2C fast mode (400 kbit/s) with an optimized code. I2C RTC PCF8563: basic usage with Arduino
- Comparing Arduino crystal deviations. A Blinkenlight experiment that shows why Arduino without RTC is unsuitable for time keeping.
- R4571 (ETM21E-02)
- R4571 Epson Toyocom R4571 RTC Library and documentation
2. 연결 방법
얼핏 비슷해 보이지만 I2C, SPI 와는 다른 Simple 3-wire interface 를 사용합니다. 디지털 핀 3개를 사용하며 임의로 변경할 수 있습니다.
MODULE -> ARDUINO
GND -> GND
VCC -> +5V
SCK -> D4
I/O -> D3
RST(CS) -> D2
3. 소스 코드 (스케치)
/* FILE: ARD_1302_RTC_Example_Sketch_HCMODU0035 DATE: 03/09/13 VERSION: 0.1 REVISIONS: 20/09/13 Created version 0.1 This is an example of how to use the Hobby Components 1302 Real Time Clock module (HCMODU0035). This example uses the RTC library written by Henning Karlsen (http://www.henningkarlsen.com/electronics/). This example sketch demonstrates how to read and write to the RTC module. To connect the module to your Arduino please see the following pinout: PINOUT: MODULE ARDUINO GND GND VCC +5V SCK D4 I/O D3 RST(CS) D2 You may copy, alter and reuse this code in any way you like, but please leave reference to HobbyComponents.com in your comments if you redistribute this code. This software may not be used for the purpose of premoting or selling products that directly compete with Hobby Components Ltd's own range of products. THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER. */ /* Define the DIO pins used for the RTC module */ #define SCK_PIN 4 #define IO_PIN 3 #define RST_PIN 2 /* Include the DS1302 library */ #include <DS1302.h> /* Initialise the DS1302 library */ DS1302 rtc(RST_PIN, IO_PIN, SCK_PIN); void setup() { /* Clear the 1302's halt flag */ rtc.halt(false); /* And disable write protection */ rtc.writeProtect(false); /* Initialise the serial port */ Serial.begin(9600); } /* Main program */ void loop() { /* Set the time and date to 16:30 on the 3rd of September 2013 */ rtc.setDOW(MONDAY); rtc.setTime(16,30,0); rtc.setDate(3, 9, 2013); /* Read the time and date once every second */ while(1) { Serial.print("It is "); Serial.print(rtc.getDOWStr()); Serial.print(" "); Serial.print(rtc.getDateStr()); Serial.print(" "); Serial.print("and the time is: "); Serial.println(rtc.getTimeStr()); /* Wait before reading again */ delay (1000); } }
Arduino DS1302 RTC library written by Henning Karlsen (http://www.henningkarlsen.com/electronics/)