К основному контенту

Модуль DS3231







Описание с Ali

Размер: 38 мм (длина) * 22 мм * 14 мм (высота)

Рабочее напряжение: 3.3-5. 5 В
Часы чип: высокой точностью чип DS3231
Часы точность: 0-40 градусов, точность PPM.
Календарь Будильник
Программируемый выход
Часы реального времени генератор секунд, минут, часов, день, дата, месяц и год
Микросхемы памяти: AT24C32 (емкость 32 К)
Шины IIC интерфейс, максимальная скорость передачи данных 400 кГц (рабочее напряжение 5 В)
Можно каскадно с других IIC устройства, 24C32 адрес может быть замкнуты A0/A1/A2 изменить по умолчанию адрес 0x57
Аккумуляторная батарея LIR2032, для продолжения работы системы после сбоя питания


Подключение к ардуино


SQW прерывание будильника
SCL - A5
SDA - A4
VCC - +5V
GND - GND

Библиотека: DS3231 /загрузить

Описание библиотеки:

Date formats (Day)
------------------

 * d : Day of the month, 2 digits with leading zeros (01 to 31)
 * D : A textual representation of a day, three letters (Mon through Sun)
 * j : Day of the month without leading zeros (1 to 31)
 * l : A full textual representation of the day of the week (Sunday through Saturday)
 * N : ISO-8601 numeric representation of the day of the week (1 for Monday through 7 for Sunday)
 * S : English ordinal suffix for the day of the month, 2 characters (st, nd, rd or th. Works well with j)
 * w : Numeric representation of the day of the week (0 for Sunday through 6 for Saturday)
 * z : The day of the year (0 through 365)

Date formats (Month)
--------------------

 * F : A full textual representation of a month, such as January or March (January through December)
 * m : Numeric representation of a month, with leading zeros (01 through 12)
 * M : A short textual representation of a month, three letters (Jan through Dec)
 * n : Numeric representation of a month, without leading zeros (1 through 12)
 * t : Number of days in the given month (28 through 31)

Date formats (Year)
-------------------

 * L : Whether it's a leap year (1 if it is a leap year, 0 otherwise)
 * Y : A full numeric representation of a year, 4 digits (Examples: 1999 or 2003)
 * y : A two digit representation of a year (Examples: 99 or 03)

Date formats (Time)
-------------------

 * a : Lowercase Ante meridiem and Post meridiem (am or pm)
 * A : Uppercase Ante meridiem and Post meridiem (AM or PM)
 * g : 2-hour format of an hour without leading zeros (1 through 12)
 * G : 24-hour format of an hour without leading zeros (0 through 23)
 * h : 12-hour format of an hour with leading zeros (01 through 12)
 * H : 24-hour format of an hour with leading zeros (00 through 23)
 * i : Minutes with leading zeros (00 to 59)
 * s : Seconds, with leading zeros (00 through 59)

Dare formats (Full Date/Time)
-----------------------------

 * U : Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)



Alarm modes:
-----------------------------
  Set Alarm - Every second.
  DS3231_EVERY_SECOND is available only on Alarm1.
  setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm1(0, 0, 0, 0, DS3231_EVERY_SECOND);

  Set Alarm - Every full minute.
  DS3231_EVERY_MINUTE is available only on Alarm2.
  setAlarm2(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm2(0, 0, 0, 0, DS3231_EVERY_MINUTE);

  Set Alarm1 - Every 20s in each minute
  setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm1(0, 0, 0, 20, DS3231_MATCH_S);

  Set Alarm2 - Every 01m in each hour
  setAlarm2(Date or Day, Hour, Minute, Mode, Armed = true)
  clock.setAlarm2(0, 0, 1,     DS3231_MATCH_M);

  Set Alarm - Every 01m:25s in each hour
  setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm1(0, 0, 1, 25, DS3231_MATCH_M_S);

  Set Alarm - Every 01h:10m:30s in each day
  setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm1(0, 1, 10, 30, DS3231_MATCH_H_M_S);

  Set Alarm - 07h:00m:00s in 25th day in month
  setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm1(25, 7, 0, 0, DS3231_MATCH_DT_H_M_S);

  Set Alarm - 10h:45m:30s in every Friday (1 - Mon, 7 - Sun)
  setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
  clock.setAlarm1(5, 10, 40, 30, DS3231_MATCH_DY_H_M_S);

Комментарии

Популярные сообщения из этого блога

Prototype shield V5 для ARDUINO UNO

Модуль генератор на NE555

Вольтметр, Термометр, Алкотестер для авто

Схема Плата Скетч #include "U8glib.h" #include <OneWire.h> #include <DallasTemperature.h> // Data wire is plugged into port 2 on the Arduino #define ONE_WIRE_BUS 4 // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature.  DallasTemperature sensors(&oneWire); U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);  // I2C / TWI const int buttonPin = 12; const int AlcoOnPin = 13; //Цифровой выход на включение датчика MQ-3 const int AlcoReadPin = A0; //Аналоговый вход на прием данных с датчика MQ-3 const int analogBat = A1; // Аналоговий вхід для заміра напруги бортової мережі  int buttonState = 0; void setup() {   Serial.begin(9600);      sensors.begin(); // Запускаем библиотеку измерения температуры   pinMode(buttonPin, INPUT);