BARANI

View Original

Time synchronization setup of a MeteoHelix LoRaWAN weather station on TTN

This article applies to MeteoHelix weather stations made up to 2019 with serial numbers composed only of numbers (no letters). Newer versions of our LoRaWAN sensors (December 2020+) offer the following downlink commands: List of available LoRaWAN downlink commnands

QUESTION: Is remote time synchronization possible with the MeteoHelix LoRaWAN weather stations on TTN so that they can send data in 10 minute intervals on the hour?

ANSWER: MeteoHelix weather stations provide the ability to change settings and time synchronization remotely via a LoRaWAN down link connection from The Things Network (TTN) and other LoRa server providers. The below instructions and screenshots will guide you through the setup process.

Time Synch on TTN

Log into your The Things Network Console at the following link: https://console.thethingsnetwork.org/

TTN Console quick downlink instructions

  1. In the top horizontal menu, click Applications.

  2. Select the application which contains your device as shown in the screenshots.

  3. In the lower horizontal menu, select Devices.

  4. Next, select the device requiring time synchronization.

  5. In the new lower horizontal menu, select Overview.

  6. Scroll way down to find the Downlink section.

  7. To send the time synchronization, fill out the Downlink section as follows:

    • Scheduling = “replace” or “first

    • FPort = 1

    • Payload = 01 5B E7 03 D0 00 00 00

    • Confirmed = checked or unchecked

Detailed downlink format explanation

Scheduling is set by default to “replace”, thus replacing all currently scheduled downlinks, if any, so that any other previously scheduled downlinks will not be sent. Setting the downlink scheduling to “first” or “last” will put this manually added downlink message in the downlink queue ahead of or after the already scheduled downlinks.

FPort for 99% of use cases will remain set to 1.

Payload format is 8 bytes long. Each pair of symbols is a byte in hexadecimal format as follows:

  • 01 5B E7 03 D0 00 00 00
    The first byte (first pair) identifies the type of message being sent. For time-synch command, the first pair must be 01. (In hexadecimal syntax 0x01)

  • 01 5B E7 03 D0 00 00 00
    The next four bytes (four pairs) contain the Unix Epoch time stamp in hex number format, 5DE703D0, which converts to 1575420880 in our familiar decimal system and in Unix Epoch time to: GMT: Wednesday, December 4, 2019 00:54:40

  • 01 5B E7 03 D0 00 00 00
    The last three bytes ( 3 pairs) are empty (zeros).

Confirmed may be left unchecked for MeteoHelix weather stations.

1. SELECT the application to which the device is connected

2. SELECT YOUR DEVICE for time synch from the list of available devices (make sure the dot indicating connection status is green next to the device address)

3. under device info, scroll down and fill out the downlink section and click send


Preparing time-synch downlink payload

If the last received data arrives at 20:19:47, 13 seconds too early, the internal time of the weather station is 13 seconds ahead of official GMT time. Since data is set by default to 10 minute intervals, we will send the weather station the last received time plus 10 minutes 11 seconds (10:11), since the downlink data on LoRa devices can only be received in a short window of time right after the device uploads its sensor data.

Converting date and time to downling message hexadecimal format

See this content in the original post
  1. Add 10 minutes to the last recived data time stamp 20:19:47 + 10 minutes = 20:29:47

  2. Convert time “YYYYMMDD 20:29:47” to Unix Epoch time stamp to Unix ten digit decimal format: Date & time to Unix Epoch decimal format converter

  3. Convert the decimal time stamp to four byte hexadecimal format for insertion into the time-sych message: Decimal-to-hex converter

Creating the downling message hexadecimal format

  1. Time-synch command is 0x01 in hex format: 01

  2. Append the four byte hex date and time after the 01 command: 01 5C B0 F2 E3

  3. Append three empty bytes (00 00 00) so the total message length is 8 bytes: 01 5C B0 F2 E3 00 00 00


MeteoHelix IoT Pro LoRaWAN micro weather station in agriculture

Advanced downlink scheduling on TTN

Advanced information on how to setup automatic downlinks using your application as connected to the TTN LoRa server can be found here:

How does the MeteoHelix automatically handle time synchronization?

Details on how the time synchronization command works to update the current time inside the MeteoHelix can be found in this FAQ thread:

BARANI DESIGN TECHNOLOGIES IS A MANUFACTURER OF PROFESSIONAL WEATHER STATIONS AND METEOHELIX PERSONAL WEATHER STATIONS.