Pages

Sunday, February 8, 2015

Posting Temperature on APRS.fi

I've been working on understanding how telemetry data is sent via APRS. I found a good link on the APRS Site.

It showed me the format of the Telemetry String: T#sss,111,222,333,444,555,xxxxxxxx.

T# defines the string as a telemetry string.

They referred to the first set of numbers (sss) as the serial number and I found that it had to be a unique number from 1 - 999, each day.
I take that to mean that one could only send 999 telemetry packets over the course of the day.

The following 5 groups (111,222,333,444,555) are 5 different 3 digit, analogue values that need to be between 0 - 255.

And the final 8 are binary values which could show (open doors, devices on/off, etc)

So the first challenge I had was to determine how to setup a unique 3 digit number for each transmission, that would reset each day. I decided to go with time.
There are 24 hours x 60 minutes = 1440 minutes in a day, so that is more than 999 & won't quite work.
But I could take the total minutes of the day and divide it by 4.
Here is the Python code that I'm using:
I use the "if DEBUG > 0:" statements to print out values to help me debug a problem. Once it is working properly, I set DEBUG to 0 so they won't print during the execution of the program.

  aprs_hour = int(time.strftime("%H"))
  if DEBUG > 0:
    print "aprs_hour: ", aprs_hour
  aprs_minute = int(time.strftime("%M"))
  if DEBUG > 0:
    print "aprs_minute: ", aprs_minute
  aprs_time = int((aprs_hour * 60) + (aprs_minute)) 

The second challenge that I encountered was the outside temp.
Initially I expected to send the raw value with no problem.
February in Calgary doesn't generate positive values (grin) and so I was stuck for a bit when I saw the correct numbers being sent (-13.6 to -15.0 deg C on the day of my test) but the graph didn't move off of 0.
Then I remembered the values needed to be between 0 - 255.
Assuming the coldest temp of -40C I simply added 40 to the existing temp to bring it to a positive value and then had to figure out how to bring it back to the actual values in aprs. 

After further research, I found out about the EQNS aprs string.
Each analogue value is placed into a quadratic equation and one can send the values to modify it.
There are 3 numbers sent for each analogue value as follows:
EQNS.abc,def,ghi,jkl,mno
Since analogue value #2 is for my outside temperature, there are 3 values d, e, f that will be placed in the following equation: (Value of #2 x d2) + (Value of #2 x e) + f
So in my case of the negative outside temp, I converted it to a positive by adding 40 to it before it was sent.
My numbers for Value #2 were 0,1,-40. 0 because I didn't want to square it, 1 because I wanted the value and -40 because I had added 40 to the original value, and now needed to subtract it. 

I've setup aprx to send out these 3 fields every 120 mins:
:VE6RBN-1 :EQNS.0,1,0,0,1,-40,0,1,0
:VE6RBN-1 :UNIT.Deg C,Deg C,Deg C
:VE6RBN-1 :PARM.House Temp,Outside Temp,Garage Temp

And I've setup the temperature beacon file to be sent out every 10 minutes.
T#199,23.3,31.2,15.5,0,0,00000000
The unique number (199 above) resets at midnight every day.
You can see the telemetry graphed here: VE6RBN-1 Telemetry
And you can see the raw packets here: VE6RBN-1 Raw Packets