You are currently viewing DS3231 Library for Proteus: Free RTC Module (ZS-042)
DS3231 Library for Proteus

DS3231 Library for Proteus: Free RTC Module (ZS-042)

This free DS3231 library for Proteus adds the blue DS3231 RTC module (ZS-042) to Proteus 8: the real-time clock board with the DS3231 chip, the AT24C32 EEPROM, the coin cell holder and the 6-pin header 32K, SQW, SCL, SDA, VCC, GND that comes in every Arduino kit.

Proteus has the bare DS1307 and DS3232 chips, but no DS3231 and no RTC module. This DS3231 Proteus model answers on I2C exactly like the real chip, so your Arduino sketch reads the date, time and temperature with the RTClib library, sets alarms that pull the SQW pin low, makes a square wave, and stores data in the EEPROM on the module.

In short

With the DS3231 library for Proteus installed, place DS3231 RTC MODULE, wire SDA to A4 and SCL to A5 of an Arduino UNO (the pull-ups are on the module), and run. The clock starts at your PC’s date and time and then runs with the simulation time.

DS3231 library for Proteus: ZS-042 RTC module
Figure: The DS3231 RTC module in Proteus.

DS3231 Library for Proteus: Features

FeatureDS3231 Proteus model
PartDS3231 RTC MODULE: the ZS-042 board with DS3231, AT24C32 EEPROM, battery holder and power LED (on while the simulation runs)
Real clockSeconds to years in BCD, 12 or 24 hour mode with AM / PM, day of the week, leap years and the century bit. A 10 second simulation is 10 seconds on the clock
Start timeYour PC’s clock when the simulation starts, or any date and time you type in the properties
Backup batteryWith the battery the clock keeps running. Without it the module starts at 2000-01-01 and lostPower() returns true, like a brand new module
Two alarmsAlarm 1 (seconds, minutes, hours, day or date) and alarm 2 (minutes, hours, day or date) with all match modes. The SQW pin goes LOW when an alarm fires, for an Arduino interrupt
Square waveSQW gives 1 Hz, 1.024 kHz, 4.096 kHz or 8.192 kHz, and the 32K pin gives 32.768 kHz
TemperatureThe DS3231 temperature register in 0.25 °C steps. You set the chip temperature in the properties
AT24C32 EEPROM4 KB on the same I2C bus (address 0x57), with 32-byte page writes, write time and ACK polling
HintsA decimal value where the chip wants BCD, an alarm enabled while SQW is a square wave, or a wrong EEPROM address: a warning in the Proteus log says what to change
BoardsArduino UNO, Nano, Mega, ESP32 and any other microcontroller with I2C

DS3231 Proteus Model: Pins and Wiring

Module pinWhat it doesArduino UNO (example below)
32K32.768 kHz output (open drain, pull-up on the module)not used
SQWAlarm interrupt (LOW when an alarm fires) or square wave outputD2
SCLI2C clockA5
SDAI2C dataA4
VCCSupply, 3.3 V or 5 V5V
GNDGroundGND

In this RTC module Proteus part the pins are in the same order as the header of the real board. Like the real ZS-042, the module has 4.7 k pull-up resistors on SCL, SDA, SQW and 32K, so you do not need to add any. On an Arduino Mega use pins 20 (SDA) and 21 (SCL), on an ESP32 GPIO 21 (SDA) and 22 (SCL).

Two chips on one I2C bus

The module answers at two I2C addresses: the DS3231 clock at 0x68 and the AT24C32 EEPROM at 0x57. An I2C scanner sketch finds both, just like on the real board.

Example: Arduino DS3231 Clock and Alarm in Proteus

This Arduino DS3231 Proteus example uses an Arduino UNO. Every second it prints the date, the day, the time and the DS3231 temperature on a Virtual Terminal. Alarm 1 fires every minute when the seconds reach 30: the DS3231 pulls SQW LOW, the UNO sees it on D2, prints >>> ALARM <<< and lights its L LED for 5 seconds.

  1. Place DS3231 RTC MODULE, an Arduino UNO and a Virtual Terminal.
  2. Wire SDA to A4, SCL to A5, SQW to D2, VCC to 5 V and GND to GND.
  3. Terminal RX on the UNO TX (9600 baud).
  4. In the Arduino IDE, install the RTClib library by Adafruit (Tools → Manage Libraries, search RTClib).
