The amateur radio Automatic Packet Reporting System (APRS) is typically used for position and weather reporting. It can also handle eight digital and five analog telemetry channels. The IoT Kits© solar-powered weather stations have four APRS analog telemetry channels for LiPo cell voltage, time awake, WiFi signal strength, and light intensity. Four digital channels are used for warning alarms: low cell voltage, low signal strength, and sensor failures.
Analog telemetry is transmitted as an 8-bit word, therefore, the analog signal must be mapped to a range of 0 to 255. A good example is the mapping of LiPo cell voltage. An obvious mapping strategy would be to map voltage from 0 to, say, to 5 Vdc. This would quantize the results in steps of about 20 mV (5 V / 255) but it is unnecessary to report voltages below about 3 V because the D1 Mini will stop working. If we map the range of 2.5 V to 5 V we will cut the quantization step in half to 10 mV, twice the precision of the first approach. The weather station measures the cell voltage, subtracts 2.5 and divides the result by 10 mV. Say the cell voltage is 4.2, the mapped value is (4.2 – 2.5) ÷ 0.010 = 170.
The telemetry receiver must reverse this process by multiplying the received byte value by 0.010 and adding 2.5 like this: (170 × 0.010) + 2.5 = 4.2 Volts.
How does the receiver know that it must perform this operation to interpret the voltage? Two approaches are possible: we can send the telemetry “blind” since WE know how to interpret it, or we can send instructions so that anyone can understand our telemetry. The IoT Kits weather stations use the second method by sending instructions every two hours so that APRS services such as aprs.fi can correctly plot our data.
It actually takes four messages to completely define the analog telemetry:
T – T is the APRS symbol for telemetry. It is followed by a three-digit sequence number. Earlier versions of the D1M-WX1 weather stations sent a sequence number from 000 to 999 derived from UNIX time obtained fron an NTP server. Current versions send a number from 000 to 255 stored in the ESP8266 RTC memory and incremented on each wake cycle.
PARM – Defines the name of the parameter. APRS limits the name to three to six characters depending on the particular channel. The weather station transmits Vcell, RSSI, Light, and time awake.
UNIT – Defines the units for each channel with the name limited to 3 to 6 characters: Vdc, dBm, lux, sec.
EQNS – Each analog channel has a quadratic equation that tells listeners how to interpret the 8-bit value associated with each channel.
A quadratic equation is a polynomial of the second order. That means that it is a polynomial function in one or more variables in which the highest-degree term is of the second degree. APRS uses this quadratic equation to interpret the received telemetry data: a · x2 + b · x + c where x is the received byte value.
The EQNS message transmits a set of three coefficients for each analog channel: a, b, and c
For the Vcell channel, the EQNS message looks like this: 0, 0.01, 2.5 meaning a = 0, b = 0.01, and c = 2.5. The receiver understands this to mean Vcell = 0 · x2 + 0.01 · x + 2.5
Let’s try it with a byte value of 163 as shown in the received telemetry data following:
Vcell = 0 ·1632 + 0.01 · 122 + 2.5
Vcell = 0 + 1.63 + 2.5 = 4.13 Volts
This is exactly what we had planned! This is how engineering and applied mathematics work in the real world.
Here is a sample of telemetry definitions from a D1M-WX1 weather station: