Inside troubleshooting: Time Synchronization for IoT devices

Tags: IoT
A picture of Muhammad Nabeel Rahim
Written by
Muhammad Nabeel Rahim

In IoT, there are many applications where the hardware is deployed remotely and powered only by a battery. To increase the lifetime, IoT hardware cannot be on all the time. Therefore, a mechanism needs to be developed where the hardware is powered only at regular intervals to transmit data and then turned off again to save power.

A real time clock or RTC is a power saving component used to track time. RTC components consume little power and their purpose is to measure time so that the device can be woken up at user-defined intervals.

To track the time in the RTC component on an IoT device, the time value must first be retrieved from the user and set up in the RTC component. Some of the sources to get this value are:

  1. Network Identity and Time Zone (NITZ)

  2. GSM location

  3. Network Time Protocol (NTP) Server

In this article, we report on one of our solutions where a customer was having problems updating the RTC time by requesting NITZ data from the network. Also, we show some other methods to update the time.

The problem

One of our customers needed to update the RTC time in their SIMCOM800C IoT module and tried to get the time value using the +PSUTZZ command, which requests NITZ data from the connected network.

The customer reported that he could occasionally get this value from the network, but sometimes the network would not return the value. We requested timestamps from the customer and investigated further with data from 1oT Terminal.

Cause of issue

When we examined the pattern on 1oT Terminal from the reported timestamps, we found that the devices were connected to different networks. This meant that some networks were providing the RTC time normally and others were not.

Further investigation of the above information and the data available in various device manuals revealed that the time is updated by requesting NITZ data from the networks according to the choice of the connected network. Some networks provide this value, others do not.

Suggestion to the customer

We found that one of the more reliable ways to update the time is to read the location of the network tower. For this purpose, the IoT device must be connected to a network and a data session must be opened. Then, the command AT +CIPGSMLOC could be used to get the time from the connected cell tower.

The customer tested this command in his SIMCOM800C, and he was able to update the RTC time in his IoT device.

Suggestions to the IoT community

If you need to update the time in your IoT devices, there are several ways to do it depending on the IoT modules you are using. You should test different options to see which one works best for your IoT device.

Network Identity and Time Zone (NITZ): For some of the SIMCOM, ublox, and Quectel modules, the time zone can be automatically updated by requesting the NITZ data from the network using the AT commands PSUTTZ, CTZU, and QNITZ, respectively. For further device specific instructions please refer to the corresponding manuals.

GSM location: If supported by the IoT module, the time value can be updated by requesting GSM location and time data from the connected network. Some SIMCOM module users can edit the time using the command AT +CIPGSMLOC. SIMCOM describes the method in their manual.

NTP Server: Another way to update the time is through an NTP server. Some of the Quectel modules allow the user to obtain this time value by using the built-in NTP commands (AT +QNTP) to synchronise the RTC time with a custom network time server. You can follow this link from Quectel for relevant instructions on setting up this system.

If you have other IoT modules, please refer to the device manual for module specific commands. Depending on your hardware, you may find different ways to get this value.


Please note that this article is for informational purposes only and 1oT is not responsible for any loss or damage caused by trying these commands. The above commands and methods for retrieving the time value may not apply to every IoT device. We recommend readers refer to their device's manual/manufacturer for the appropriate instructions.