openXsensor V8.0 16bit ADC and analog Airspeedsensor

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

Mstrens extended the possibilities of oXs: oXs supports now ADS115, which supports 4 16bit ADC (or two differntial ADC). Also a (cheaper) analog airspeed sensor MPXV7002DP can be connected.

ADS1115 datasheet
Sensor kit

oXs_config_description.h includes the needed informations. Yes, the sandwich includes also an arduino pro mini.
Boden.png
Top.png
The noise is acceptable:
7002Noise.png
//The sensor seems to add an offset to the measurement.// <-- Edit: wrong, there is no offset! It shows exactly, what we should see:
pre_aspd.png
pre_aspd.png (6.13 KiB) Viewed 19053 times
The log shows the cooldown of a closed 35 cm silicone tube attached to the speed sensor. The tube was prior heated with my hand. The polarity is wrong, because i connected the sensor to ADS1115 wrong (swapped A0 and A1). These things happen, if one does not take care of the instructions in oXs_config_description.h ;)
7002Zerocrossing.png
Edit: The sensor shows indeed very good results.

Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

MS5611 (filtered) (red) vs. MPXV7002DP analog out over ADS1115 (blue). The voltage scale is x0.1. Looks promising.
7002vs5611.png
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

Mstrens added the code for dte vario and it is benchtested. It requires a RC filter of 100nF and 100kΩ connected to the analog out of the airspeed sensor to achieve a good 'sounding' dte variotone. The reaction time for airspeed change is still approximately instant.
Filter.jpg
Benchtests were made in a pressure chamber, with identical pressure for baro and airspeed. Static pressure for the airspeed sensor was taken from outside the chamber. Rising and lowering the pressure had nearly no influence on the dte vario tone. Rising pressure means more airspeed and less altitude and vice versa and this stands for the exchange between potential energy and kinetic energy. Flying tests will be done as soon as the weather permits. I like to search thermals with dte vario and circle with baro vario. The switching between dte and baro and the reset of airspeed (in case of an offset after boot) can be done with a PPM signal connected to PIN3.

PPM 10 --> 40 baro vario and control of vario sensitivity from 20-200
PPM -60 --> -90 dte vario and control of energy compensation from 80-140%
PPM 100 --> airspeed reset
PPM.png
PPM.png (6.48 KiB) Viewed 18973 times
L1 is SH AND rudder -100 to prevent airspeed reset in flight.

Values are valid for this
oXs_config.zip
(4.53 KiB) Downloaded 387 times
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

Flight peformance is also OK. Dte vario is still a little noisier than the baro vario and needs more RC filtering, but it is already useable.

This is an example where i switched from dte (plane flying phugoids unintentionally-you do not hear them because of energy compensation) to baro vario, where i immediately and unconsciously calmed the plane down.
Comp3red.png
Richard
Posts: 183
Joined: Sat Mar 29, 2014 10:44 pm
Country: United States
Location: Coral Springs, FL

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Richard »

Hey, Carbo, after following your lead on the GPS sensor, which looks OK and I will test it today in a plane, I am looking to add the airspeed sensor. I have a couple of questions in that reference:
1) Which is the reason to put together an airspeed sensor in lieu of the FrSky? Are we looking for delays or inaccuracy like with the GPS?
2) Given that the arduino seems to have analog ports, what's the reason to use an AD converter?
3) can you provide the wiring for the sensor>AD converter>Arduino?
4) can you suggest suppliers for the converter, sensor and pitot?
Thanks a lot.
Richard

Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

1) When mstrens developed the airspeed sensor, there was no sensor available from FrSky. I did never test the FrSyk airspeed sensors, when they finally arrived. The main oXs advantage is the possibility of a dte vario for gliders (needs an additional GY-63 MS5611 pressure sensor). But presumably the FrSky sensor is also OK for airspeed measurement (personally i am trusting only mstrens sensor code ;)).
2) There is an offset of VCC/2 on the output of the ADS7002 and Arduino A/D has only 10 bit resolution, not enough for a exact mesaurement and a dte vario with reasonable resolution.
3) ADS115: GND-->GND, VCC-->VCC, SCL-->A5, SDA-->A4, A0 -->VCC/2 (VCC voltage divider with 2x~10k), A1 --> 100k -->ADS7002 analog out, also A1 --> 100nF --> GND
4) The link in post #1 is still active, a search with "MPXV7002DP Differential Pressure for APM PX4 Pixhawk" will bring more options

There is also the more expensive and more accurate (and harder to find) digital airspeed sensor 4525DO-DS5AI001DP possible with oXs. Building instructions can be found as usual in mstrens oXs_description.h.

A Hacker duplex pitot tube is also a more expensive, but smaller alternative. You can find it here:
https://www.hacker-motor-shop.com/Radio ... 1415&p=883
viewtopic.php?f=86&t=8688#p114979
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by jhsa »

