Reading analog pressure withMPX5700DP

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
Yogilours
Posts: 22
Joined: Tue Nov 21, 2017 6:49 pm
Country: -

Reading analog pressure withMPX5700DP

Post by Yogilours »

Hello everybody !

I'd like to monitor the landing gear air pressure on my radio. For that I have a MPX5700DP sensor. I could probably use my own program but I'd like to use OXS for that, in order tu use also my GPS and altimeter.

Do anybody know how I could read this analog information ? I looked for that but I coould not find.

Thanks for all

Guillaume

mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Reading analog pressure withMPX5700DP

Post by mstrens »

As the sensor delivers an analog voltage it is quite easy.
Just connect Vcc, Gnd and then Vout (from the sensor) to one of the arduino analog pin (A0, A1, ...).
Then in the config, you must ask to measure a voltage (on the arduino pin you select).
In the config, you have also to fill some values for the parameters scale and offset (in order to map the measured voltage to a pressure value).
Finaly, you select a telemetry field to transmit the voltage.

If this is not clear enough, just ask for (I could make a draft of the config files).
Yogilours
Posts: 22
Joined: Tue Nov 21, 2017 6:49 pm
Country: -

Re: Reading analog pressure withMPX5700DP

Post by Yogilours »

Hello,

Thanks for the fast and clear answer. So I can mesure my pressure now on my Jeti, but I still get only integers and °C. Can I change that ? I use VOLT_1 and A0. Here is a part of my config file. If you can help...

Thank you again

Guillaume

// ***** 2.4 - Jeti data *****
#define VOLTAGE_SOURCE VOLT_1 // select between VOLT_1, VOLT_2, VOLT_3 , VOLT_4, VOLT_5 , VOLT_6
#define TEMPERATURE_SOURCE NTC // select between MS5611 and NTC



/ --------- 6 - Voltages & Current sensor settings ---------

// ***** 6.1 - Voltage Reference to measure voltages and current ***** see oXs_config_advanced.h when voltage reference is not Vcc and 5 volt

// ***** 6.2 - Voltage parameters ***** see oXs_config_advanced.h for additionnal parameters when YES
#define ARDUINO_MEASURES_VOLTAGES YES // select between YES , NO (When NO, following line is discarded)

// ***** 6.3 - Max number of Lipo cells to measure (and transmit to Tx) *****
#define NUMBEROFCELLS 0 // Put this line as comment or set value to 0 (zero) if you do not want to transmit cell voltages.

// ***** 6.4 - Convert voltage to temperature (° Celcius) ***** see oXs_config_advanced.h if you want to measure temperature(s) with thermistor

// ***** 6.5 - Current parameters ***** see also oXs_config_advanced.h for additionnal parameters if you want to measure current with a current sensor
#define ARDUINO_MEASURES_A_CURRENT NO // select between YES , NO

// ***** 6.6 - Ads1115 parameters ***** see oXs_config_advanced.h for additional parameters when AN_ADS1115_IS_CONNECTED is YES
#define AN_ADS1115_IS_CONNECTED NO // select between YES , NO

// --------- 6 - Voltages & Current sensor settings ---------

// ***** 6.1 - Voltage Reference to measure voltages and current *****
//#define USE_INTERNAL_REFERENCE // uncomment this line if you use 1.1 volt internal reference instead of Vcc (voltage divider mst be used to reduce voltages to 1.1 volt max)
//#define USE_EXTERNAL_REFERENCE // uncomment this line if you use an external reference instead of Vcc
#define REFERENCE_VOLTAGE 5000 // set value in milliVolt; if commented, oXs will use or 1100 (if internal ref is used) or 5000 (if internal ref is not used)

// ***** 6.2 - Voltage parameters *****
#define PIN_VOLTAGE 0 , 8 , 8 , 8 , 8 , 8 // Fill 6 values; set to 0 up to 7 for analog pins A0 up to A7 ; set the value to 8 for the voltage(s) not to be measured.
#define RESISTOR_TO_GROUND 0 , 10 , 10 , 10 , 0 , 18 // set value to 0 when no divider is used for a voltage; can contains decimals
#define RESISTOR_TO_VOLTAGE 0 , 8.7 , 22 , 27 , 0 , 47 // set value to 0 when no divider is used for a voltage; can contains decimals
#define OFFSET_VOLTAGE 0 , 0 , 0 , 0 , 0 , 0 // optionnal, can be negative, must be integer, in principe in mv
#define SCALE_VOLTAGE 0.0166 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 // optionnal, can be negative, can have decimals
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Reading analog pressure withMPX5700DP

Post by mstrens »

I think that if you transmit a voltage (e.g. with #define VOLTAGE_SOURCE VOLT_1) and not a temperature (so keeping #define TEMPERATURE_SOURCE NTC as comment), oXs sent the data with 2 decimals (e.g. 10,21 V) and it will be identified as "Voltage 1" in the jeti box.
If you want to replace "Voltage 1" by e.g. "Pressure" and "V" by "kPa" you should change one line of code in the file oXs_out_jeti.cpp
Change following line
mergeLabelUnit( textIdx, "Voltage 1", "V" ) ;
by (e.g.)
mergeLabelUnit( textIdx, "Pressure", "kPa" ) ;

Note : I think that the code for the unit type is max 5 car (to be checked).
I did not test this.
If it does not work, let me know.
Yogilours
Posts: 22
Joined: Tue Nov 21, 2017 6:49 pm
Country: -

Re: Reading analog pressure withMPX5700DP

Post by Yogilours »

All good !

I started to look inside the jeti.h file to find how the decimals are attributed. That was close ;)

Once again thank you !

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”