Hi,
I'm in a process of rebuilding a LSA aircraft and plan on installing a transponder.
for those who are not familiar with the aviation world, a transponder is a piece of equipment that reads a gray code signal (over 12 signal lines, actually 11 as one is never used) from an altitude encoder and transmit that to the traffic control along with some other data.
the encoder is basically a pressure sensor and a processor which converts that pressure reading to a gray code (12 signal output pins) to be read by the transponder.
i am trying to make my own altitude encoder, however i'm struggling to get my head around that gray code to binary thing. any one knows of a library or can help write a function to convert altitude to aviation gray code?
a little bit about the altimeter gray code:
https://en.wikipedia.org/wiki/Gillham_code#:~:text=Decoding,as%20a%20most%20significant%20bit.
gray code - altitude online converter:
http://avionictools.com/
any help will do,
cheers!
L
There are standard functions that convert binary to Gray code and vice versa. Some options are discussed here.
How is the altitude represented in standard integer binary? That is, what elevation corresponds to a single bit?
Being a former pilot I say that the main task of the transponder is to send a 4 digit identifying code, given by the air traffic leader, unic for the plane. In the next, advanced version of transponders they got height reporting, telling ihe 4 digit Id and the height.
Why not contact Avionics Tools and ask?
jremington:
There are standard functions that convert binary to Gray code and vice versa. Some options are discussed here.
How is the altitude represented in standard integer binary? That is, what elevation corresponds to a single bit?
Did You look at the link provided? This is a modified Gray code, not the one used in usual positioning stuff as I see it.
As a current pilot, I can tell you the transponder also sends out ADS-B data (Automatic Dependent Surveillance - Broadcast). ADS-B allows equipped aircraft and ground vehicles to broadcast their identification, position, altitude and velocity to other aircraft and ATC. This is called ADS-B Out. Being able to receive this information is known as ADS-B In.
It is basically required anyplace that a radio is required.
ADS-B Out Explained.
@CrossRoads
Transponders have been developed since the 1970 - 80:es... Used one a year ago but only noticed the 4 digit code given to us.
This is a modified Gray code, not the one used in usual positioning stuff as I see it.
Gilham Gray code is also covered in the articles I linked.
It appears that the simplest approach would be a lookup table to cover the entire 11 bit range of values. Not a problem to store that table in PROGMEM (2048 integer values).
jremington:
Also covered in the article I linked.
Yes. It's easy to read "Grey" and drop the rest of the message.
CrossRoads:
As a current pilot, I can tell you the transponder also sends out ADS-B data (Automatic Dependent Surveillance - Broadcast). ADS-B allows equipped aircraft and ground vehicles to broadcast their identification, position, altitude and velocity to other aircraft and ATC. This is called ADS-B Out. Being able to receive this information is known as ADS-B In.
It is basically required anyplace that a radio is required.
ADS-B Out Explained.
Where is ADS-B Out Required? - AOPA
there are few kinds of transponders, ADS-B is the latest. in LSA aviation, you only need a "mode C" transponder.
i read the links thoroughly but as i'm not a "math" person, its kind of jibrish to me..
any help? can you guys explain the "lookup table" suggested?
L
The Gilham Gray code is not one that lends itself to a simple mathematical function to return values.
To convert Gilham code to altitude (OR the reverse process), you can "look up" an input value and return an altitude. The only problem is that you have to correctly type in up to 2048 binary values into a table. For your safety, TRIPLE CHECK EVERY VALUE, AND ITS ORDER IN THE TABLE, THAT YOU ENTER!
To convert table values to altitude, your program could look something like this, using the PROGMEM keyword to store the data in program memory. There is not enough RAM on a standard Arduino to do otherwise.
Basic test program, which works but does not include the entire table.
#include <avr/pgmspace.h>
// Test Gilham Code lookup table (shortened)
// stores codes in order of "feet altitude" re table above (you don't need all 2048 unless you will be flying at 126,700 feet!)
const PROGMEM unsigned int gilham[10] = {0b1, 0b11, 0b10, 0b110, 0b100, 0b1100, 0b1110, 0b1010, 0b1011,0};
//note EXTRA ZERO at end to indicate table end
void setup() {
int i;
Serial.begin(9600);
// get a Gilham Gray value from the sensor
unsigned int value = 0b11; //replace constant with function to read altitude sensor
// code searches the table for that entry, using a slow linear search:
for (i = 0; i < 10; i++) { //i = altitude index
if (value == pgm_read_word(gilham + i)) break; //exit loop if found
}
if (i == 9) Serial.println("table value not found"); //error in table, or in value
signed long altitude = i * 100UL - 1200; //in feet
Serial.print("code in binary ");
Serial.print(value, BIN);
Serial.print(" = altitude ");
Serial.println(altitude);
}
void loop() {}
To convert altitude in feet to Gilham Gray code, just get the table value with index = (altitude in feet)/100+1200
unsigned int code = pgm_read_word(gilham + altitude/100+1200);