DS3231_Test.inoArduino
// DS3231 RTC module test for the ElectronicsTree Proteus model (ETDS3231.DLL)
//
// Circuit (Arduino UNO):
//   DS3231 module: VCC -> 5 V, GND -> GND, SDA -> A4, SCL -> A5, SQW -> D2
//   The module has its own pull-up resistors on SDA, SCL and SQW.
//   Virtual Terminal on TX (9600 baud).
//   The UNO's own L LED (D13) lights for 5 seconds when the alarm goes off.
//
// Library: RTClib by Adafruit (Tools -> Manage Libraries, search RTClib).

#include <RTClib.h>

RTC_DS3231 rtc;

const int SQW_PIN = 2;
const int LED = 13;

const char* DAYS[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };

int lastSecond = -1;
unsigned long ledOff = 0;


void setup() {

  Serial.begin(9600);
  pinMode(SQW_PIN, INPUT_PULLUP);
  pinMode(LED, OUTPUT);

  Serial.println();
  Serial.println(F("================================"));
  Serial.println(F("     DS3231 RTC MODULE TEST"));
  Serial.println(F("================================"));

  if (!rtc.begin()) {
    Serial.println(F("DS3231 not found: check SDA / SCL"));
    while (1);
  }

  if (rtc.lostPower()) {
    Serial.println(F("RTC lost power: time set from the sketch"));
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }

  rtc.disable32K();                    // the 32K pin is not used
  rtc.writeSqwPinMode(DS3231_OFF);     // SQW pin = alarm output
  rtc.clearAlarm(1);
  rtc.clearAlarm(2);
  rtc.disableAlarm(2);

  // alarm 1: every minute when the seconds are 30
  rtc.setAlarm1(DateTime(2000, 1, 1, 0, 0, 30), DS3231_A1_Second);
  Serial.println(F("Alarm: every minute at :30"));
  Serial.println();
}


void loop() {

  DateTime now = rtc.now();

  if (now.second() != lastSecond) {
    lastSecond = now.second();

    char text[32];
    sprintf(text, "%04d-%02d-%02d %s %02d:%02d:%02d",
            now.year(), now.month(), now.day(), DAYS[now.dayOfTheWeek()],
            now.hour(), now.minute(), now.second());

    Serial.print(text);
    Serial.print(F("   "));
    Serial.print(rtc.getTemperature());
    Serial.println(F(" C"));
  }

  // the alarm pulls SQW low until it is cleared
  if (digitalRead(SQW_PIN) == LOW) {
    rtc.clearAlarm(1);
    Serial.println(F(">>> ALARM <<<"));
    digitalWrite(LED, HIGH);
    ledOff = millis() + 5000;
  }

  if (ledOff && millis() > ledOff) {
    digitalWrite(LED, LOW);
    ledOff = 0;
  }

  delay(100);
}

Export the .hex file (Sketch → Export Compiled Binary), load it into the UNO and press Play. The terminal shows a new line every second, for example 2026-11-30 Mon 18:57:27 25.00 C, starting at your PC’s time. When the seconds reach 30, >>> ALARM <<< appears and the L LED lights. Set Backup Battery Fitted to No and the sketch prints RTC lost power and sets the clock to the time the sketch was compiled, as on a new module.

New to simulating an Arduino? Our Arduino UNO R3 library for Proteus shows how to load a sketch, and the virtual serial terminal shows the messages.

Arduino UNO with the DS3231 RTC module in Proteus
Figure: Arduino UNO with the DS3231 RTC module and a Virtual Terminal in Proteus.
Try it: set the start time

Double-click the module and type 2026-12-31 23:59:50 as the start time. Run, and after 10 seconds the clock rolls over to 2027-01-01 00:00:00, day, month and year together. Try 2028-02-28 23:59:55 to see the leap day.

DS3231 Library for Proteus: Properties

Double-click the module to change it:

PropertyWhat it doesDefault
Start TimePC = your PC’s clock when the simulation starts. Or a fixed time: YYYY-MM-DD HH:MM:SS, or HH:MM:SS for todayPC
Backup Battery FittedYes: the coin cell kept the clock running. No: first power-up, the clock starts at 2000-01-01 00:00:00 and lostPower() is trueYes
Chip Temperature (°C)What the DS3231 temperature sensor reads, -40 to 85, in 0.25 °C steps25
AT24C32 EEPROM FittedThe 4 KB EEPROM on the module. No = only the clock answersYes
EEPROM I2C Address0x50 to 0x57, set by the A0, A1, A2 pads (open = 0x57)0x57
Simulate 32K OutputNo = the 32K pin stays still, and the simulation runs fasterYes

Under Advanced Properties: the module pull-ups, the EEPROM write time (5 ms) and a log of the register writes, alarms and EEPROM writes in the simulation log.

