Notes on U4B user telemetry by Dave VE3KCL, 18-Dec-2024.

Many thanks Dave for these notes. 

NOTE: in the listings below, Dave has added a comment after / on many of the lines; in actual U4B BASIC you would not enter this comment and U4B BASIC does not currently support comments; these comments are shown here for explanatory purposes only. 


TELEN (user telemetry)

The U4B has the TELEN Extended Telemetry feature that was repaired in the latest QRP-LABS firmware 1_00_004 and now can be used by U4B owners. Hans intends to modify the TELEN protocol to comply to comply with Doug’s Traquito mapping when it is finally coded and tested. I use the laissez-faire method of transmitting a series of numbers from the balloon to represent the data to be decoded. This laissez-faire system creates a series of numbers that when decoded reveals the wanted extended telemetry in an order that can be understood by just reading the numbers of the decode. The laissez-faire method is inefficient in data usage but easy to encode, and understand. The original Telen method transmits 2 six digit numbers the first cannot exceed 632735 and the second cannot exceed 153900 by comparison Doug's new scheme will transmit a larger yet undetermined single number that should be able to be reproduced on decoding. The data from the balloon will be placed into these laissez-faire numbers prior to transmission and after the decoding should yield the same numbers and exactly the same data from the balloon using either Telen or Doug’s method of encoding. With that use in mind, here is some detail of how I gather the data from the balloon to be encoded into the extended telemetry. In the U4B the data is assembled using Basic commands.


How to measure GPS LOCK timing

Below is how I generate gps lock time data using Basic from the U4B radio under the 1_00_004 firmware but the methods can be applied to the new coding system when it is completed.

IF R > 1                        / check to see if tx count (R) is >1 to make sure it is not the first tx
  LET G = VAL "#2.1TM"          / let G be the initial time in hours 
  LET G = G * 60 + VAL "#3.2TM" / G converted to minutes 
  LET G = G * 60 + VAL "#5.2TM" / G converted to seconds 
GPS 140 / run the gps to lock measure time again
LET H = VAL "#2.1TM" / H in hours
LET H = H * 60 + VAL "#3.2TM" / H converted to minutes
LET H = H * 60 + VAL "#5.2TM" / H converted to seconds
LET I = H - G / subtract end seconds from start seconds to get I the gps lock time
ELSE / if R=0 just run the gps if it is the first spot
GPS 140
ENDIF
IF I > 99 / if lock time is >99 limit lock time to 99 for using only 2 digits of Telen
LET I = 99
ENDIF

The variable I is now the lock time in seconds from 0 to 99 seconds and can be scaled into part of the Telen number to be transmitted.


Measuring an External Temperature Sensor LM75B

The Basic has to read the I2C buss to find out the external temperature. I average it 3 times with a pause between measurements and massage the numbers so they are in Kelvin as this sensor does not immediately retrieve temperature in Kelvin. This produces a 3 digit number in Kelvin that can be transmitted by extended TELE.

LET Q = 0                       / zero the previous variable Q
FOR T = 1 TO 3             / start a count of 3 measurements to get an average temperature
LET P = I2CR 146 0        / check the external lm75 by reading the sensor
IF P  > 100                   / adjust temperature scale
LET P = P + 17
ELSE
LET P = P + 273           / adjust temperature results for kelvin
ENDIF
DELAY 300                 / let the thing rest between temp measurements 300ms
LET Q = Q + P            / add the measurements 3 times
NEXT
LET P = Q / 3             / get the average temperature in Kelvin to be transmitted (3 digits)

Alternating Telemetry transmissions by creating odd and even transmissions

For sending Extended Telemetry with the U4B I alternate transmissions on the first Telen transmission (QRP-Labs) and Slot 2 (Traquito)

The reason for this change of transmissions is that some data does not need to be refreshed every 10 minutes and a 20 minute refresh is fine …examples would be transmission count or cloud reflection numbers….  so that data is sent every other transmission. This saves battery in after dark transmissions and reduces the bandwidth of the Telemetry using less transmission slots.

In Basic this is how I get an odd and even number variable D from the Transmission count variable R that increments from the first morning startup. The value of D can be used in Basic to send one telemetry or another at alternate times.

IF R % 2 = 0                    / if the counter R is even let D=0 ( the % modulo function)
 LET D = 0                     / assign variable D as even
