adafruit_ds3231¶
CircuitPython library to support DS3231 Real Time Clock (RTC).
This library supports the use of the DS3231-based RTC in CircuitPython.
Author(s): Philip R. Moyer and Radomir Dopieralski for Adafruit Industries.
Implementation Notes¶
Hardware:
- Adafruit DS3231 Precision RTC FeatherWing (Product ID: 3028)
- Adafruit DS3231 RTC breakout (Product ID: 3013)
- Adafruit ChronoDot - Ultra-precise Real Time Clock - v2.1 (Product ID: 255)
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- Adafruit’s Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
Notes:
- Milliseconds are not supported by this RTC.
- Datasheet: https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
- 
class adafruit_ds3231.DS3231(i2c)[source]¶
- Interface to the DS3231 RTC. - Parameters: - i2c (I2C) – The I2C bus the device is connected to - Quickstart: Importing and using the device - Here is an example of using the - DS3231class. First you will need to import the libraries to use the sensor- import time import board import adafruit_ds3231 - Once this is done you can define your - board.I2Cobject and define your sensor object- i2c = board.I2C() # uses board.SCL and board.SDA rtc = adafruit_ds3231.DS3231(i2c) - Now you can give the current time to the device. - t = time.struct_time((2017, 10, 29, 15, 14, 15, 0, -1, -1)) rtc.datetime = t - You can access the current time accessing the - datetimeattribute.- current_time = rtc.datetime - 
alarm1¶
- Alarm time for the first alarm. 
 - 
alarm1_interrupt¶
- True if the interrupt pin will output when alarm1 is alarming. 
 - 
alarm1_status¶
- True if alarm1 is alarming. Set to False to reset. 
 - 
alarm2¶
- Alarm time for the second alarm. 
 - 
alarm2_interrupt¶
- True if the interrupt pin will output when alarm2 is alarming. 
 - 
alarm2_status¶
- True if alarm2 is alarming. Set to False to reset. 
 - 
calibration¶
- Calibrate the frequency of the crystal oscillator by adding or removing capacitance. The datasheet calls this the Aging Offset. Calibration values range from -128 to 127; each step is approximately 0.1ppm, and positive values decrease the frequency (increase the period). When set, a temperature conversion is forced so the result of calibration can be seen directly at the 32kHz pin immediately 
 - 
datetime¶
- Gets the current date and time or sets the current date and time then starts the clock. 
 - 
datetime_register¶
- Current date and time. 
 - 
disable_oscillator¶
- True if the oscillator is disabled. 
 - 
lost_power¶
- True if the device has lost power since the time was set. 
 - 
temperature¶
- Returns the last temperature measurement. Temperature is updated only every 64 seconds, or when a conversion is forced. 
 
-