DS 3231 Paul Mac Dougal Triembed org Dec
DS 3231 Paul Mac. Dougal Triembed. org Dec 11, 2017
DS 3231 • “Extremely Accurate I 2 C-Integrated RTC/TCXO/Crystal” • Real Time Clock • Temperature compensated • Internal crystal • Supports battery backup • SOIC 16 package • Made by Maxim Integrated • $8. 35 qty 1 at Digikey
Functions • Clock – provides you with the time and date. • Square wave output(s) – 1 Hz, 1 k, 4 k, 8 k Hz – 32 k Hz • Alarms to interrupt your Arduino code • Temperature
Breakout Boards $5. 99 Amazon Prime
Breakout Boards $12. 28 for qty 5
Register map Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0 Seconds Clock 1 Minutes 2 Hours 3 Day 4 Date 5 Month 6 Year 7 Seconds Alarm 1 8 Minutes 9 Hours 10 Day/Date 11 Minutes Alarm 2 12 Hours 13 Day/Date 14 Control 15 Status 16 Aging 17 Temperature 18
Arduino Library • There are many available libraries. • I used the one from Adafruit https: //github. com/adafruit/RTClib/archive/master. zip • I did make some changes to allow access to internal I 2 C read/write routines.
Alarm 1 x 1111 Alarm once per second x 1110 Alarm when seconds match x 1100 Alarm when minutes and seconds match X 1000 Alarm when hours, minutes, and seconds match Alarm when date, hours, minutes, and seconds match Alarm when day, hours, minutes, and seconds match 00000 10000
Alarm 2 x 111 Alarm once per minute x 110 Alarm when minutes match x 100 Alarm when hours and minutes match 0000 Alarm when date, hours, and minutes match Alarm when day, hours, and minutes match 1000
Examples • • Example 1 – read the time Example 2 – enable square wave output Example 3 – read the temperature Example 4 – use alarm 2 to wake every minute • Example 5 – use alarm 1 to wake every 42 seconds • Example 6 – set the time
Backup Slides
From the datasheet: ● Highly Accurate RTC Completely Manages All Timekeeping Functions • Real-Time Clock Counts Seconds, Minutes, Hours Date of the Month, Day of the Week, and Year • Leap-Year Compensation Valid Up to 2100 • Accuracy ± 2 ppm from 0°C to +40°C • Accuracy ± 3. 5 ppm from -40°C to +85°C • Digital Temp Sensor Output: ± 3°C Accuracy • Register for Aging Trim • RST Output/Pushbutton Reset Debounce Input • Two Time-of-Day Alarms • Programmable Square-Wave Output Signal ● Simple Serial Interface Connects to Most Microcontrollers • Fast (400 k. Hz) I 2 C Interface ● Battery-Backup Input for Continuous Timekeeping • Low Power Operation Extends Battery-Backup Run Time • 3. 3 V Operation ● Operating Temperature Ranges: • Commercial (0°C to +70°C) and Industrial (-40°C to +85°C) ● Underwriters Laboratories® (UL) Recognized
- Slides: 12