Difference between revisions of "BPI RTC real time Module"

From Banana Pi Wiki
Jump to: navigation, search
(Typical Application)
Line 41: Line 41:
 
How to use on banana pi BPI-M1
 
How to use on banana pi BPI-M1
  
![](1.png)
+
[[File:1.png]]
  
 
==More information==
 
==More information==

Revision as of 04:55, 14 May 2018

  1. BPI RTC real time Module

![](BPI-A-RTC 1.JPG)

    • Product Specification:**

![](sepc.png)

Produce Overview:

Overview

The RTC module is specifically designed for BananaPi. It communicated with BananaPi through I2C bus. There is a Maxim DS3231 and 0.2uF SuperCapacitor on the board to keep the real time for a long time after the BananaPi has power off.

Produce Features:

  • 1. Use Maxim DS3231 chip
  • 2. 0.2uF Super Capacitor
  • 3. Can be operated by a shell

hardware

Product Specification

Sepc.png

Port

  • Banana Pi connection port,also can use on raspberry pi.

Product Parameters

  • 1. Accuracy ±2ppm from 0°C to +40°C
  • 2. Battery Backup Input for Continuous Time keeping
  • 3. Real-Time Clock Counts Seconds, Minutes,Hours, Day, Date, Month, and Year with Leap Year Compensation Valid Up to 2100
  • 4. Digital Temp Sensor Output: ±3°C Accuracy
  • 5. Two Time-of-Day Alarms

Typical Application

  • 1. Smart home
  • 2. Utility Power Meters
  • 3. Telematics

How to use on banana pi BPI-M1

1.png

More information

The DS3231 is a low-cost, extremely accurate I2C realtime clock (RTC) with an integrated temperature compensated crystal oscillator (TCXO) and crystal.The device incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the piece-part count in a manufacturing line. The DS3231 is available in commercial and industrial temperature ranges, and is offered in a 16-pin, 300-mil SO package.

The RTC maintains seconds, minutes, hours, day, date,month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format

with an AM/PM indicator. Two programmable time-of day alarms and a programmable square-wave output are provided. Address and data are transferred serially through an I2C bidirectional bus.

A precision temperature-compensated voltage reference and comparator circuit monitors the status of VCC to detect power failures, to provide a reset output, and to automatically switch to the backup supply when necessary. Additionally, the RST pin is monitored as a pushbutton input for generating a µP reset.

Schematic diagram

![](2.png)

How to use RTC module on BPI-M3

OS: BPI-M3 Ubuntu15.10 (Kernel3.4)

Version: 1.0 HDMI

![](connect1.jpg)

Step 1:

sudo su
sudo apt-get install i2c-tools```

Step 2:

Check the RTC (DS3231) device to see if it's on track.(address 0x68)

(I2c port number for M3: 2 )

i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Step 3:

Input RTC (DS3231) address

echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-2/new_device

Step 4 :

RTC (DS3231) Module is in /dev/rtc1

hwclock -w -f /dev/rtc1 ==> Write the system time to file in /dev/rtc1
hwclock -r -f /dev/rtc1 ==> Read the time in /dev/rtc1
hwclock -s -f /dev/rtc1 ==> Read the time in /dev/rtc1 and write the system time to file as well.

Demo procedure:

  • 1. Check System Time (Video_Demo:1m 11s)
  • 2. Write the system time to file in dev/rtc1 (Video_Demo:1m 32s)
  • 3. Check the time in /dev/rtc1 (Video_Demo:1m 39s)
  • 4. Modify the system time (Video_Demo:1m 58s)
  • 5. Check System Time. (Video_Demo:2m 22s)
  • 6. Read the time in dev/rtc1 and write the system time to file as well. (Video_Demo:2m 26s)
  • 7. Check System Time. (Video_Demo:2m 30s)

Video Demo on youtube:

https://www.youtube.com/watch?v=R4tbg8OXw2k

link to forum:

http://forum.banana-pi.org/t/bpi-m3-bpi-rtc-ds3231-module-and-how-to-use/1092/1