There are some really cheap arduino type (and compatible with arduino) boards that use a STM chip. I just ordered a few for a couple dollars each.


Sent from my BLN-L21 using Tapatalk

My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Richard
Posts: 183
Joined: Sat Mar 29, 2014 10:44 pm
Country: United States
Location: Coral Springs, FL

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Richard »

Carbo, thank you for your comments. Now it makes sense the external AD converter.
Richard
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Hi,
I’m new on this forum and I’m looking for a speedSensor capable of measuring the L/D ratio.
I have F5j models with very low wing loading thus they are flying very slowly in cruise mode.
Could you please tell me which sensor is most suitable at slow speed?
I have fly on Jeti as well and I’ve seen that it is compatible… true ?
Thanks for your return,
Bertrand
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

I do not use Jeti myself. When you look into the file oXs_config_description.h (2.4 - Jeti data), it seems that airspeed is not yet supported in oXs for Jeti. Eventually mstrens, the developer, chimes in, or you can contact him per PM.
I have used the 4525DO sensor for glider performance measurement with success. But i did not yet measure at very low airspeed, like a F5J plane can do. In my pov the average sink is more important when you fly slowly. L/D ratio can be measured reliable at airspeeds > 10m/s.

Here you can see some results: viewtopic.php?f=86&t=8688
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by mstrens »

For sure, 4525DO sensor will provide better results than 16 bits adc + analog airspeed sensor.
For very low speed I would not recommend the analog airspeed sensor.

Carbo is rigth: current version of oXs does not transmit the airspeed for Jeti protocol. Still I can easily add it if there is a request.
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Thanks for the quick answer.

If even the digital sensor is not able to measure speed lower than 10 m/s (35km/h) what about measuring the speed with a GPS in calm air to find the optimum glide ratio ?
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by Carbo »

You can measure airspeed at 20km/h. But you will get some error. The differential pressure at 20km/h corresponds to an altitude change of 1.7m. It is like trying to measure your body height with a barometric sensor. Small changes in your planes setup can hardly be seen in the L/D ratio at low speed. Better watch average sink, it can be measured more precisely here. When airspeed is in the 10m/s range, it can be measured also more precisely. 10m/s differential pressure corresponds to an altitude change of 5.5m. L/D measurement works for higher airspeed, average sink for low airspeed. L/D measurement helps to improve performance in speed mode, average sink is suitable for thermal and cruise mode.

GPS measurement is a lot affected from windspeed. You can try to use GPS speed or GPS distance and time to measure L/D, but you will find, that this method gives you more errors at any speed.

After all i have learned a lot, when i measured glider performannce. About the physics, about the glider and about me ;) It really helps to understand things better and to improve the performance. In my case it was about 70% performance of the pilot and 30% performance of the plane:)
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Very interesting, Thank you very much for this very clear information Carbo ;)
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by mstrens »

fyi, I just checked the code and I noticed that airspeed should be sent with jeti protocol when 4525DO sensor is used.
Doc has then probably to be modified.
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Oh very good news, Thanks
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Ok it works pretty well in the workshop (not yet tried it outdoor considering the current weather here in north of France) As I'm on JETI I had to add the rise of the enlapsed time, averageVspeed and gliderRatio fields as it was not implemented in the current version.
Thanks for the great job ;)
User avatar
ddano007
Posts: 41
Joined: Thu Nov 13, 2014 8:40 pm
Country: Slovakia
Contact:

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by ddano007 »

Guys, can you help me, please, with MPXV7002DP?
This is my config:

oXs_config_basic.h:

// ***** 2.1 - Frsky data *****
...
#define ACCY_SOURCE ADS_VOLT_1 // select between TEST_1, TEST_2, TEST_3, GLIDER_RATIO , SECONDS_SINCE_T0 ,AVERAGE_VSPEED_SINCE_TO , VOLT_1, VOLT_2, VOLT_3, VOLT_4, VOLT_5, VOLT_6, PITCH, ROLL , YAW, ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4

oXs_config_advanced.h:

