6. FlatSat and TinyGS - ElectronicCats/FlatSat GitHub Wiki

FlatSat and TinyGS

Overview

TinyGS is a network of small ground stations that receive LoRa telemetry from satellites and publish it on the web. It speaks a fixed, well-known radio format, so any station tuned to the right frequency and settings can show the data of a satellite it has never heard of.

FlatSat can act as one of those satellites. Switching a board to the tinygs mode makes it emit beacons in the TinyGS format on the parameters of a real ground station, so an existing TinyGS station, or the station software running on your own computer, decodes your board as if it were in orbit. The board behaves like a ghost satellite: nothing about the radio link is simulated, the frames really travel through the air, and the external receiver really decodes them.

This is the exercise named Satélite Fantasma in the PwnSat curriculum, and it is the fastest way to see why a spacecraft link without authentication is a problem.

[!WARNING] Setting up an external receiver means transmitting on a frequency that other people are also using. Work only on hardware you own or are authorized to test, and inside the bands that your country reserves for unlicensed and experimental use.

What is TinyGS?

TinyGS is an open-source project that turns a low-cost radio gateway into a satellite ground station. A station runs on an ESP32 board with a LoRa radio, is registered on the TinyGS network, and every frame it receives is uploaded to the TinyGS database and shown in the web interface. The project is documented at tinygs.com, and its sources are published at github.com/tinygs/tinyGS.

Environment setup

Prerequisites

  • Two FlatSat boards with their firmware loaded, one acting as the satellite and one as your own ground station.
  • An antenna on the SMA connector of every radio you use.
  • FlatSat Ground Station installed on your computer.
  • Optional: a TinyGS station registered and running somewhere you can reach if you want a receiver outside your own desk.

Hardware configuration

Both boards must listen on the same radio parameters, so set the Norbi profile of the ground station on both of them. The profile uses 436.703 MHz, a spreading factor of 10, a bandwidth of 125 kHz, and an output power of 22 dBm:

flatsat config --radio ALL --freq 436703000 --sf 10 --bw 125 --power 22 --apply

Expected output:

RADIO CONFIGURATION - TARGET ALL

Configuring target ALL
Frequency        -> 436703000 Hz: OK
Spreading Factor -> SF10: OK
Bandwidth        -> 125 kHz: OK
Power            -> 22 dBm: OK
Applying changes: OK

Run the command on each board, selecting the right one with -d when both are connected to the same computer.

Software configuration

Put your own ground station board in its usual role so that it receives the link instead of transmitting telemetry.

flatsat mode ground_station

Expected output:

mode gs -> OK
lora_mode ALL command -> OK
lora_apply ALL -> OK
Mode set to 'ground_station'.
Identifying the board that changed mode (blinking LEDs)...

Operation and data collection

Make the satellite emit TinyGS beacons

On the board that must behave as the satellite:

flatsat mode tinygs --profile norbi

Expected output:

TinyGS spoofing 'norbi': OK
Identifying the board that changed mode (blinking LEDs)...

The board switches both radios to streaming and loads the radio settings of the requested profile in one step, so you do not have to configure them by hand. The board blinks its status LED to show that the role changed.

Watch the beacons on your own ground station

On the second board, listen on Radio 0:

flatsat sniff -t 0

Expected output:

Sniffing Radio 0 (telemetry downlink) until Ctrl+C (SDLS level 1)...
#1: TM APID=0x020 seq=118 CRC=OK (34 bytes, RSSI -91)
#2: TM APID=0x020 seq=119 CRC=OK (34 bytes, RSSI -90)

The frames are no longer CCSDS space packets with your board's telemetry; they are the beacon format that a TinyGS station expects, which is precisely what an external receiver needs to display your board as a satellite.

You can check whether the board really is in TinyGS mode with the raw shell command:

flatsat cmd "tinygs status"

Analysis and export

Once the beacon is on the air, the rest of the work belongs to the receiver:

  • From your own board: save a capture with flatsat sniff -t 0 -o tinygs-capture.json and inspect the frames one by one, or replay them later with flatsat replay tinygs-capture.json.
  • From a TinyGS station: the station decodes the beacons and lists the satellite in its web interface, with its name, its position, and its telemetry, exactly as it would for a satellite in orbit. The station and the registration procedure are documented by the TinyGS project.
  • From the web dashboard: the satellite page of FlatSat Ground Station has a TinyGS panel with the profile selector, so the same change can be made from the browser instead of the terminal.

Stop the beacons when you are done, and put the board back in a normal role:

flatsat cmd "tinygs stop"
flatsat mode mission