Skip to main content

rtc_pcf8523

Low-power real-time clock with battery switchover and programmable clockout.

Overview

The rtc_pcf8523 node interfaces with the PCF8523 low-power real-time clock module over I2C. The PCF8523 features automatic battery switchover circuitry, a programmable clockout pin, and extremely low battery current draw (150 nA typical), making it ideal for battery-powered and low-energy IoT applications. It is commonly found on Adafruit and other popular RTC breakout boards.

150nA
Battery Current
I2C
Interface
Auto
Battery Switchover
3.3V
Logic Level

Properties

Property Type Default Options Description
i2cBus select "/dev/i2c-1" /dev/i2c-0, /dev/i2c-1 I2C bus device path
address string "0x68" - I2C device address
use24Hour boolean true - Use 24-hour time format instead of 12-hour
batteryLowInt boolean false - Enable interrupt on battery low condition
clockoutFreq select "off" off, 32768hz, 16384hz, 8192hz, 4096hz, 1024hz, 32hz, 1hz Programmable clockout frequency on CLKOUT pin

Output Format

msg.payload
{
  "year": 2026,
  "month": 2,
  "day": 12,
  "hour": 14,
  "minute": 30,
  "second": 45,
  "dayOfWeek": 4,
  "batteryLow": false,
  "timestamp": 1771080645
}

Note: The batteryLow flag is read from the PCF8523 control register and indicates when the backup battery voltage drops below the threshold. Monitor this field to proactively replace batteries before timekeeping is lost.

Wiring / Connection Diagram


  Raspberry Pi              PCF8523 Module
  +-----------+            +---------------+
  |           |            |               |
  |  3.3V (1) +------------+ VCC           |
  |           |            |               |
  |  SDA  (3) +------------+ SDA           |
  |           |            |               |
  |  SCL  (5) +------------+ SCL           |
  |           |            |               |
  |  GND  (6) +------------+ GND           |
  |           |            |               |
  |  GPIO (7) +----opt-----+ INT/CLKOUT    |
  |           |            |               |
  +-----------+            +---------------+
                            |   CR1220   |
                            |  (backup)  |
                            +------------+

  INT/CLKOUT pin is optional:
  - Used for clockout frequency output
  - Battery low interrupt signal
        

Example Use Cases

Battery Health Monitor

Monitor the PCF8523 battery status and send alerts when the backup battery is low.

inject (1hr) -> rtc_pcf8523 -> function -> notification
// Function node: check battery status
var rtc = msg.payload;

if (rtc.batteryLow) {
  msg.payload = {
    alert: "PCF8523 battery low",
    lastTime: rtc.year + "-" + rtc.month + "-" + rtc.day
      + " " + rtc.hour + ":" + rtc.minute,
    action: "Replace CR1220 battery"
  };
  return msg;
}
return null;

Solar-Powered Data Logger

Timestamp sensor readings in a solar-powered deployment where power conservation is critical.

[
  {
    "id": "sensor-trigger",
    "type": "inject",
    "repeat": "300",
    "payload": ""
  },
  {
    "id": "rtc-read",
    "type": "rtc_pcf8523",
    "i2cBus": "/dev/i2c-1",
    "address": "0x68",
    "use24Hour": true,
    "batteryLowInt": true
  },
  {
    "id": "format-log",
    "type": "function",
    "func": "msg.timestamp = msg.payload.timestamp;\nmsg.batteryOk = !msg.payload.batteryLow;\nreturn msg;"
  },
  {
    "id": "store",
    "type": "file",
    "filename": "/var/log/sensor-data.csv"
  }
]

1Hz Clockout for Precise Timing

Use the CLKOUT pin to generate a 1Hz reference pulse for external timing circuits.

// Configure PCF8523 with 1Hz clockout
// The CLKOUT pin will output a precise 1Hz square wave
// that can be connected to a GPIO interrupt for
// accurate one-second tick events.

{
  "id": "rtc-config",
  "type": "rtc_pcf8523",
  "i2cBus": "/dev/i2c-1",
  "address": "0x68",
  "clockoutFreq": "1hz"
}

Common Use Cases

Solar IoT Deployments

Ultra-low battery draw ideal for solar-powered remote sensors

Battery-Backed Systems

Automatic battery switchover preserves time during power loss

Reference Clock Source

Generate precise clock signals from 1Hz to 32.768kHz

Battery Monitoring

Built-in low-battery detection with optional interrupt output

Related Nodes