Demand Peripherals     Robotics and Automation Made Easy

RTC: Real-Time Clock

The Real-Time Clock peripheral and battery-backed RTC card let you keep time when your device is powered off. When used with one of the DPI power distribution cards, the RTC peripheral and card let you set a wake time at which power is restored to your system.

 

Hardware:

The RTC peripheral must be paired with the RTC card. The card contains a NXP PCF2123 RTC chip and a CR2032 battery. You can set and get time from the card, and you can enable and set a wakeup time. An open-drain output on the card goes low when the alarm time is reached. This output is meant to connect to the remote input on a power distribution card. The combination of the RTC card and PD25 card lets you power down your robot and have it wake up at a later time.

More information about the RTC and power distribution cards can be found here cards/rtc.html, here cards/pd25.html, and here: cards/pd15.html.

 

Resources:

time : the current time.
The time resource is the current time in the RTC chip. Use pcset to set the time and pcget to retrieve it. The time format is:

    Weekday Month Monthday Hour24:Minute:Second TimeZone Year
For example:
    Sat Sep 10 14:42:00 PDT 2018

alarm : wake time.
The alarm resource is the time at which the alarm output on the RTC card will go low. The alarm output goes low only if the state is 'enabled'. The format for the alarm time is the same as that of the time resource. This resource works with both pcset and pccat.

state : state of the alarm.
The state resource lets you enable or disable the alarm. Using pcset you can set the state to

  off     : the alarm output is floating
  on      : the alarm output if forced low
  enabled : the system is armed and waiting for an alarm
Reading state allows the additional state of:
  alarm   : an alarm occurred and the alarm output is low

 

Examples:

Set the date and time on the RTC card from system time

        pcset rtc time `date --rfc-3339='seconds' -u`
Set system date from RTC clock time
        sudo date --rfc-3339='seconds' -u -s `pcget rtc time`
Set the alarm time and enable the alarm.
        pcset rtc alarm 11 02:00:00
        pcset rtc state enabled  # machine turns off