First of all, that’s an interesting project
I just have to send the time delta between the recorded timestamp and 24 hours ago, 48 hours ago etc
Alternately you can just send the deltas between each successive recorded timestamps:
For the first recording, you don’t need to send anything because you can use the date/time from the metadata.
For each successive recording send just the delta between it and the previous one.
Using 10 bits would give you a flexible window of 1024 minutes between recordings (17h)
You will need to take a bit of care when rounding the numbers, so the errors do not accumulate, but it’s possible to keep the error below 1 min for each recording:
For i =1 to n calculate diff(i) = t(i) - t(0) - sum(diff(0…i-1))
This should cancel out the errors from the previous diffs!
You can extend this range further in two ways:
- add 1 more bit to get 34h
- you can shift out some unused values
For example, if it doesn’t make sense to send too recent data (<4h) you can just subtract 4h from the diff end encode the result … this way your range is effectively 4h-21h with just 10 bits
Another option is to use a “variable precision” encoding/mapping.
This would work best with a scheme like you described, where you encode the diff to the beginning of 1 day ago, 2 days ago, 3 days ago etc.
You map each possible value of a byte to 256 “fixed” minutes of a day, you can adjust the mapping table to map more values where you need more precision (sunrise, sunset), and have some larger jumps in the parts of the day that don’t matter much (noon?, night).
Of course, you can use more than 8 bits if needed
You can apply the diff strategy to the other fields (lat/lng).
Only the first frame needs to record with 2 bytes precision, subsequent frames record just the diff with the previous one.
Depending on how fast these balloons go you might be able to use just 1 byte for the diffs.
A quick calculation at 10km altitude with 20m/s wind speed, you get 1728 km/day which is about 16 degrees of lat/lng
I think you could safely pack this in 1 byte (if -180/+180 fits ok in 2 bytes).
You might be able to pack together the time-lat-lng-alg diff in 4 bytes (11, 7, 7, 7 bits).