DS3231 Module โมดูลนาฬิกา

DS3231 Module โมดูลนาฬิกา
DS3231 Module โมดูลนาฬิกาDS3231 Module โมดูลนาฬิกาDS3231 Module โมดูลนาฬิกาDS3231 Module โมดูลนาฬิกา
รหัสสินค้า SKU-00610
หมวดหมู่ โมดูลนาฬิกา
ราคา 140.00 บาท
สถานะสินค้า พร้อมส่ง
ลงสินค้า 19 ก.ย. 2565
อัพเดทล่าสุด 19 ก.ย. 2565
คงเหลือ ไม่จำกัด
จำนวน
ชิ้น
หยิบลงตะกร้า
บัตรประชาชน
บุ๊คแบ๊งค์
คุ้มครองโดย LnwPay

โมดูลนาฬิกา DS3231 module  ความแม่นยำสูง RTC DS3231 AT24C32 IIC Module

Precision Clock Module for Arduino

 DS3231 module เป็นโมดูนาฬิกาแบบเวลาจริง RTC( Real Time Clock ) ที่มีความถูกต้องแม่นยำสูง

เพราะข้างในมีวงจรวัดอุณหภูมิ เพื่อนำอุณหภูมิจากสภาพแวดล้อมมาคำนวนชดเชยความถี่ของ Crystal ที่

ถูกรบกวนจากอุณหภูมิภายนอก มาพร้อมแบตเตอร์รี่ ใช้งานได้แม้ไม่มีแหล่งจ่ายไฟจากภายนอก สามารถตั้ง

ค่า วัน เวลา ได้อย่างง่าย มีไลบารีมาพร้อมใช้งาน สามารถเลือกแสดงผลเวลาแบบ 24 ชั่วโมงหรือแบบ 12

ชัวโมงก็ได้

นอกจากจะแสดงวันและเวลาได้อย่างแม่นยำแล้ว โมดูลนี้ยังสามารถ แสดงอุณหภูมิภายนอกได้ เป็นเหมือน

นาฬิกาดิจิตอลที่บอกอุณหภูมิได้ด้วย

  ________________________________________________________________________________________________

 library /code DS3231 Module

 

  ________________________________________________________________________________________________ 

ตัวอย่างการใช้งาน DS3231 Module

DS3231 module -> Arduino

SCL -> A5
SDA -> A4
VCC -> 5V
GND -> GND

 ________________________________________________________________________________________________ 

ข้อมูลเพิ่มเติม DS3231 Module

 

 ________________________________________________________________________________________________

ตัวอย่างCode ฟังก์ชั่นนาฬิกาปลุก และการแสดงเวลา DS3231 Module

 

// Date, Time and Alarm functions using a DS3231 RTC connected via I2C and Wire lib

#include "Wire.h"

#include "SPI.h"  // not used here, but needed to prevent a RTClib compile error

#include "RTClib.h"

RTC_DS3231 RTC;

void setup () {

  Serial.begin(9600);

  Wire.begin();

  RTC.begin();

  // ตั้งเวลาเตือนให้เอา // ข้างหน้า RTC.adjust ออก

  //RTC.adjust(DateTime(__DATE__, __TIME__));

  if (! RTC.isrunning()) {

    Serial.println("RTC is NOT running!");

    // following line sets the RTC to the date & time this sketch was compiled

    RTC.adjust(DateTime(__DATE__, __TIME__));

  }

  DateTime now = RTC.now();

//กำหนดให้ นาฬิกาเตือนตอน 13:05

  RTC.setAlarm1Simple(13, 5);

  RTC.turnOnAlarm(1);

  if (RTC.checkAlarmEnabled(1)) {

    Serial.println("Alarm Enabled");

  }

}

void loop () {

  DateTime now = RTC.now();

  Serial.print(now.year(), DEC);

  Serial.print('/');

  Serial.print(now.month(), DEC);

  Serial.print('/');

  Serial.print(now.day(), DEC);

  Serial.print(' ');

  Serial.print(now.hour(), DEC);

  Serial.print(':');

  Serial.print(now.minute(), DEC);

  Serial.print(':');

  Serial.print(now.second(), DEC);

  if (RTC.checkIfAlarm(1)) {

    // ถ้านาฬิกาเดินถึง 13:05 จะมาทำงานในนี้

    Serial.println("Alarm Triggered");

  }

  Serial.println();

  Serial.print("Tempeature = ");

  Serial.print(RTC.getTemperature()); // คำสั่งดึงอุณหภูมิออกมาแสดง

  Serial.println(" C");

  delay(1000);

}

 

 ________________________________________________________________________________________________

 

ตัวอย่างCode การsetเวลาใหม่ , การแสดงเวลา , และการทำนาฬิกาปลุกอย่างง่าย DS3231 Module

#include "Wire.h"

#define DS3231_I2C_ADDRESS 0x68

// Convert normal decimal numbers to binary coded decimal

byte decToBcd(byte val)

{

  return( (val/10*16) + (val%10) );

}

// Convert binary coded decimal to normal decimal numbers

byte bcdToDec(byte val)

{

  return( (val/16*10) + (val%16) );

}

void setup()

