Today, I will share how to add, use and interface the RTC DS3231 and DS3232 in Proteus 8 software. In Proteus 8, no IC DS3231 is found in the library, so I used IC DS3232 since it is very similar to the IC DS3231. The typical circuit is based on the RTC ZS-042 module, including IC DS3231 and I²C EEPROM 24C32. The basic circuit is used for simulation purposes in proteus only. A simple library (Rtc by Makuna) that makes interfacing DS1302, DS1307, DS3231, and DS3234 Real Time Clock modules was created by Michael C. Miller.
References:
Components:
- Arduino UNO R3
- Cell
- Resistor
- LED
- IC DS3232 or DS3231
- IC 24C32A
- Diode
Steps (Typical Circuit):
- Open your Proteus software and add ARDUINO UNO R3, CELL, RESISTOR, LED, DS3232, 24C32A, VIRTUAL TERMINAL, and DIODE components to the workspace for the typical circuit.
- Connect VBAT to diode negative and positive to a resistor (200Ω). Then, the resistor (200Ω) is connected to the POWER. Next, connect POWER to LED positive to the POWER and negative to a resistor (1kΩ). The resistor (1kΩ) is connected to the GND and VBAT to cell positive and negative to GND.
- Connect DEFAULT to the IC DS3232 pins SCL, SDA, 32KHz, and INT/SQW. Edit DEFAULT of IC DS3232 string according to the pins name of IC DS3232. Then, connect the pull-up resistor (4.7kΩ) to the IC DS3232 pins SCL, SDA, 32KHz, and INT/SQW.
- Connect DEFAULT to the IC 24C32A SCL and SDA pins. Edit DEFAULT string of SCK and SDA to the SCL and SDL. Then, connect the WP pin to the GND. Then, connect the pull-up resistor (4.7kΩ) to the IC 24C32A pins A0, A1, and A2.
- Connect switch (N/O) to the IC 24C32A pins A0, A1, and A2. Then connect the switch to the GND.
- Connect DEFAULT to the A4, A5, and 2 pins of the Arduino UNO R3. Edit DEFAULT string Arduino UNO R3 pins A4, A5, and 2 to the SDA, SCL, and SQW. Lastly, connect VIRTUAL TERMINAL RXD and TXD to the ARDUINO UNO R3 pins 1 and 0.
- Open Arduino IDE and go to Sketch > Include Library > Manage Libraries. Type 'Rtc by Makuna' on the search box and install it.
- Go to File > Examples > Rtc by Makuna > DS3231_Simple. Verify and copy the Hex file, then paste it into the Project file Arduino board.
- Start the simulation, and the VIRTUAL TERMINAL will display the date, time, and temperature. For the first time, you will see VIRTUAL TERMINAL print "RTC lost confidence in the DateTime!". It will automatically update the date, time, and temperature every 10 seconds.
- To change the temperature in simulation, go to IC DS3232 > Double Click > Nominal Temperature > Change to your desired temperature > Press OK.
- Start the simulation and see the temperature change to the desired temperature.
Steps (Basic Circuit):
- For basic circuit simulation, remove all components except Arduino UNO R3 with DEFAULT pins, Virtual Terminal, and IC DS3232 with DEFAULT pins.
- Start the simulation, and the VIRTUAL TERMINAL will print out the same as the typical circuit simulation.
Video:
If you have any suggestions, please write in the comment section. Thank you for your time 👷.
No comments:
Post a Comment