DS3231 Real Time Clock with I2C Communications

DS3231 Real Time Clock with I2C Communications

DS3231 Real Time Clock with I2C Communications

A microcontrolled device is capable of very precise time control, especially on a human scale, but keeping it "on time" and therefore running, is very expensive in terms of consumption, so it is common to have a circuit that requires the time. a component capable of carrying out this task autonomously and maintaining very low consumption to be able to power it with a small battery for a long time. These devices are called real-time clocks (RTC)

External operation, that is, facing the user (or the circuit) of real-time clocks the very similar. If they also share communications, I2C is popular among the popular, can be generalized enough when describing its exploitation.

Just as they all share a typical application circuit diagram or similar communication, they also share a pair of (relative) drawbacks. On the one hand, his precision It is usually moderate, suitable for human-scale use but requiring calibration to remain within acceptable values. A characteristic value is usually around ±5 parts per million (ppm) which, very approximately, can correspond to ±5 minutes per year; admissible if a synchronization protocol is established. The drawback is that the precision drops sharply depending on the temperature variations and it is not uncommon for it to multiply by 10 (or more) in certain circumstances.

Like many other components, real-time clocks need a oscillator with which to operate (responsible for the precision I was talking about before). It is not that having an oscillator is an inconvenience in itself but it will be another component to add to the circuit that will need its space or, alternatively, another calculation to do to maintain the entire circuit with a certain base frequency.

There are other more obvious drawbacks, such as consumption and therefore battery duration that maintains the time and the configuration, which because it is something more universal (although logically irregularly distributed) is usually considered in the design of devices that incorporate RTC and is not a specific problem.

The real-time clock I describe in this article, the DS3231, solves the need for an external oscillator and the precision drawbacks by using an internal one and the technology of temperature-compensated crystal oscillator (TCXO) A table stored in the component's internal memory determines how to offset the time based on the temperature and operating time (age) of the device. With this technique, according to the data sheet, an accuracy of ±3.5 ppm is achieved in the industrial temperature range, from -40°C to +85°C, or ±2 ppm in the commercial temperature range.

Typically, real-time clocks include a small the memory in which to store common things in use, such as a couple of alarm hours. It is also not uncommon to need more memory for other, somewhat more specific time applications, which is why it is usually added in typical applications or even internally in some versions of integrated ones. For example, him DS3232 It is the same as the DS3231 in question but with 236 bytes SRAM which are also maintained, like the date and time, with the device's backup battery.

I said at the beginning that communication between circuits (I2C, for Inter-Integrated Circuit) is one of the most popular and most frequently present, although it is also true that in certain settings the communications SPI (Serial Peripheral Interface) They may be a better alternative; In such cases there are equivalent versions, for example the DS3234 with respect to the DS3231, which replace I2C by SPI.

Al measure temperature to compensate for the operation of the RTC, this device can also be used as a thermometer within the assembly itself. Although the values ​​it returns are presented in quarter-degree intervals, its precision is not very good, ±3°C according to data sheet. Taking into account that the temperature is going to be measured on the circuit board, along with components heating up without much control, this measure is sufficient in many cases, especially if what is interesting is measure trend and not just exact temperature in an instant. On the other hand, the temperature is always available to be consulted but is read from a register that is updated only every 64 seconds, enough to show evolution over a long period, insufficient to know the temperature of an instant.

RTC DS3231 Pinout

DS3231 RTC real-time clock pinout

Typical circuit for using the RTC DS3231

Application circuit for real-time clock DS3231

Post Comment

You May Have Missed