Tiny RTC Real-Time Clock Module (DS1307 / DS3231 + EEPROM)

Here's a fact that surprises a lot of people: a microcontroller has no idea what time or date it is.

Connectivity12 blocksMicroPythonC++

Here's a fact that surprises a lot of people: a microcontroller has no idea what time or date it is. Every time it loses power, it forgets everything — there's no built-in calendar the way a phone or computer has. The Tiny RTC module fixes that: it's a tiny chip with its own coin-cell battery, so it keeps ticking the real date and time even while your board is completely unplugged.


1. Real-World Uses

Anything that needs to know when something happened, not just that it happened, needs a real-time clock:

  • Data logging with real timestamps — a temperature log is much more useful when each reading says "2026-08-25 14:30
    " instead of just "reading #4,281."
  • Scheduled actions — water the plants at 8
    AM every day, or turn on a light at sunset, by checking the current hour against a target.
  • Attendance / access-control systems — recording exactly when a badge was scanned or a door opened.
  • Anything that must survive a power cut — since the coin-cell battery keeps the clock ticking even with the main board completely unplugged, you never lose track of the correct time.

2. Hardware Specifications & Addresses

The Tiny RTC module combines three things on one small board:

  • RTC chip: a DS1307 or DS3231 Real-Time Clock, at a fixed I2C address 0x68.
  • EEPROM chip: an AT24C32 4KB memory chip, at a fixed I2C address 0x57 — handy for storing small amounts of data that also needs to survive a power cut.
  • Battery: a CR2032 3V coin cell, which is what actually keeps the clock running when the board loses power.

[!NOTE] Both chip addresses are fixed — there are no address-select pins like the LCD I2C backpack (10.3) has. That means you can only use one Tiny RTC module per I2C bus; a second one would collide on the same addresses.


3. How the Clock Stores Time (BCD Format)

The RTC chip stores each part of the date/time (seconds, minutes, hours, etc.) as one byte in a format called Binary Coded Decimal (BCD) — instead of storing the number directly, it stores each decimal digit in its own 4-bit half of the byte. For example, the number 42 is stored as the byte 0x42, not the byte 42 (which would be 0x2A in normal binary). Converting between the two is simple arithmetic:
Decimal=((BCD byte≫4)×10)+(BCD byte&0x0F)\text{Decimal} = ((\text{BCD byte} \gg 4) \times 10) + (\text{BCD byte} \mathbin{\&} 0x0F)
Every block below that reads or sets a time value does this conversion for you automatically — you always work with normal decimal numbers.


4. Supported Blockly Blocks (12 Blocks)

Drawing the blocks…

5. Simulator Behavior

[!IMPORTANT] There's no simulated Tiny RTC device on the I2C bus, so every read comes back as zero bytes — but nothing crashes. OMS's Circuit Simulator has real, working I2C bus emulation (see 7.7), but only for devices that actually have a simulated peripheral registered — the OLED, BME280, and MPU6050. There's no RTC entry in that registry, so:

  • RTC Time will report "2000-01-01 00:00:00" — every register reads back as 0x00, and bcd2dec(0) = 0, with the year field's + 2000 offset producing the year 2000.
  • Set Time, and all 7 individual field/EEPROM blocks, run without error, but a subsequent read never reflects anything you wrote — there's no real chip storing it. All blocks generate fully correct, real code for actual hardware with a genuine Tiny RTC module attached — RTC and EEPROM projects need real, uploaded hardware to test meaningfully, not the Simulate button.
Tiny RTC Real-Time Clock Module (DS1307 / DS3231 + EEPROM) — OMS Parts