RTC DS1302

[ [ images & links ] ]

Gambar 1. [sumber]

Sebelumnya, kutipan informasi dari dua RTC telah pernah diungkap di situs ini. Pertama DS1307, dan yang kedua adalah DS3231. Di halaman ini akan saya kutip keterangan mengenai RTC DS1302, yang bersama dua RTC terdahulu saya beli di situs online lokal.

 

The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator.

Interfacing the DS1302 with a microprocessor is simplified by using synchronous serial communication. Only three wires are required to communicate with the clock/RAM: CE, I/O (data line), and SCLK (serial clock). Data can be transferred to and from the clock/RAM 1 byte at a time or in a burst of up to 31 bytes. The DS1302 is designed to operate on very low power and retain data and clock information on less than 1µW.

The DS1302 is the successor to the DS1202. In addition to the basic timekeeping functions of the DS1202, the DS1302 has the additional features of dual power pins for primary and backup power supplies, programmable trickle charger for VCC1, and seven additional bytes of scratchpad memory.

~maximintegrated.com

 

Gambar 2. domoticx.com/arduino-rtc-tijdklok-ds1302/

Pustaka yang diperlukan untuk mengeksekusi kode bisa diakses di link ini.

Berdasarkan pengalaman saya menguji coba sistem ini dan pengalaman cukup banyak orang lain yang saya pantau di berbagai halaman di Internet, tampaknya sistem RTC DS1302 yang banyak beredar memiliki permasalahan dalam hal operasi. Banyak pengguna yang melaporkan kesalahan pembacaan jika mempergunakan IC ini. Ada beberapa kemungkinan, termasuk kemungkinan IC yang banyak diperjual-belikan yang memang memiliki grade yang lebih rendah.

Secara praktis, sampai ditemukan solusi yang baik untuk IC ini (versi yang banyak dijual), akan lebih baik mempergunakan RTC DS1307 atau DS3231.

RTC DS3231

[ [ images, codes & links ] ]

Keterangan mengenai RTC (Real-Time Clock) sudah pernah disampaikan melalui kutipan di post terdahulu. Di halaman itu yang dibahas adalah komponen RTC DS1307, yang lazim diperdagangkan dalam bentuk papan yang ditandai sebagai Tiny RTC. Kali ini saya coba rangkumkan mengenai DS3231 dari berbagai sumber sebagai awalan untuk memperlajarinya. RTC ini dilaporkan memiliki akurasi yang lebih baik dari RTC DS1307.

Gambar 1.

 

With a backup button cell (e.g. CR2032) on the underside of the module, these DS1307 modules will keep time even when disconnected from the main power source for months and even years on end. However, in our experimental projects (using this RTC with an Arduino for dataloggers amongst other things), we have found these DS1307 modules to vary hugely in their time-keeping accuracy – some gaining/losing a few seconds per day, and others gaining/losing as much as 3-5 minutes per day. While they have proved to be very consistent – i.e. a unit which gains 3 minutes per day will gain 3 minutes per day every day – having to test each unit individually over a few days and then modifying the Arduino project code to cancel out errors is not practical.

Some of the error is caused by ambient temperature changes affecting the accuracy of the timing of the crystal resonator. Some more of the error is also caused by the quality of the crystal itself and its attachment to the PCB in these economical modules.

In extensive testing we have found the time-keeping of these modules to be excellent. The DS3231 chip on the module is marketed as being accurate to 2ppm (parts per million), which means less than one second lost or gained every 5 to 6 days. The units we have tested thus far have all come in at under 1ppm accuracy, so a couple of seconds at most lost or gained per month.

This accuracy is achieved in part by the incorporation of a temperature sensor in the DS3231 which can compensate for changes in ambient temperature. The measurements from this temperature sensor are also accessible to the user (accurate to +/- 3 Celcius) which makes for a handy extra feature. These DS3231 modules also have 32kb of available EEPROM memory which can be utilised by your projects, and many other useful features.

~reuk.co.uk

 

sumber: Benchmarks: Real Time Clocks – Results for Raspberry Pi/Arduino – DS3231 / PCF8563 / MCP79400 / DS1307

 

Gambar 2. [randomnerdtutorials.com]

 

Terdapat beberapa pustaka/library untuk tiap RTC. Dua yang disampaikan dalam “mashup ini adalah pustaka dari Adafruit dan pustaka dari Makuna.

Contoh-contoh kode program sistem Arduino untuk RTC DS3231.

Sistem ini dirancang untuk bekerja dengan menggunakan baterai “khusus”, yaitu baterai yang bisa diisi ulang (rechargeable) seperti LIR2032. Di papan sudah disediakan sistem pengisian ulang untuk baterai tersebut. Karena itu jika kita mempergunakan baterai tipe yang tidak bisa diisi ulang (non-rechargeable) seperti CR2032 maka ada perubahan yang perlu dilakukan. Hal ini untuk mencegah agar baterai primer yang tidak bisa diisi ulang itu tidak berusaha diisi oleh sistem. Caranya adalah dengan melepas/membuang diode seperti pada Gambar 3 berikut.

ds.jpgGambar 3. [sumber: tronixlabs.com]

 

 

Save