Introduction
The RTC module is specifically designed for Raspberry Pi. It communicated with Raspberry Pi through I2C bus. There is a Maxim DS1307 and CR1220 button cell on the board to keep the real time for a long time after the Raspberry Pi has it's powerdown. Set a serial port, TTL convenient way online debugging.
Specification
- RTC module: DS1307
- Battery model: CR1220 button cell
- Opearting Voltage: 5V
- I2C address: 0x68
- Clock precision: ±2ppm (0~40°C)
- Unit information: Second, Minute, Date, Week, Month and Year
- Two calendar clock
- Operating temperature: -10°C至+85°C
- Compatible with Raspberry Pi B/A+/B+/2B
- Interface: 2*5p 2.54mm
Dimension
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Dimension](https://dfimg.dfrobot.com/nobody/wiki/ba9c3f1d56bd2423b163f043569770a0.png)
HOW TO USE
Connection
- Connect the module to your Pi
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Connection](https://dfimg.dfrobot.com/nobody/wiki/dd7be24971d96ea155e2649ac671b017.png)
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Connection](https://dfimg.dfrobot.com/nobody/wiki/b79374dae0adfb324e487d317c91b339.jpg)
- The module leads to the TX&RX pins, you could set the information via this port.
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Connection](https://dfimg.dfrobot.com/nobody/wiki/3d22da12dc5ea076107a4ade13ffe7c3.png)
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Connection](https://dfimg.dfrobot.com/nobody/wiki/958c9de89affef6968218743f45b4886.png)
NOTE: DO NOT power it again if the Raspberry Pi has been powered, or it will damage the module and Raspberry. |
Test
- 1. Input "sudo raspi-config" to Open Raspberry Pi I2C interface
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/df96f0297a147840af82e398d68bd742.png)
- 2. Select "Advanced Options"
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/f857d05c566eadafa37519f81f06ba37.png)
- 3. Select "I2C"
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/51ee99f39c1748dc77dec0eca7d9790b.png)
- 4. Select "YES"
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/da84828768655eb8fb6c694be13aa1b3.png)
- 5. Input "sudo vim.tiny /etc/modules" to add the module
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/2cabd61f802bce2b22060b9bcfb33844.png)
- 6. Add "i2c-dev" device
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/b6e5be00f105b482262d54b8b997f650.png)
- 7. Install I2C tools, input "sudo apt-get install i2c-tools"
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/8cf9fa8949ff5f482c6f1a6fd6bbedd5.png)
- 8. Input "sudo reboot" to reboot Raspberry Pi; Input "sudo i2cdetect-y1" after a reboot. If everything goes well, the module will be detected normally.
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/8cf9fa8949ff5f482c6f1a6fd6bbedd5.png)
- 9. Input "sudo su--" to get "root"; input "modprobe i2c-dev" to load I2C device.
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/a986021ea1e9818319a3d76b99756fae.png)
- 10. Input "echo "ds1307 0x68" >/sys/class/i2c-adapter/i2c-1/new_device" to load to Raspberry Pi system I2C device.
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/c579069a5f18f16748fdbdb61293a3aa.png)
- 11. Now you can use "hwclock" command to use this module, refer to "man hwclock" for more details.
"hwclock -r" Get RTC module time "hwclock -w" Set system time
![DFR0386 DS1307 RTC Module with Battery for Raspberry Pi (Compatible with Raspberry Pi 4B) Test](https://dfimg.dfrobot.com/nobody/wiki/47a0796e806d70d6a448f7eec96ba69e.png)