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.
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: Features
| Feature | DS3231 Proteus model |
|---|---|
| Part | DS3231 RTC MODULE: the ZS-042 board with DS3231, AT24C32 EEPROM, battery holder and power LED (on while the simulation runs) |
| Real clock | Seconds 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 time | Your PC’s clock when the simulation starts, or any date and time you type in the properties |
| Backup battery | With 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 alarms | Alarm 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 wave | SQW gives 1 Hz, 1.024 kHz, 4.096 kHz or 8.192 kHz, and the 32K pin gives 32.768 kHz |
| Temperature | The DS3231 temperature register in 0.25 °C steps. You set the chip temperature in the properties |
| AT24C32 EEPROM | 4 KB on the same I2C bus (address 0x57), with 32-byte page writes, write time and ACK polling |
| Hints | A 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 |
| Boards | Arduino UNO, Nano, Mega, ESP32 and any other microcontroller with I2C |
DS3231 Proteus Model: Pins and Wiring
| Module pin | What it does | Arduino UNO (example below) |
|---|---|---|
| 32K | 32.768 kHz output (open drain, pull-up on the module) | not used |
| SQW | Alarm interrupt (LOW when an alarm fires) or square wave output | D2 |
| SCL | I2C clock | A5 |
| SDA | I2C data | A4 |
| VCC | Supply, 3.3 V or 5 V | 5V |
| GND | Ground | GND |
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).
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.
- Place DS3231 RTC MODULE, an Arduino UNO and a Virtual Terminal.
- Wire SDA to A4, SCL to A5, SQW to D2, VCC to 5 V and GND to GND.
- Terminal RX on the UNO TX (9600 baud).
- In the Arduino IDE, install the RTClib library by Adafruit (Tools → Manage Libraries, search
RTClib).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
// 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.
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:
| Property | What it does | Default |
|---|---|---|
| Start Time | PC = your PC’s clock when the simulation starts. Or a fixed time: YYYY-MM-DD HH:MM:SS, or HH:MM:SS for today | PC |
| Backup Battery Fitted | Yes: the coin cell kept the clock running. No: first power-up, the clock starts at 2000-01-01 00:00:00 and lostPower() is true | Yes |
| Chip Temperature (°C) | What the DS3231 temperature sensor reads, -40 to 85, in 0.25 °C steps | 25 |
| AT24C32 EEPROM Fitted | The 4 KB EEPROM on the module. No = only the clock answers | Yes |
| EEPROM I2C Address | 0x50 to 0x57, set by the A0, A1, A2 pads (open = 0x57) | 0x57 |
| Simulate 32K Output | No = the 32K pin stays still, and the simulation runs faster | Yes |
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 see | Cause and fix |
|---|---|
DS3231 not found | SDA and SCL are swapped or not connected. On the UNO, SDA is A4 and SCL is A5 |
| The time is wrong at the start | The 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 time | The 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 SQW | SQW is still a square wave. Call rtc.writeSqwPinMode(DS3231_OFF) before setAlarm1() |
| The alarm fires only once | The alarm flag stays set until you clear it with rtc.clearAlarm(1), and SQW stays LOW until then |
| Temperature below 0 °C reads about 250 | RTClib’s getTemperature() does this on the real chip too: it adds 256 below 0 °C. The DS3231 registers are right |
| The simulation runs slowly | The 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.
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.
- Close Proteus.
- Copy the files into the Proteus data folder, normally
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\DATAETDS3231.DLLgoes intoDATA\MODELSElectronicsTree[DS3231].LIBgoes intoDATA\LIBRARY
Program Files: click Continue. - Start Proteus, open Pick Devices (press P) and search for
DS3231. The part is in the category Sensor and Modules.
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:
- OLED library for Proteus: show the time on a display
- BME280 library for Proteus: add temperature, humidity and pressure on the same I2C bus
- Keypad library for Proteus: set the time or an alarm with keys
- Arduino relay module library for Proteus: switch a lamp or a pump at a set time
- Serial real-time clock for Proteus: our simple clock module that sends the time over UART
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!