DS3231 Proteus Troubleshooting

If the Arduino reads nothing or a strange time, check these first. The DS3231 library for Proteus also writes a hint in the simulation log for the usual mistakes.

What you seeCause and fix
DS3231 not foundSDA and SCL are swapped or not connected. On the UNO, SDA is A4 and SCL is A5
The time is wrong at the startThe start time comes from the properties: PC or the time you typed. With the battery set to No, the sketch’s adjust() sets it
Odd values after setting the timeThe DS3231 stores BCD: 59 seconds is 0x59, not 59. RTClib does this for you; with your own Wire code, convert to BCD
The alarm never fires on SQWSQW is still a square wave. Call rtc.writeSqwPinMode(DS3231_OFF) before setAlarm1()
The alarm fires only onceThe alarm flag stays set until you clear it with rtc.clearAlarm(1), and SQW stays LOW until then
Temperature below 0 °C reads about 250RTClib’s getTemperature() does this on the real chip too: it adds 256 below 0 °C. The DS3231 registers are right
The simulation runs slowlyThe 32K pin switches 65,536 times a second. Set Simulate 32K Output to No if you do not use it

Download the DS3231 Library for Proteus

The zip file of the DS3231 library for Proteus holds the model ETDS3231.DLL and the library ElectronicsTree[DS3231].LIB with the part DS3231 RTC MODULE.

Download
2 Downloads

Installing it takes two minutes (see the steps right below). Looking for more parts? Browse all our free Proteus libraries.

We’re always looking to expand our library collection based on what our community needs. If you’re looking for a specific Arduino module, sensor, or component that we don’t currently offer, we’d love to hear from you!

Reach out to us at help@electronicstree.com with your requests. We prioritize new library development based on community demand, so your suggestion could be our next addition.

Join the official WhatsApp channel of ElectronicsTree to stay updated with the latest electronics tutorials, Proteus libraries, Arduino projects, and simulation resources.

How to Install the DS3231 Library for Proteus 8

New to adding libraries? Our guide how to install a library in Proteus 8 shows where the Proteus folders are.

  1. Close Proteus.
  2. Copy the files into the Proteus data folder, normally C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\DATA
    • ETDS3231.DLL goes into DATA\MODELS
    • ElectronicsTree[DS3231].LIB goes into DATA\LIBRARY
    Windows asks for administrator rights because the folder is under Program Files: click Continue.
  3. Start Proteus, open Pick Devices (press P) and search for DS3231. The part is in the category Sensor and Modules.
Tested with 8.17 SP2

The DS3231 library for Proteus is a library, not Proteus itself: the software comes from Labcenter Electronics, who also offer a free demo on their website.

Frequently Asked Questions

Is there a DS3231 library for Proteus?

Yes. This free DS3231 library for Proteus adds the ZS-042 DS3231 RTC module to Proteus 8, with the real clock registers, alarms, square wave, temperature and the AT24C32 EEPROM.

How do I connect the DS3231 to an Arduino in Proteus?

Connect SDA to A4, SCL to A5, VCC to 5 V and GND to GND on an Arduino UNO. The pull-up resistors are on the module. For alarms, also connect SQW to an input pin such as D2.

What time does the DS3231 show in the simulation?

By default it starts at your PC’s date and time when you press Play, then counts with the simulation time. You can type any start date and time in the properties.

Does the DS3231 Proteus model work with RTClib?

Yes. The sketch on this page uses Adafruit RTClib: begin, adjust, now, lostPower, getTemperature, alarms, the SQW modes and the 32K output all work as on the real module.

Can I use the EEPROM on the DS3231 module in Proteus?

Yes. The AT24C32 answers at I2C address 0x57 with 4 KB of memory. Write and read it with the Wire library or an AT24C32 library. Its contents are not saved between runs.

Does the DS3231 library work with an ESP32 in Proteus?

Yes. The module is a normal I2C device, so it works with any board that has I2C, at 3.3 V or 5 V.

Is this DS3231 Proteus library free?

Yes. Download the DS3231 library for Proteus from this page. The zip holds the model DLL and the library.

More Libraries for Proteus

Like the DS3231 library for Proteus? Try these next:

Conclusion

This DS3231 library for Proteus lets you build and test your Arduino clock, timer or data logger before the hardware is on the desk: the ZS-042 RTC module with a real-time clock that starts at your PC’s time, two alarms on SQW, a square wave, the temperature sensor and the AT24C32 EEPROM, with hints for the usual mistakes.

Questions, or a module you want next? Write them in the comments!

Leave a Reply