ELSE
 LET D = 1                     / assign variable D as odd
ENDIF

Creating a stress test voltage check for the Battery by loading an I/O with a load resistor.

A load resistor that will draw 20ma @ 3.3v is soldered between I/O #7 and ground so when the I/O is turned on the resistor will draw 20ma and will produce a 4 digit voltage in Millivolts that can be transmitted as extra telemetry. When M is transmitted the Received data of 3654 would indicate 3.654 volts. This test is done in a time after GPS lock and before any transmissions.

OUT 7 1                         / turn on load resistor at I/O 7
LET M = 0              / set variable M to 0
FOR T = 1 TO 20
 LET M = M + BT            / count the battery voltage 20 times
NEXT
LET M = M / 20            / average the battery voltage by dividing by 20
OUT 7 0                   / turn off load resistor at I/O 7

Changing the transmission schedule timing to conserve power 

One may want to experiment to change the transmission schedule timing to see if battery power could be saved at night.

Making the U4B transmit on a 20 minute schedule instead of a 10 minutes schedule could help the night transmission endurance and increase battery life after dark. To accomplish this one way was to identify the odd and even days and on even days change the transmission schedule from the normal 10 minute tx schedule to every 20 minutes instead so one day the U4B can transmit every 10 minutes and the next day every 20 minutes except where the date rolls over from 31 to 01 at the beginning of the month.

The first part is to identify the date as odd or even. 

LET E = VAL "#1.2DT"            / check the gps date and get a number for the last digit of the date
IF E % 2 = 0                    / modulo 2 the value E to see if it is even
 LET J = 0                     / assign the variable J as the value 0 if even                   
ELSE
 LET J = 1                     / J is 1 if odd
ENDIF

The next thing is to assign a different timing to the transmission. In this example the the next code is after the gps statement and I usually send some QRSS transmission before the normal WSPR and telemetry. I send a QRSS balloon glyph with a identifier for the flight number (like the blue glyph beside my call) so it will show up on a QRSS grabber. In the following example, on this channel, the normal Wspr starts on minute 4 but I send the QRSS starting on minute 3 one minute early.

This code looks like the following

IF J = 0
  SLEEP 10 3             / if the day is odd start on minute 3 ( if J is not odd so it goes to the else option)
ELSE
  SLEEP 20 3             / if the day is even, wait one transmission cycle and start on minute 3
ENDIF
60 CW 0 14096860 5 0 "*01IFLCNAP8Q7R6R5S0S0S5R6R7*"   / tx balloon glyph code
CW 0 14096872 5 0 "*0155  36396303         9630*"     / tx  flight number identifier

If one did not want to send a QRSS Balloon glyph but just wanted to send a different schedule on different days one could delay the timing with the SLEEP command by sleeping past the normal next transmission timing... the shorter code below should work:

IF J = 0                        / if the day is even go to 20 min schedule
  SLEEP 10 0         / sleep past the normal 10 minute cycle and transmit on the next cycle
ENDIF

Flashing the U4B LED for status indication

It can be useful to flash the LED on the U4B to tell you things about the condition of the radio. 

There is one built in LED on the U4B that normally comes on when you apply power but with BASIC you can use that LED to tell you what is going on with the radio when it is powered up and not connected to the monitor. In fact there are a number of I/O ports that you could solder a resistor and a smd LED to so they could also show you want the radio was doing. You could have the GPS flash once when you started the power and 3 times when the GPS lock was complete. By looking at the radio under battery power you could determine the GPS lock time by counting the seconds between the types of flashes.

Two flashes or more

30 FOR N = 1 TO 2               / set number of flashes to 2  (if you want 5 flashes set it to 5)
OUT 19 0              / make sure the LED is off
 OUT 19 1              / turn on LED at I/O 19
 DELAY 1000          / wait one second (1000 milliseconds)
 OUT 19 0               / turn off LED
 DELAY 1000          / wait one seconds (you may want a shorter off time so this could be 500)
NEXT
40 ... / continue the rest of the program at ...

The flash routine could be applied to any I/O with a suitable LED and resistor indicating the condition or results of your BASIC subroutines. It could also flash a code when all is ok and ready to launch… After launch you would want to look at the altitude and in BASIC and turn oft the flashing permanently above say 3000 meters so it did not use resources. To have the flash turned off in flight you could use the following lines ahead of line 30

