รหัสสินค้า | SKU-00608 |
หมวดหมู่ | โมดูลนาฬิกา |
ราคา | 50.00 บาท |
สถานะสินค้า | พร้อมส่ง |
ลงสินค้า | 19 ก.ย. 2565 |
อัพเดทล่าสุด | 19 ก.ย. 2565 |
คงเหลือ | ไม่จำกัด |
จำนวน | ชิ้น |
DS1307 Module โมดูลนาฬิกา Tiny RTC I2C modules 24C32 memory DS1307 clock
โมดูลนาฬิกาแบบเรียวไทม์ ใช้ IC เบอร์ DS 1307 เก็บข้อมูลวันเวลา แสดงผลเวลาได้ทั้งแบบ 12 และ แบบ 24 ชั่วโมง ใช้ง่ายมีไลบารีมาตรฐานพร้อมใช้งาน
DS1307 I2C real time clock chip (RTC)
24C32 32K I2C EEPROM memory
Using LIR2032 rechargeable lithium battery and charging circuit with
DS1307 with battery backup can not solve the problem of literacy.
Fully charged, can provide DS1307 timing 1 year.
Compact design, 27mm * 28mm * 8.4mm
Leads to the DS1307 clock pin provides a clock signal for the microcontroller.
Other I2C devices can be cascaded.
DS1307 is a low power, with 56 bytes of non-volatile RAM clock calendar full BCD code real-time clock chip, the address and data via a two-wire bidirectional serial bus transmission, the chip provides seconds, minutes, hours and other information , the number of days of each month can be automatically adjusted. And there is a leap year compensation. AM / PM flag determines clock operates in 24 hours or 12 hours mode, the chip has a built-in power-sense circuit, brownout detect, and battery switching function.
DS1307 features:
Available on the second, hour, minute, number of days per month, month, week, count the number of days, and has a leap year compensation. Record on the line in 2100.
________________________________________________________________________________________________
ตัวอย่างการใช้งาน
โมดูลนาฬิกา RTC DS1307 -> Arduino
ภายในโมดูลจะประกอบไปด้วย DS1307 และ AT24C32 ซึ่งเป็น
ต่อใช้งานร่วมกับ Arduino ด้วยบัส I2C และการอ่านค่าเวลาของจะต้องอ่านจากจิสเตอร์ DS1307 เพื่อลดความยุ่งยากผมจะใช้ library ซึ่งมีคนเขียนไว้เรียบร้อยแล้วสามารถดาวน์โหลดที่ https://github.com/jarzebski/Arduino-DS1307
เรามาเริ่มกันเลย หลังจากที่ดาวน์โหลดและติดตั้งเรียบร้อยแล้ว ให้ใส่โค๊ตตามตัวอย่างนี้นะครับ
#include <Wire.h> | |
#include <DS1307.h> | |
DS1307 clock; | |
RTCDateTime dt; | |
void setup() | |
{ | |
Serial.begin(9600); | |
// Initialize DS1307 | |
Serial.println("Initialize DS1307");; | |
clock.begin(); | |
// If date not set | |
if (!clock.isReady()) | |
// Manual (YYYY, MM, DD, HH, II, SS | |
clock.setDateTime(2014, 4, 13, 19, 21, 00); | |
} | |
} | |
void loop() | |
{ | |
dt = clock.getDateTime(); | |
Serial.print("Long number format: "); | |
Serial.println(clock.dateFormat("d-m-Y H:i:s", dt)); | |
Serial.print("Long format with month name: "); | |
Serial.println(clock.dateFormat("d F Y H:i:s", dt)); | |
Serial.print("Short format witch 12h mode: "); | |
Serial.println(clock.dateFormat("jS M y, h:ia", dt)); | |
Serial.print("Today is: "); | |
Serial.print(clock.dateFormat("l, z", dt)); | |
Serial.println(" days of the year."); | |
Serial.print("Actual month has: "); | |
Serial.print(clock.dateFormat("t", dt)); | |
Serial.println(" days."); | |
Serial.print("Unixtime: "); | |
Serial.println(clock.dateFormat("U", dt)); | |
delay(1000); | |
} |
จะได้ผลัพธ์ดังรูปที่ 2 ซึ่งจะแสดงเวลาในรูปแบบต่างๆ ตามที่เราเขียนไว้ใน code
ขออธิบายนิดนึงนะครับ Serial.println(clock.dateFormat(“d-m-Y H:i:s”, dt)); ตามตัวอย่างโค๊ตนี้จะเห็นว่า ใส่แค่ d,m,Y ก็แสดงค่าเวลาออกมได้เลยโดยที่เราไม่ต้องเขียนโค๊ตอ่านค่าจากรีจิสเตอร์ของ RTC เลยเพราะการทำงานทั้งหมดของเขียนไว้ในไลบาร์รี่หมดแล้วเราแค่เรียกใช้และใส่รูปแบบให้ได้ตามที่เราต้อการแค่นั้นเอง ง่ายใช่มั้ยล่ะครับ
________________________________________________________________________________________________
ข้อมูลเพิ่มเติม Tiny RTC I2C modules 24C32 memory DS1307 clock for arduino
หน้าที่เข้าชม | 114,272 ครั้ง |
ผู้ชมทั้งหมด | 51,034 ครั้ง |
เปิดร้าน | 31 ก.ค. 2559 |
ร้านค้าอัพเดท | 4 ก.ย. 2568 |