RTC DS3231

[ [ images, codes & links ] ]
[su_panel border=”3px solid #99BB3D” radius=”10″]

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.



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


Gambar 2. [randomnerdtutorials.com]


[/su_panel] [su_panel border=”3px solid #30C0F0″ radius=”10″]

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

[/su_panel] [su_panel border=”3px solid #FF6666″ radius=”10″]

Contoh-contoh kode program sistem Arduino untuk RTC DS3231.

[/su_panel] [su_panel border=”3px solid #288AC7″ radius=”10″]

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]


[/su_panel] [su_panel border=”3px solid #00C700″ radius=”10″]
[/su_panel] [su_panel border=”3px solid #990066″ radius=”10″] [/su_panel]



Leave a Comment