What is a Real-Time Clock (RTC) and Why are They Important in Computing?

real-time clock

What is a Real-Time Clock (RTC) and Why are They Important in Computing?

Key Points

  • A real-time clock (RTC) is an electronic device designed in the form of an integrated circuit to measure the passage of real-time.
  • The need for accurate timekeeping is often used as a trigger for specific events.
  • The reason independent power is necessary comes down to the functional use of RTC modules in laptops, computers, tablets, and other electronic devices.

What is a Real-Time Clock?: Complete Explanation

A real-time clock (RTC) is an electronic device designed in the form of an integrated circuit to measure the passage of real-time. Real-time clocks maintain accurate time measurements within an embedded system even when the main power is off. It counts hours, minutes, seconds, months, days, and even years. These modules can be found in nearly every electronic device especially when the device requires a form of accurate timekeeping.

Purpose of an RTC

The need for accurate timekeeping is often used as a trigger for specific events like turning the device on or sounding off an alarm clock. While some RTCs are designed to be installed into a device’s microcontroller unit (MCU), real-time clock integrated circuits (RTC ICs) run on an independent power source from the main device which allows for more accurate tracking and prevents data loss.

In the past, ICs were run off of lithium batteries. Newer systems use an auxiliary battery or supercapacitors. These newer RTC ICs are rechargeable and can be soldered to other devices. Most consumer-grade motherboards make use of a single battery to power the RTC.

When this battery is removed, the RTC is reset to its starting point. The important aspect to remember is that RTCs operate on a power source of their own rather than the power source used to run the main electronics.

The X470 is a stylish card that satisfy gamers who can get by without extensive overclocking options.

©Michael Wolf / CC BY-SA 3.0 – License

Power Source

The reason independent power is necessary comes down to the functional use of RTC modules in laptops, computers, tablets, and other electronic devices. As most devices are often powered on and off in continuous cycles, keeping track of data for process synchronization can be messy if the system clock is inaccurate in any way.

To prevent inaccurate time-keeping, the system clock in a device will check its timestamp against an RTC module. As the RTC module never shuts down, it keeps an accurate measure of time passed even when the main device is powered down.

With so much emphasis on the requirement of RTC modules in electronic devices, it’s important to note that RTC batteries aren’t immortal and usually last around three to five years depending on the chemical makeup. RTCs are essential in the devices they are installed in. If the battery fails, it has to be replaced to ensure your device continues to operate properly.

If the RTC module power source fails, the device user is typically informed with an error message on startup. Sometimes the only way to be aware of the battery failure is by finding oddities in your device’s system clock or by configuration corruptions.

The main benefits of an RTC are:

  • RTCs are more precise than software clocks.
  • The use of an independent power source improves overall power consumption and frequency stability.
  • By using an independent time-keeping module, it frees up resources on the main system for time-critical tasks.

Radio-based vs Software-based

There are two types of modern RTCs used in computers and other systems: radio-based RTCs and software-based RTCs. The difference between the devices is in how the RTC module receives clock information.

Radio-based RTCs

Many wireless technologies like cell phones and other LTE-enabled devices receive clock information by digital radio. This is essentially a method for checking the time sent out on ultra-low frequency radio transmissions by a national standards organization. This type of clock is often referred to as a radio clock.

While the RTC module does keep track of time passed independently, it uses the standards sent out across the internet or across radio waves to maintain standardized accuracy. This is excellent for updating clocks and time tracking following specific time zones or changes like daylight savings time.

Software-based RTCs

Software-based RTCs are more in desktop computer systems. Most computers have one or more hardware timers that gather signals from either quartz crystals or ceramic resonators. Unfortunately, they can be a little inaccurate when compared to absolute timing. To make up for the difference, the software is programmed to do the math that can make the output of these signals into an accurate real-time clock.

Like traditional clockmakers, real-time clock programmers have to adjust the software to make up for physical occurrences and inaccuracies that are rather frequent. Using some simple equations and two separate real-time counters to check against each other, the signals can be made into an accurate representation of the passage of real-time.

RTC is often confused for real-time computing and real-time counter.


Real-Time Clock: An Exact Definition

