Making your own sensor definitions

From DynonDocs
Jump to: navigation, search

== Sensor Config File User Guide ==

For some background about this topic, see this discussion on the Dynon Avionics Forum.

The purpose of the sensor config file is to create a list of sensors for the EMS. The file contains the info to fully describe a sensor so that the system can convert from the input (which is always measured as volts) to a human readable output, such as degrees or gallons. The file is designed so that sensors can be easily added. Unlike the standard config files, the file must always be kept "whole"- when it's imported into the system, it replaces everything in the system, so you can't import just one new sensor, you must add it to the file and then re-import the whole file. File Structures

The file format is simple, it is a repetition of this structure as many times as needed:

sensor={
    id=
    function=
    pins=
    name=
    min_val=
    max_val=
    resolution=
    round=
    is_piecewise=
    low_coeff={
        c_x4=
        c_x3=
        c_x2=
        c_x1=
        c_x0=
        }
    low_resistance=
    low2high_cross=
    high_coeff={
        c_x4=
        c_x3=
        c_x2=
        c_x1=
        c_x0=
        }
    high_resistance=
    high2low_cross=
    window=
    shift=
    age=
    }

== Sensor Configuration Elements ==

    * ; Semicolons can be placed at the beginning of any line if you wish to comment the sensor file. They must be the first non whitespace character on the line.
    * id=
          o This is the name of the sensor in the EMS pin mapping page. For example, "K-TYPE THERMOCOUPLE (EGT)" or "0-150 PSI FLUID PRESSURE (100411-002)". This should be a name that a user can easily and accurately associate with the actual sensor they are using. This can be up to 40 characters, spaces are allowed.
    * function=
          o This tells the system what the sensor does and sets the native units of measure for the sensor. Everything in the sensor file must end up in these units. Conversions to other units are done in the system in other places. Allowed functions:
                + PRESSURE (PSI)
                + TEMPERATURE (F)
                + VOLTS (VOLTS)
                + AMPS (AMPS)
                + CONTACT (VOLTS)
                + LEVEL (VOLTS)
                + POSITION (VOLTS)
          o The last three are special cases where the system uses volts and interprets them in special ways. These sensors should basically not be edited, and changes to the names may cause things to break.
    * pins=
          o This is the list of pins the sensor is allowed to be connected to, separated by spaces. Not all pins in the system have the same capabilities, and thus you can't hook every kind of sensor to every pin. For example, thermocouples must hook to thermocouple pins, and some senders can only hook to GP's that have the ability to have no pull up resistor. Look at the Pin Hardware Capabilities table to figure out what pins a sender can use.
          o Example format: C37_P4 C37_P6 C37_P7 C37_P8 C37_P9
    * name=
          o These are default names for the sender. While a user can call a sender whatever they want, a few names here help prevent everyone from having to type "OIL" or "FUEL" for a sender that is used for that almost always. There can be more than one name in the list, just add as many "name=" lines as needed. Only one name per line, 6 characters, spaced allowed.
    * min_val=
          o This is the minimum value, in native units, that the sensor can do. This can be negative. If the sender outputs a value that is outside this range, it will be displayed as "X". It is important to set this range so that disconnected sensors do not show values that look reasonable. This has nothing to do with the graphical range in a given widget. If you set this to zero, the number will never display as less than zero, but the red X will not appear until (-)(MAX_VAL * 0.035) to allow some variation in sensors at zero.
    * max_val=
          o Same as min_val but the maximal legal value.
    * resolution=
          o This is the number of digits after the decimal that are shown for the sensor. If you want to show XXX.X you would put "1". For just integers, XXX, it's "0." This displayed resolution truncates, so 1.9 will show as 1 if you only show integers. Add round "1" if you also want it to round 1.9 to 2.
    * round=
          o This tells the system to round the value to a specific resolution. If you want 0.1, 0.2, 0.3, etc, you put "0.1". If you want 1,2,3, you put "1". If you want 10, 20, 30, you put 10. If you want 2, 4, 6, 8, you put "2".
    * is_piecewise=
          o This binary element sets if the polynomial that is used to convert is the same for the whole range, or if two are used. Some senders can get much higher accuracy if two polynomials and/or resistances are used as they travel through their ranges. Set to 1 for true and 0 for false.
    * low_coeff={
         c_x4=
         c_x3=
         c_x2=
         c_x1=
         c_x0=
         }
          o This is the 4th order polynomial that is used to convert from volts to native units. Every pin and sensor in the EMS is measured in volts. Something like a thermocouple or amps shunt will have hardware gain in the EMS, but this is pulled out in software before the polynomial is applied. Effectively, this polynomial should describe a conversion between volts at the connector of the EMS and the native unit for the sensor. Volts at the EMS pins may be created by external voltage sources, by pull-ups inside the EMS against an external resistance, or other means. Sensors such as contact, level, and position just have a "1" in the X1 slot so that they pass raw volts to the calibration system, which does the conversion.
          o This coefficient is the only one used if "is_piecewise" is set to zero.
    * low_resistance=
          o This is the internal pull up resistance used when this polynomial is active. Not all pins have the same pull-up capabilities.
          o One pin has the ability to sink current with a 200 ohm pull-down resistor. (pin 6 on the D37)
          o Only the enhanced inputs can do a "none" (pins 8, 22, 31 on D37)
          o Pin 26 is special for MAP and can only be a "none"
          o Allowed values:
                + PULL_UP_10K
                + PULL_UP_1K
                + PULL_UP_200
                + NONE
                + PULL_DN_200
    * low2high_cross=
          o This is the VOLTAGE when the system will switch to the second polynomial when going from below to above. Set high2low cross at or below this voltage to create hysterysis on the switching to prevent any jitter.
    * High_coeff, high_resistance, high2low_cross
          o Same as the "low_" versions, only used if "is_piecewise" is set to 1.
    * shift= A shift of x means 2^x/16Hz = T(sec) where after T seconds the filtered value is 90% of the change in value. So make this 5 if you want a filter that takes 1 second to hit 90% of the step change in value.
    * window= This is the window used for filtering. Set this to "1" and the value (in native units) must change by at least 1 for any change to be seen. This is post shift.
    * age= Age is a 16Hz count at which the window filter will expire and snap to the input value.  This prevents a permanent offset of a windowed value. 