{

  Wire.begin();

  Serial.begin(9600);

  // set the initial time here:

  // DS3231 seconds, minutes, hours, day, date, month, year

  //setDS3231time(30,42,21,4,26,11,14);

}

void setDS3231time(byte second, byte minute, byte hour, byte dayOfWeek, byte

dayOfMonth, byte month, byte year)

{

  // sets time and date data to DS3231

  Wire.beginTransmission(DS3231_I2C_ADDRESS);

  Wire.write(0); // set next input to start at the seconds register

  Wire.write(decToBcd(second)); // set seconds

  Wire.write(decToBcd(minute)); // set minutes

  Wire.write(decToBcd(hour)); // set hours

  Wire.write(decToBcd(dayOfWeek)); // set day of week (1=Sunday, 7=Saturday)

  Wire.write(decToBcd(dayOfMonth)); // set date (1 to 31)

  Wire.write(decToBcd(month)); // set month

  Wire.write(decToBcd(year)); // set year (0 to 99)

  Wire.endTransmission();

}

void readDS3231time(byte *second,

byte *minute,

byte *hour,

byte *dayOfWeek,

byte *dayOfMonth,

byte *month,

byte *year)

{

  Wire.beginTransmission(DS3231_I2C_ADDRESS);

  Wire.write(0); // set DS3231 register pointer to 00h

  Wire.endTransmission();

  Wire.requestFrom(DS3231_I2C_ADDRESS, 7);

  // request seven bytes of data from DS3231 starting from register 00h

  *second = bcdToDec(Wire.read() & 0x7f);

  *minute = bcdToDec(Wire.read());

  *hour = bcdToDec(Wire.read() & 0x3f);

  *dayOfWeek = bcdToDec(Wire.read());

  *dayOfMonth = bcdToDec(Wire.read());

  *month = bcdToDec(Wire.read());

  *year = bcdToDec(Wire.read());

}

void displayTime()

{

  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

  // retrieve data from DS3231

  readDS3231time(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month,

  &year);

  // send it to the serial monitor

  Serial.print(hour, DEC);

  // convert the byte variable to a decimal number when displayed

  Serial.print(":");

  if (minute<10)

  {

    Serial.print("0");

  }

  Serial.print(minute, DEC);

  Serial.print(":");

  if (second<10)

  {

    Serial.print("0");

  }

  Serial.print(second, DEC);

  Serial.print(" ");

  Serial.print(dayOfMonth, DEC);

  Serial.print("/");

  Serial.print(month, DEC);

  Serial.print("/");

  Serial.print(year, DEC);

  Serial.print(" Day of week: ");

 

  switch(dayOfWeek){

  case 1:

    Serial.println("Sunday");

    break;

  case 2:

    Serial.println("Monday");

    break;

  case 3:

    Serial.println("Tuesday");

    break;

  case 4:

    Serial.println("Wednesday");

    break;

  case 5:

    Serial.println("Thursday");

    break;

  case 6:

    Serial.println("Friday");

    break;

  case 7:

    Serial.println("Saturday");

    break;

  }

  //เมื่อเวลา 21.43 จะทำงานใน if นี้

  if(hour ==21 && minute == 43 ){

    Serial.println("ok");

  }

}

void loop()

{

  displayTime(); // display the real-time clock data on the Serial Monitor,

  delay(1000); // every second

}

 

 

  ________________________________________________________________________________________________ 

วิธีการชำระเงิน

ร้านค้านี้ยังไม่ได้กำหนดวิธีการชำระเงิน กรุณา ติดต่อกับทางร้าน เกี่ยวกับรายละเอียดในการชำระเงิน
ทางร้านยังไม่ได้ทำการเพิ่มบัญชีรับเงิน กรุณาติดต่อ เจ้าของร้าน

CATEGORY

MEMBER

STATISTIC

หน้าที่เข้าชม114,272 ครั้ง
ผู้ชมทั้งหมด51,034 ครั้ง
เปิดร้าน31 ก.ค. 2559
ร้านค้าอัพเดท4 ก.ย. 2568

CONTACT US

รายการสั่งซื้อของฉัน
เข้าสู่ระบบด้วย
เข้าสู่ระบบ
สมัครสมาชิก

ยังไม่มีบัญชีเทพ สร้างบัญชีใหม่ ไม่มีค่าใช้จ่าย
สมัครสมาชิก (ฟรี)
รายการสั่งซื้อของฉัน
ข้อมูลร้านค้านี้
ร้านบ้านโค้ด-Bancode
บ้านโค้ด-Bancode
จำหน่ายบอร์ดไมโครคอนโทรลเลอร์ Arduino,Module,Shield,Sensor,R,L,C,IC เเละอื่นๆ โทร.0624952525
เบอร์โทร : 0964188828
อีเมล : bancode.dev@gmail.com
ส่งข้อความติดต่อร้าน
เกี่ยวกับร้านค้านี้
สินค้าที่ดูล่าสุด
ดูสินค้าทั้งหมดในร้าน
สินค้าที่ดูล่าสุด
บันทึกเป็นร้านโปรด
Join เป็นสมาชิกร้าน
แชร์หน้านี้
แชร์หน้านี้

TOP เลื่อนขึ้นบนสุด
พูดคุย-สอบถาม