In the computing world, the term ‘clock’ is used for more than just tracking accurate time. Hardware clocks and clock cycles are often used to measure the speed of signals that happen between specific components on the motherboard. The term real-time clock is used as a way of avoiding confusion with hardware clocks. Hardware clocks are used to measure signals that govern functionality or computing power in an electronic device. Real-time clocks are used to measure the true passage of time in human recognizable units such as hours, seconds, minutes, days, and months.

The three-letter acronym for real-time clocks, RTC, is also shared with other computing terms like real-time computing and real-time counter. This often leads to confusion early on for beginners, especially as real-time counters are sometimes similarly used in software programming to real-time clocks. The best way to keep the terms easily separated and defined is to think of real-time clocks as physical computer chip modules usually embedded in the microcontroller unit while the other terms are used for software functions resulting from hardware performance.

Real-Time Clock Modules

As an essential component for computers, RTCs are produced as modules to be installed onto microcontroller units for electronic devices and computer motherboards. Most modern RTC modules have a rechargeable battery and can be soldered to the device it is meant to be installed on.

As a major computer component, you might expect to find them available for purchase. However, the reality is that most RTC module manufacturers produce the product for sale from business to business rather than to the general consumer. It has only been recently that RTC modules have been manufactured to be used in Arduino or raspberry pi projects in line with the growing open source development community.

Real-Time Clock Module Manufacturers

  • NXP Semiconductors
  • Dallas Semiconductors
  • STMicroelectronics
  • Micro Crystal
  • Petermann-Technik
  • New Japan Radio
  • Texas Instruments (TI)
  • Microchip Technology
  • Maxim Integrated
  • Epson Europe Electronics
  • Seiko NPC
  • Renesas Electronics
  • Diodes
  • Abracon

How Does a Real-Time Clock Work?

Real-time clocks have only a single purpose, to keep track of time. As described in the sections above, keeping track of the passage of time is essential to computer functionality and even essential in many simpler electronic devices. While it has only one function, the applications and uses for time tracking are countless. From random number generators to cybersecurity and beyond, time measurements and tracking of the current time are used in nearly every computing operation.

With a traditional watch or clock, the passage of time is kept through kinematic operations or the use of an RTC module, but how does it do it?

The answer is crystal oscillators. RTC on integrated circuits keeps track of time by counting the cycles of an oscillator. Typically, these oscillators are made of quartz crystal and run at 32.768 kHz. With a little software ingenuity, these modules can take the cycle time and account for any discrepancies caused by power source fluctuations or small changes to the cycle speed.

Many RTC modules employ a secondary tracking method to reference an external signal to lock into an accurate standardized time. This doesn’t negate the internal measurements but instead works together to keep the most accurate record. Software clocks used on smartphones are a perfect example of an RTC module that uses external signals to keep standardized time. If the smartphone loses connection to the external signal, it then falls back to counting the oscillator cycles.

Quartz crystal is a physical material. That means it is susceptible to aging and temperature changes that can affect the accuracy of the RTC module as a whole. Some modules have a built-in temperature compensation method to combat the effect of temperature changes and increase the oscillator’s overall precision. Most low-cost crystals used in PC hardware have a frequency tolerance of +/- 20 parts per million. That translates into a margin of error that can be up to 72 milliseconds per hour or 1.7 seconds per day.

How Do You Create a Real-Time Clock?

The fabrication process to create RTC modules is somewhat of a trade secret at semiconductor fabrication plants. However, you can create a real-time clock using a purchased RTC module for Arduino or Raspberry Pi projects. There is also the possibility of creating an entirely software-based real-time clock.

I wouldn’t recommend spending time on creating a software real-time clock as RTC modules are better for resource management and precision. Arduino projects, on the other hand, may have many uses for RTC modules. One poignant concept is creating an alarm clock.

If you’re looking to create an Arduino project that needs to keep the accurate measurement of time or uses time for specific functionality, you’re in luck. First, you’ll want to gather all the components you’ll need for the project. This list usually looks something like this:

  • Arduino UNO
  • USB 2.0 cable type A/B
  • Real-Time Clock Module (DS1307, DS3231)
  • CR2032 Battery
  • Jumper Wires

As you might be able to deduce from the list of necessary items, the process involves connecting the RTC module to the Arduino circuit using the module’s pin connectors. The CR2032 battery is intended to be the dedicated power source for the RTC module. Make sure that whichever module you purchase, you also purchase the correlating battery size.