// ***** 6.6 - Ads1115 parameters *****
#define ADS_MEASURE A0_TO_A1 , ADS_OFF , ADS_OFF , ADS_OFF // select 4 values between A0_TO_A1, A0_TO_A3, A1_TO_A3, A2_TO_A3, A0_TO_GND, A1_TO_GND, A2_TO_GND, A3_TO_GND, ADS_OFF
#define ADS_FULL_SCALE_VOLT MV2048, MV2048, MV2048, MV2048 // select between MV6144 MV4096 MV2048 MV1024 MV512 MV256
#define ADS_OFFSET 0, 0 , 0 , 0 // must be an integer (positive or negative)
#define ADS_SCALE 1, 1, 1, 1 // can be a float
#define ADS_RATE MS2 , MS2, MS2 , MS2 // select between MS137, MS69, MS35, MS18, MS9, MS5, MS3 , MS2
#define ADS_AVERAGING_ON 8 , 8, 8, 8 // number of values used for averaging (must be between 1 and 254)
//#define ADS_CURRENT_BASED_ON ADS_VOLT_1 // uncomment if current, and comsumption have to be calculated based on one of ADS voltage measurement; select then the voltage to be used between ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
#define ADS_AIRSPEED_BASED_ON ADS_VOLT_1 // uncomment if airspeed (and dte) have to be calculated based on one of ADS voltage measurement ; select then the voltage to be used between ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4

I have D8R RX, and in Taranis I have setup for AccY:
Unit kmh
Precision 0.00
Ratio 10
Offset 0

