Ks0130 keyestudio EASY plug DS3231 Clock Module: Difference between revisions
Keyestudio (talk | contribs) |
Keyestudio (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[image:ks0130图.jpg|thumb|600px|right|EASY plug DS3231 Clock Module]] | |||
==Introduction== | ==Introduction== | ||
The DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. | The DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. <br> | ||
A real-time clock (RTC) is a computer clock (most often in the form of an integrated circuit) that keeps track of the current time.<br> | |||
It integrated with a battery input, which can maintain accurate timekeeping when power off. The integrated crystal resonator ensures the accuracy of clock. So this RTC solution should be worth to try.<br> | |||
<span style="color: red">'''Note: ''' this module should be used together with EASY plug control board. | |||
<br> | |||
==Specification== | ==Specification== | ||
* Temperature range: -40℃ to +85℃ | |||
* Temperature range: - | * Timing accuracy: about ± 5ppm | ||
* Output: 1Hz and 32.768kHz | * Output: 1Hz and 32.768kHz | ||
* High speed (400kHz), I2C serial bus | * High speed (400kHz), I2C serial bus | ||
* Supply voltage: | * Supply voltage: 3.3V to 5.5V | ||
* | * Output Level: TTL level | ||
<br> | |||
==Technical Details== | |||
* | * Dimensions: 38mm*20mm*18mm | ||
* Weight: | * Weight: 5.4g | ||
<br> | |||
==Connect It Up== | |||
Connect the EASY Plug DS3231 Clock module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable. | |||
<br>[[File:ks0130.jpg|500px|frameless|thumb]]<br> | |||
<br> | |||
==Upload the Code== | |||
== | Copy and paste below code to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE Arduino IDE] and upload. | ||
<pre> | <pre> | ||
#include <Wire.h> // place file “Wire.h” under the directory “libraries” of Arduino | #include <Wire.h> // place file “Wire.h” under the directory “libraries” of Arduino | ||
#include "DS3231.h" // place file “DS3231.h” under the directory “libraries” of Arduino | #include "DS3231.h" // place file “DS3231.h” under the directory “libraries” of Arduino | ||
DS3231 RTC; //Create the DS3231 object | DS3231 RTC;//Create the DS3231 object | ||
char weekDay[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; | 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) | //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. | //writing any non-existent time-data may interfere with normal operation of the RTC. | ||
//Take care of week-day also. | //Take care of week-day also. | ||
DateTime dt( | DateTime dt(2018,11,16,10,25,33,3);//open the series port and you can check time here or make a change to the time as needed. | ||
void setup () | 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 () | 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); | |||
} | } | ||
</pre> | </pre> | ||
<br> | |||
==What You Should See== | |||
Done uploading the code, open the serial monitor and set the baud rate to 57600, you should be able to see the time and the date. | |||
<br>[[File:ks0130-2.png|500px|frameless|thumb]]<br> | |||
<br> | |||
==Resources == | ==Resources == | ||
'''PDF'''<br> | |||
'''PDF''' | |||
https://drive.google.com/open?id=1QHUXpcPLB87DfdQB7pMQLfJoHeO2pKnc | https://drive.google.com/open?id=1QHUXpcPLB87DfdQB7pMQLfJoHeO2pKnc | ||
<br> | |||
'''Libraries''' | '''Libraries'''<br> | ||
https://drive.google.com/open?id=1Vc-3syIIwFtBpHjWFxSikPDSFsT4Y1SD | https://drive.google.com/open?id=1Vc-3syIIwFtBpHjWFxSikPDSFsT4Y1SD | ||
<br> | |||
==Buy from == | ==Buy from == | ||
'''Official Website''' | '''Official Website'''<br> | ||
http://www.keyestudio.com/keyestudio-easy-plug-ds3231-clock-module-for-arduino.html | http://www.keyestudio.com/keyestudio-easy-plug-ds3231-clock-module-for-arduino.html | ||
[[category:EASY Plug]] | [[category:EASY Plug]] |
Revision as of 10:32, 23 November 2018
Introduction
The DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal.
A real-time clock (RTC) is a computer clock (most often in the form of an integrated circuit) that keeps track of the current time.
It integrated with a battery input, which can maintain accurate timekeeping when power off. The integrated crystal resonator ensures the accuracy of clock. So this RTC solution should be worth to try.
Note: this module should be used together with EASY plug control board.
Specification
- Temperature range: -40℃ to +85℃
- Timing accuracy: about ± 5ppm
- Output: 1Hz and 32.768kHz
- High speed (400kHz), I2C serial bus
- Supply voltage: 3.3V to 5.5V
- Output Level: TTL level
Technical Details
- Dimensions: 38mm*20mm*18mm
- Weight: 5.4g
Connect It Up
Connect the EASY Plug DS3231 Clock module to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
Upload the Code
Copy and paste below code to Arduino IDE and upload.
#include <Wire.h> // place file “Wire.h” under the directory “libraries” of Arduino #include "DS3231.h" // place file “DS3231.h” under the directory “libraries” of Arduino 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(2018,11,16,10,25,33,3);//open the series 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); }
What You Should See
Done uploading the code, open the serial monitor and set the baud rate to 57600, you should be able to see the time and the date.
Resources
PDF
https://drive.google.com/open?id=1QHUXpcPLB87DfdQB7pMQLfJoHeO2pKnc
Libraries
https://drive.google.com/open?id=1Vc-3syIIwFtBpHjWFxSikPDSFsT4Y1SD
Buy from
Official Website
http://www.keyestudio.com/keyestudio-easy-plug-ds3231-clock-module-for-arduino.html