25 IF AT > 3000                 / if the altitude is > 3000 meters jump to 40 and miss the LED flash routine
GOTO 40
ENDIF

Measuring cloud reflection with a primitive light sensor using a SMD LED

One might want to measure the intensity of the light from below the balloon and it is quite easy to measure (although uncalibrated) using an LED as a sensor.

It turns out that an orange LED (perhaps other colours will work just as well or better) provides a voltage when light is shone on it. On the U4B it only requires a 2 megohm or so parallel resistor across the LED to put some loading on the I/O to pull the voltage down to zero when the light is low. A PCB is not necessary, just wires from an LED and a resistor will work.

In the picture above, a small pcb was made to connect an external LM75B temperature sensor and LED light sensor to the U4B. In the image the LED is soldered on its edge, and the opposite end of the PCB is glued into the foam box containing the U4B so the LED points down towards earth. The LM75B is connected to power and the I2C bus and the LED is connected to an I/O pin, any free I/O will work. In this case I/O 6 was chosen for the LED input. Note on the image the SMD LED has a green mark which is negative or connected to ground. The LED device is not linear when looking at light and a linear treatment of the data would be out of range on the bright side or insensitive on the low light side. If LED value F is above 50, the scale was changed so it was much less sensitive and could adapt to higher light levels.

For testing I aimed a bright flashlight into the sensor and got a maximum value of 75. I was looking for a result in 2 digits so limited the value to 99. In actual flight I think cloud reflection numbers of 70 were achieved as a maximum. Since only 2 digits of information were planned for cloud reflection extended telemetry the maximum was limited to 99 and the minimum was changed from zero to 1.

LET F = INA 6                   / read the analog input from I/O 6
FOR T = 1 TO 50             / set up 50 readings for averaging
 LET F = F + INA 6            / Total 50 readings
NEXT
LET F = F / 100                / divide by 100 for some scaling
IF F > 50                       / if F is more than 50 do some scaling
  LET F = F / 10 + 50          / divide F by 10 and add it to 50 ( so 60 would end up being 56)
ENDIF
IF F = 0                        / check to see if F is zero as we do not want a non zero number
  LET F = 1                     / if F is zero make it 1
ENDIF
IF F > 99                       / if F is greater than 99 make it 99 because we are using 2 digits for tele
  LET F = 99
ENDIF

Sending accurate location in CW

If your Balloon is in trouble below a certain altitude you may want to send out a CW message with its accurate location.

A location call should have your call the Latitude and Longitude and be slow enough that someone could copy it easily and maybe even include your email address or phone number if you really want the balloon back. This CW could be sent before or after the WSPR transmissions.

One should time how long it takes to send the CW to make sure there is enough time so at 10 words per minute the U4B could send about 50 characters in one minute.

  • Your call would be 6 characters
  • Your Latitude would be about 12 characters
  • Your Longitude would be about 12 characters
  • You could send your call again for another 6 characters

So this sequence of 36 characters should fit inside a minute 50 character transmission.

There are tags that can be used like CS for callsign, LN for Longitude, and LT for Latitude. The form for sending a normal speed CW looks like this

CW 0 14096800 10 0 “#CS”

This should send normal CW at 14096800 Hz (just below the WSPR band) at 10 words per minute with zero frequency shift and the message would be the Callsign registered on your U4B.

Since you know the message will take less than a minute you may want to send it just before the WSPR transmission. If you know your WSPR transmission starts on minute 4 then you can send the CW starting on minute 3 by using the SLEEP command. SLEEP 10 3 will wake up and start the next command on minute 3

Now this Basic will transmit CW on the way up also, until the 3000m altitude is exceeded. With a few more lines of BASIC you could eliminate the CW on ascent by saving and comparing the previous Altitude and if the previous Altitude was lower than the present one, you would know the balloon was ascending not descending and skip the CW transmission.

10 GPS 140
IF AT > 3000      / if the attitude is greater than 3000m do not transmit CW message and goto 20
GOTO 20           / if the altitude is less than 3000m it will transmit the CW message
ELSE
SLEEP 10 3          / wake up on minute 3
CW 0 14096800 12 0 “#CS #LT #LN #CS”    / transmits Callsign Latitude Longitude Callsign (more accurate than M6)
ENDIF
20 TELE
GOTO 10