Each RTC module will have a setlist of pins to connect to. The DS3231 has ten pins. Each pin is labeled accurately. The six pins sticking out of the model are:

  • 32K Pin – outputs the stable and accurate reference clock
  • SQW Pin – outputs a square wave at 1Hz, 4kHz, 8kHz, or 32kHz and can be handled through programming
  • SCL Pin – a serial clock pin for the I2C interface
  • SDA Pin – a serial data pin for the I2C interface
  • VCC Pin – power supply pin that can carry between 3.3V to 5.5V
  • GND Pin – electric ground pin

On the other side of the module, there are four normal use pins:

  • VCC
  • GND
  • SDA
  • SCL

The normal use pins are all that is required to connect the RTC module to your Arduino UNO. Using the jumper wires and a wiring diagram, connect the four required pins to the correct positions on the Arduino circuit board. Once the device is properly connected, the rest is done through programming. As I connect to predict the exact use case of the RTC module in your Arduino project, you’ll have to work out how to program the device or follow the instructions of a guide.

Where Did Real-Time Clock (RTC) Originate From?

Real-time clocks were initially introduced in specific computer designs such as IBM System/360s, PDP-8s, and Novas as a low-cost and more accurate time-keeping device than software implementations. The idea of an accurate clock used to help track computing operations and processes has been a base component of how computer designs have been made.

The advent of RTC modules started in 1988 by Dallas Semiconductors and was proliferated by the component production industry in China.

What Are the Applications of Real-Time Clocks (RTC)?

As stated in the previous sections, real-time clocks are used in a variety of electronics from computers and servers to consumer goods and internet of things devices. Any time a device needs to make use of accurate time and real-time, RTC modules are found.

Aside from the typical applications of RTC modules in computing, there are a few other categories that find good uses for RTC modules as well.

DIY Projects

Arduino and Raspberry-Pi home projects and automation often find the need to either track the passage of time or check on the current time. Of course, exactly how time is used depends on the home do-it-yourself project that it is used in.

Robotics Projects

In robotics, RTC modules can help calculate smooth and accurate motion as well as spacial detection. To program self-determining paths, the time it takes for objects in motions to get from one place to another is used to help program which path for automated robots to take. In some cases, RTC modules are used to modulate the speed of movement a robot should make.

Electrical/Electronic Projects

The primary use case of RTC modules in computing. Computers, servers, smartphones, tablets, digital watches, and a plethora of other electronic devices require the use of RTC modules to regulate important processes to maintain device functionality. Everything from base operations that create a user interface to managing precise calculations, computers find it useful to reference accurate time passages.

Examples of Real-Time Clocks (RTC) in the Real World

RTC Modules are everywhere. While the consumer market for the modules is significantly smaller than the B2B side of the industry, RTC modules can be found in every industry whether it is in the computers and servers used to the automated devices that help maintain facilities, or even just in simple wristwatches. Here are a few examples of specific RTC modules that can be found on the market. In the “An Exact Definition” section, you can find a list of RTC module manufacturers.

  • Maxim Integrated DS1307
  • Motorola MC146818
  • Dallas Semiconductor DS1387

Next Up…

What is a Real-Time Clock (RTC) and Why are They Important in Computing? FAQs (Frequently Asked Questions) 

What is a real-time clock?

A real-time clock is an electronic device designed to measure the passage of time.

What is the difference between a real-time clock and a hardware clock?

Real-time clocks measure time in human units. Hardware clocks measure the speed of cycle completion of computer components like the CPU.

What is the difference between a real-time counter and a real-time clock?

Real-time counters are the base form of a clock that specializes in generic, low-power timers on the low-frequency clock source. While a real-time clock is a function of a real-time counter, they are not the same. The clock requires a bit more calculation in reference to human-readable units of time, while counters only need to count in real-time.

Does Arduino have a real-time clock?

Arduino does not typically have an RTC module pre-installed, but an RTC module can be connected with jumper wires.

What does real-time mean?

Real-time refers to actual human time. In other words, it is happening at the same rate as actual time passes.

When is a real-time clock used?

Real-time clocks are used whenever a device needs to measure or check against the passage of time.

To top