== Pin Hardware Capabilities ==

  • General Purpose Inputs support 10K, 1K, and 200 ohm pull ups.
  • Enhanced General Purpose Inputs support 10K, 1K, and 200 ohm pull ups, as well as no pull up
  • Thermocouple Inputs are differential inputs that support from -4mV to 40mV, common mode of +/- 5V
  • If a pin is not listed, it's not an input pin

37 pin connector pin definitions

C37_P1: Special voltage input. No pull ups. Voltage range 0-33.0V

C37_P2: Special voltage input. No pull ups. Voltage range 0-33.0V

C37_P4: General Purpose Input.

C37_P6: General Purpose Input. Special case can also support 200 ohm pull-down to convert 4-20mA sensors to volts.

C37_P7: General Purpose Input.

C37_P8: Enhanced General Purpose Input.

C37_P9: General Purpose Input.

C37_P10: General Purpose Input.

C37_P11: General Purpose Input.

C37_P12: General Purpose Input.

C37_P14: Fuel Flow input 1. Measures pulse rate and duty cycle only. Approx 1V threshold. Fixed 10K to 3.3V internally. HARDCODED as FUEL FLOW, NOT IN  SENSOR CONFIG FILE

C37_P19: Fuel Flow input 2. Measures pulse rate and duty cycle only. Approx 1V threshold. Fixed 10K to 3.3V internally. HARDCODED as FUEL FLOW, NOT IN  SENSOR CONFIG FILE

C37_P20: General Purpose Input.

C37_P21: General Purpose Input.

C37_P22: Enhanced General Purpose Input.

C37_P23: General Purpose Input.

C37_P24/25: Amps shunt input. Reads + V when 24 is higher than 25. Max input differential is +/- 120mV. Common mode can be -2 to 60V.

C37_P26: Special Manifold Pressure input. 0-5V, no pull ups.

C37_P27/28: Thermocouple Input

C37_P31: Enhanced General Purpose Input

C37_P32/34: RPM Input 1. Measures pulse rate and duty cycle only. Approx 1V threshold on pin 34 and 10V on pin 32. Do not exceed 10V on pin 34. HARDCODED as RPM, NOT IN  SENSOR CONFIG FILE

C37_P33/35: RPM Input 2. Measures pulse rate and duty cycle only. Approx 1V threshold on pin 35 and 10V on pin 33. Do not exceed 10V on pin 35. HARDCODED as RPM, NOT IN  SENSOR CONFIG FILE

C37_P36/37: Thermocouple Input

25 pin connector pin definitions

C25_P13/25: Thermocouple Input

C25_P12/24: Thermocouple Input

C25_P11/23: Thermocouple Input

C25_P10/22: Thermocouple Input

C25_P9/21: Thermocouple Input

C25_P8/20: Thermocouple Input

C25_P7/19: Thermocouple Input

C25_P6/18: Thermocouple Input

C25_P5/17: Thermocouple Input

C25_P4/16: Thermocouple Input

C25_P3/15: Thermocouple Input

C25_P2/14: Thermocouple Input