When I connect ADS1115 input (A0) to GND, in Taranis I have AccY = -80.30kmh, when I connect it to +5V, in Taranis is +80.31kmh.
A1 I have connected to 5k + 5k resistors ( +2.5V). Normaly at MPXV7002DP output is approx 2.6V = 6kmh. Blowing into pitot tube has no noticeable response :-(
My questions:
1, is my config on OXS correct?
2, what should be MPXV7002DP measurement range in Taranis. Electrically it is +0.5v to 4.5V, so +/-2V differentionally to A1. It represent what speed?
Thanks,
Daniel
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by mstrens »

in oXs_config.h you should have
#define AIRSPEED_SENSOR_USE MPXV7002 // select between NO_AIRSPEED , MS4525 , MPXV7002
Then airspeed will automatically be sent as airspeed.

So you can put next line as comment
#define ACCY_SOURCE ADS_VOLT_1

Note : if I remember wel, airspeed values sent by oXs for Frsky protocol are in knots/h and it is the Tx that convert them in km/h (in metric).
So I expect (but I am not sure) that the max airspeed is about 80 * 1.8
User avatar
ddano007
Posts: 41
Joined: Thu Nov 13, 2014 8:40 pm
Country: Slovakia
Contact:

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by ddano007 »

Yes, of course I have
#define AIRSPEED_SENSOR_USE MPXV7002 // select between NO_AIRSPEED , MS4525 , MPXV7002
I forgot it to write it here :-(
Well, if I will comment AccX, speed will be send as what variable... ? In FrSky Hub protocol I see nothing for airspeed :-(
And once more: the measurement range of MPXV7002 in Taranis should be 80 * 1.8 km/h? This is max value from MPXV7002 ( it means 4.5V), or it`s value of Ads1115 full scale ( A0 connected to +5V)?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by mstrens »

You are right: there is no field ID for airspeed in Hub protocol.
So, you can use another field like Temp or AccX.

Please note that openTx handles AccX,Y,Z in a special way.
For Acc, the values are normally calculated/transmitted by the sensor in 1/1000 but they are displayed in 1/10
So the Tx discards the 2 last digits and put a comma.
You can fix this by changing the oXs value just before sending it.


in the config, if you activate #define AIRSPEED_IN_KMH, the value calculated by oXs will be in 1/10 of km/h, otherwise it will be in 1/10 of knot/h

In order to get airspeed for Hub protocol, the easiest would be to use a config asking for sending TEST_1, 2 or 3 and to add a few lines of codes in the ino file at the end of the function calcualte_all_fields(). Here the code is for using TEST_1
Note: I did not test this code so there still could be some bug.

#if ( defined(AIRSPEED) && (defined(AN_ADS1115_IS_CONNECTED) && (AN_ADS1115_IS_CONNECTED == YES ) && defined (ADS_MEASURE) && defined (ADS_AIRSPEED_BASED_ON) )
if ( oXs_ads1115.adsAirSpeedData.airSpeed.available == true ) {
test1.value = oXs_ads1115.adsAirSpeedData.airSpeed.value ;
test1.available = true ;
oXs_ads1115.adsAirSpeedData.airSpeed.available = false ;
}
#endif

The MPXV7002 measures max 2000 pa.
I checked on internet and it should be equivalent to about 200 km/h.
User avatar
ddano007
Posts: 41
Joined: Thu Nov 13, 2014 8:40 pm
Country: Slovakia
Contact:

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by ddano007 »

OK, thanks a lot for Your response , I will try it.
So as I understand it:
1, in Taranis I must setup precision & range for AxxY ( I was wrong before, on AccX I have Model_QID) so that I get 200km/h at 2V from ADS1115?
2, special handling of Acc values I noticed before :mrgreen:
3, oXs_ads1115.adsAirSpeedData.airSpeed.value is recalculated speed value from ADS_VOLTx?
4, is the dependency volt( pressure) -> speed linear? So when I select PGA range to 1024mV the speed range will be up to 100km/h? The reason is: 200km/h is too high for my foamies, 100 ( maybe 50) km/h will be enough...
5, is it possible to decrease sampling rate say to say 18ms and 10 samples averaging? Or the code is tuned for 2ms sampling?
Thanks.
EDIT:
4, answer is no :oops:
https://www.grc.nasa.gov/www/k-12/Virtu ... pitot.html
User avatar
ddano007
Posts: 41
Joined: Thu Nov 13, 2014 8:40 pm
Country: Slovakia
Contact:

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by ddano007 »

Guys, is it possible to use on A0 reference mid- supply 4k7 + 4k7 and on A1 input from MPXV7002DP with
#define ADS_MEASURE A0_TO_A1 , ADS_OFF , ADS_OFF , ADS_OFF
configuration?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by mstrens »

Yes it can.
The value of the resistors is not critical (I proposed 10k byt 4.7k is ok too).
I proposed the resistor to pin A1 and sensor to pin A0 but it is the same

Here an extract form oxs_config_description.h

* In ADS_AIRSPEED_BASED_ON, you specify which voltage measurement (if any) is used for airspeed
* Uncomment this line only when an analog airspeed sensor is connected to ads1115
* Keep this line as comment if there is no airspeed sensor connected to ads1115
* Fill only one value; select a value between ADS_VOLT_1, ADS_VOLT_2, ADS_VOLT_3, ADS_VOLT_4
* Note : A typical airspeed sensor is the MPXV7002DP which is easaly available on ebay or aliexpress.com.
* When this sensor is used, you have to configure ads1115 in following way:
* - ask only for one ads1115 measurement and it must be a differential voltage : so use this setup : ADS_MEASURE A0_to_A1, ADS_OFF, ADS_OFF, ADS_OFF
* - connect one resistor of about 10kohm between ads1115 Vcc and ads1115 A1 and another one of the same value between ads1115 Ground and ads1115 A1; so A1 pin get Vcc/2 volt
* - set the ads1115 gain in order to get 2048 mvolt at full scale: so use : ADC_FULL_SCALE_VOLT MV2048,MV2048,MV2048,MV2048
* - set the ads rate in order to make ADC conversion as fast as possible; so use : ADS_RATE MS2, MS2, MS2, MS2
* - the other parameters are not critical (not used for airspeed)
User avatar
ddano007
Posts: 41
Joined: Thu Nov 13, 2014 8:40 pm
Country: Slovakia
Contact:

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by ddano007 »

OK, thanks.
I read oxs_config_description.h, but it`s not clear from it, whether A0 and A1 can be swapped. It`s better for wiring. Some photos from my yesterday`s build:
Input resistors 56k 0603 size + baro.
Input resistors 56k 0603 size + baro.
100nF caps and 4k7 resistor 0805 size on bottom. Above 4k7 resistor there is also 100nF cap.
100nF caps and 4k7 resistor 0805 size on bottom. Above 4k7 resistor there is also 100nF cap.
OXS + connector board.
OXS + connector board.
In box.
In box.
Complete :-)
Complete :-)
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Hi,

Line 468 of oXs_out_jeti.cpp the airspeed value is multiply by 1.852 !
Could you please confirm that it is a bug ?
The AIRSPEED_IN_KMH option do the job isn't it ?

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

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by mstrens »

It is not really a bug I understand it can be quite confusing.
The first protocol being implemented was Frsky. In this protocol airspeed had to be in knot/h and it was the Tx (e.g. openTx firmware) that converts it to km/h (if wanted). In Frsky protocols units are not sent by the sensors and so the values are supposed to be always in the same type of units.
Still in one of the version of openTx, the conversion was not done anymore. So I added the possibility to let oXs calculates directly in km/h.
Newer version of openTx fixed it and this option is not needed anymore (but I did not removed it up to know).
This option was supposed to be used only for Frsky protocol.

For a protocol like Jeti, oXs has to sent as well the value as wel as the unit. Currently, I have not foreseen to send the airspeed in knots/h.
So I sent it always in km/h and I always convert the internal value (knots/h) to km/h before sending it.
If you activate the option AIRSPEED_IN_KMH , you are right that the conversion occurs twice in Jeti (or Hott) protocol (once when airspeed is calculated and once when data is sent).
I can avoid this in a future version.
bwilmot
Posts: 7
Joined: Thu Nov 02, 2017 7:05 pm
Country: -

Re: openXsensor V8.0 16bit ADC and analog Airspeedsensor

Post by bwilmot »

Hi mstrens,
We are on the same page, it is not a bug ;)
Thank you for the fantastic work you have done.
I cant wait to try my brand new sensor on my maxa as soon as the weather will be milder.
Bertrand

Post Reply

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