Presentation is loading. Please wait.

Presentation is loading. Please wait.

Paul MacDougal Triembed.org Dec 11, 2017

Similar presentations


Presentation on theme: "Paul MacDougal Triembed.org Dec 11, 2017"— Presentation transcript:

1 Paul MacDougal Triembed.org Dec 11, 2017
DS3231 Paul MacDougal Triembed.org Dec 11, 2017

2 DS3231 “Extremely Accurate I2C-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

3 Functions Clock – provides you with the time and date.
Square wave output(s) 1 Hz, 1k, 4k, 8k Hz 32k Hz Alarms to interrupt your Arduino code Temperature

4 Breakout Boards Also has 32kB of I2C EEPROM $5.99 Amazon Prime

5 Breakout Boards $12.28 for qty 5
This is what I purchased. When they arrived, I found out that the interrupt pin was not wired to the breakout pins  But, one of the breakout pins is NC and with a little rework, I connected the interrupt pin to the NC. $12.28 for qty 5

6 Register map Address Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Seconds
Seconds Clock 1 Minutes 2 Hours 3 Day 4 Date 5 Month 6 Year 7 Alarm1 8 9 10 Day/Date 11 Alarm2 12 13 14 Control 15 Status 16 Aging 17 Temperature 18

7 Arduino Library There are many available libraries.
I used the one from Adafruit I did make some changes to allow access to internal I2C read/write routines. I removed the keyword “static” from the definition of the two I2C access routines.

8 Alarm1 x1111 Alarm once per second x1110 Alarm when seconds match
Alarm when minutes and seconds match X1000 Alarm when hours, minutes, and seconds match 00000 Alarm when date, hours, minutes, and seconds match 10000 Alarm when day, hours, minutes, and seconds match For me, the real reason to use one of these is to access the alarm functions.

9 Alarm2 x111 Alarm once per minute x110 Alarm when minutes match x100
Alarm when hours and minutes match 0000 Alarm when date, hours, and minutes match 1000 Alarm when day, hours, and minutes match

10 Examples Example 1 – read the time
Example 2 – enable square wave output Example 3 – read the temperature Example 4 – use alarm2 to wake every minute Example 5 – use alarm1 to wake every 42 seconds Example 6 – set the time

11 Backup Slides

12 From the datasheet: ● Highly Accurate RTC Completely Manages All Timekeeping Functions • Real-Time Clock Counts Seconds, Minutes, Hours Date of the Month, Month, Day of the Week, and Year • Leap-Year Compensation Valid Up to • Accuracy ±2ppm from 0°C to +40°C • Accuracy ±3.5ppm 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 (400kHz) I2C Interface ● Battery-Backup Input for Continuous Timekeeping • Low Power Operation Extends Battery-Backup Run Time • 3.3V Operation ● Operating Temperature Ranges: • Commercial (0°C to +70°C) and Industrial (-40°C to +85°C) ● Underwriters Laboratories® (UL) Recognized


Download ppt "Paul MacDougal Triembed.org Dec 11, 2017"

Similar presentations


Ads by Google