Ks0039 keyestudio DS3231 Clock Module: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:


<br>
<br>
==Specification==
==Specification==
* 1)Temperature range: -40 to +85; Timing accuracy : ± 5ppm (±0.432 seconds / day)
* 1)Temperature range: -40 to +85; Timing accuracy : ± 5ppm (±0.432 seconds / day)
Line 28: Line 27:
<br>
<br>
==Connection Diagram ==
==Connection Diagram ==
This module adopts the IIC test method, so we only need to connect SDA to Arduino A4; SCL to A5; positive pin to VCC; negative pin to GND
This module adopts the IIC test method, so we only need to connect SDA to Arduino A4; SCL to A5; positive pin to VCC; negative pin to GND.
 
<br>[[File:Ks0039-2.png|700px|frameless|thumb]]<br>  
<br>[[File:Ks0039-2.png|700px|frameless|thumb]]<br>  




<br>
<br>
==Sample Code ==
==Sample Code ==
<span style=color:red> Before compiling the code, you’d better put [https://github.com/rodan/ds3231 DS3231 library] under file into Arduino catalogue. <br>
<span style=color:red> Before compiling the code, you’d better put [https://github.com/rodan/ds3231 DS3231 library] under file into Arduino catalogue. <br>
Line 77: Line 74:
<br>
<br>
<span style=color:red> Before compiling the code, you’d better put [https://github.com/rodan/ds3231 DS3231 library]  under file into Arduino catalogue. </span> <br>  
<span style=color:red> Before compiling the code, you’d better put [https://github.com/rodan/ds3231 DS3231 library]  under file into Arduino catalogue. </span> <br>  
When the above steps are done, you can upload the code to arduino and open the serial monitor and get the following results: <br>
When the above steps are done, you can upload the code to arduino and open the serial monitor and get the following results:  
<br>[[File:393.png|700px|frameless|thumb]]<br>
<br>[[File:ks0068 35-3.png|500px|frameless|thumb]]<br>


<br>
<br>
==Resources ==
==Resources ==


Line 88: Line 84:


* '''PDF and Code'''<br>
* '''PDF and Code'''<br>
https://drive.google.com/open?id=11UQh5GbcXDtOgBEE4FcMWnRveYtd6Pxn
https://fs.keyestudio.com/KS0039
 


<br>
<br>

Latest revision as of 11:27, 8 January 2021


Introduction

DS3231 is equipped with integrated TCXO and crystal, which make it a cost-effective I2C real time clock with high precision. 
The device carries a battery input, so if you disconnect the main power supply, it can still maintain accurate timing.
The integrated oscillator ensures the long-term accuracy of the device and reduces the number of components. 
DS3231 provides both commercial and industrial temperature range and supports 16 pins small-outline package (300mil). 
The module itself can adapt to the system of 3.3V and 5V without level switch, which is quite convenient!

thumb


Specification

  • 1)Temperature range: -40 to +85; Timing accuracy : ± 5ppm (±0.432 seconds / day)
  • 2)Provide battery backup for continuous timing
  • 3)Low power consumption
  • 4)Device package and function compatible with DS3231
  • 5)Complete clock calendar function contains seconds and minutes, hour, week, date, month, and year timing and provides leap year compensation until 2100.
  • 6)Two calendar clock
  • 7)Output: 1Hz and 32.768kHz
  • 8)Reset output and Input Debounce of Pushbutton
  • 9)High speed  (400kHz), I2C serial bus
  • 10)Supply voltage: +3.3V to +5.5V
  • 11)Digital temperature sensor with a precision of±3℃
  • 12)Working temperature: -40 ~ C to +85 ~ C 
  • 13)16 pins Small Outline Package (300mil)


Connection Diagram

This module adopts the IIC test method, so we only need to connect SDA to Arduino A4; SCL to A5; positive pin to VCC; negative pin to GND.
thumb



Sample Code

Before compiling the code, you’d better put DS3231 library under file into Arduino catalogue.

#include <Wire.h>
#include "DS3231.h"
DS3231 RTC; //Create the DS3231 object
char weekDay[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
//year, month, date, hour, min, sec and week-day(starts from 0 and goes to 6)
//writing any non-existent time-data may interfere with normal operation of the RTC.
//Take care of week-day also.
DateTime dt(2011, 11, 10, 15, 18, 0, 5);//open the serial port and you can check time here or make a change to the time as needed.
void setup () 
{   Serial.begin(57600);//set baud rate to 57600
    Wire.begin();
    RTC.begin();
    RTC.adjust(dt); //Adjust date-time as defined 'dt' above 
}
void loop () 
{  
 DateTime now = RTC.now(); //get the current date-time
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.date(), DEC);

    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    Serial.print(weekDay[now.dayOfWeek()]);
    Serial.println();
    delay(1000);
}


Before compiling the code, you’d better put DS3231 library  under file into Arduino catalogue.
When the above steps are done, you can upload the code to arduino and open the serial monitor and get the following results:
thumb


Resources

  • Video

http://video.keyestudio.com/ks0039/

  • PDF and Code

https://fs.keyestudio.com/KS0039



Buy from