Device connection

Where your device sends its data, the packet format, and how it receives downlinks.

Data path

Your device sends its data over the satellite network, and it reaches the CeresGate UDP Gateway over the internet. CeresGate finds your account by the device's IMSI and forwards the data to the destination you assigned to that device.

Device → satellite network → internet → CeresGate UDP Gateway → your destination (ThingsBoard, MQTT Broker, AWS IoT Core, Azure IoT Hub)

UDP Gateway address

Packet format

What your device sends over UDP is a hexadecimal (hex) string, made like this:

  1. Put the device's IMSI (15 digits) first, followed by the data you want to send.
  2. Encode the whole string as UTF-8, then turn it into a hex string.

For example, with the IMSI 001013453258396 and the data Hello:

y = '001013453258396' + 'Hello'
z = y.encode('utf-8').hex()
# z = '30303130313334353332353833393648656c6c6f'

If the data is a JSON object, turn it into a JSON string first and append that to the IMSI:

import json

data = {"temp": 25.1, "battery": 87}
y = '001013453258396' + json.dumps(data, separators=(',', ':'))
z = y.encode('utf-8').hex()

IMSI

  • The first 15 characters must be the IMSI you bound in the portal. CeresGate uses it to find your account and device; data from an IMSI that isn't bound is not forwarded.
  • Get the IMSI from the provider you bought your satellite network service from, for example on the provider's management platform.

Recommended size

We recommend keeping the IMSI plus the data within 256 bytes before hex encoding (letters and digits are 1 byte each; characters such as Chinese take 3 bytes each in UTF-8), which leaves up to 241 bytes for the data. Longer packets are still forwarded, but may be truncated.

What your destination receives

For the Hello example above, your destination receives:

{"IMSI": "001013453258396", "Payload": "48656c6c6f"}

Payload is the data after the IMSI, as a hex string. See Forwarding format.

In the portal's forwarding logs, each entry's type is shown as UL, meaning uplink: data sent from the device over the satellite network to the CeresGate service on the internet.

Receiving downlinks

A downlink you send through the Downlink API or the portal is delivered when the device sends an uplink:

  • As soon as the UDP Gateway receives the device's uplink, it immediately sends back the device's pending downlinks, so keep listening after sending an uplink.
  • They are sent back to the address and port the uplink came from, so receive them on the same UDP socket you sent the uplink from.
  • Each downlink is one UDP packet, sent in the order they were queued, up to 20 per uplink.
  • What the device receives is the downlink's payload hex string itself, so hex-decode it first. For example, if you send 48656c6c6f20576f726c6421, the device receives that same string, which decodes to Hello World!.
  • The same downlink may arrive more than once (see how the Downlink API works), so design the device's handling so that running it twice does no harm.

A Python sketch (on a real device, use the UDP functions of your module or operating system):

import socket

GATEWAY = ("GATEWAY_IP", GATEWAY_PORT)
IMSI = "001013453258396"

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# Send an uplink
sock.sendto((IMSI + "Hello").encode("utf-8").hex().encode("ascii"), GATEWAY)

# Receive downlinks on the same socket (one per packet)
while True:
    packet, _ = sock.recvfrom(2048)
    command = bytes.fromhex(packet.decode("ascii"))
    print(command)   # e.g. b'Hello World!'

Acknowledgements and retries

  • UDP itself doesn't guarantee delivery, and the UDP Gateway does not send an acknowledgement (ack) back to the device.
  • Whether to retry, and when, is up to your application. For example, if you need confirmation, your system can send an acknowledgement through the Downlink API once it receives the data, and the device gets it on its next uplink.
  • The forwarding result of every uplink is shown in the portal's forwarding logs.