OpenXSensor vario configuration

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

OpenXSensor vario configuration

Post by RCgirl »

Can anybody help me make sense of the vario configuration?
I want to use a receiver channel to adjust the compensation of the vario.
I am using a baro sensor and an airspeed sensor, and I want to use the airspeed to compensate vertical speed.
In the basic config, I set:
#define FIRST_BARO_SENSOR_USE MS5611
#define VSPEED_SOURCE AIRSPEED_COMPENSATED
#define AIRSPEED_SENSOR_USE MS4525
In the advanced config, I set
#define PIN_PPM 3

But in the advanced config, I get drowned by all the PPM setting, which can be used to control sensitivity, vspeed switching and compensation.
Now which is it?
The documentation doesn't make much sense to me, the more I read, the more I get confused. How can one ppm signal determine all of these parameters? I don't want it to control sensitivity (I want to set a fixed value), or vspeed switching (I want to set it to baro compensated with airspeed).

There is a multitude of ppm settings, with the necessary comments on what they do, but how on earth do they combine? Very confusing.
Does anyone has an example on how to configure what I want to do?
Thanks!

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

Re: OpenXSensor vario configuration

Post by Carbo »

Only these lines are needed for your purpose:
#define AIRSPEED_RESET_AT_PPM 100 //send a pwm signal +100% to reset airspeed before start

#define COMPENSATION_MIN_AT_PPM 60
#define COMPENSATION_MAX_AT_PPM 90
#define COMPENSATION_PPM_MIN 80
#define COMPENSATION_PPM_MAX 140
Compensation is adjusted with a pwm signal from +60% to +90% between 80% (under-) and 140% (overcompensated).
Avoid sending pwm +10% to +40% cause this changes vario min. sensitivity. Min. sensitivity 50 worked for me: #define SENSITIVITY_MIN 50

4.6 is only useful, if you want to switch between compensated and uncompensated VSpd.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Ok, that makes sense.
I was going to write/draw it all out on paper, because I was starting to get a feeling that these values didn't overlap.
So all I have to do is to make sure that the slider on my radio sends out exactly this range.
Thank you so much for helping me out here!

Now I want to look for a way to add the compensation value to the telemetry values sent out.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

oXs is able to send PWM (PPM) back in a telemetry field. T1 or T2 is a good choice. With a suitable offset and ratio OpenTX should show compensation % directly. On my side I was happy with the PWM value since I adjust compensation acoustically. But you are right, it is smarter to convert it in compensation%.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

What I want to look into is sending out a telemetry value with the name "compensation" and send the exact value, so I can read it on my X10S radio directly.
What do you mean by "I adjust compensation acoustically"? Do you mean that you try different fixed values of compensation and then judge in-flight by means of the acoustic vario behavior?

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

Re: OpenXSensor vario configuration

Post by Carbo »

RCgirl wrote: Tue Dec 22, 2020 10:08 am What I want to look into is sending out a telemetry value with the name "compensation" and send the exact value, so I can read it on my X10S radio directly.
There are two different ways imo:
Activate #define FILL_TEST_2_WITH_PPM_AIRSPEED_COMPENSATION and transmit TEST_2 in a T1/T2 field and change the sensorname in OpenTX from T1/T2 to "comp" (I did not test it myself)
Or transmit back PWM(PPM) in a T1/T2 field and scale it accordingly in OpenTX. PWM 60-90 results in compensation 80-140. A ratio 512 (=2x) for the PWM sensor gives 120-180, offset -40 should exactly result in 80-140% compensation display (in theory, not tested yet because I was always happy to see raw PWM).
RCgirl wrote: Tue Dec 22, 2020 10:08 am What do you mean by "I adjust compensation acoustically"? Do you mean that you try different fixed values of compensation and then judge in-flight by means of the acoustic vario behavior?
First step is to find out when 100% energy compensation happens. Transfering speed into potential energy and vice versa should not result in a changing vario tone. E.g. flying loopings should result in a more or less constant vario tone. But high speed means always loosing energy due to drag. So 100% compensation is not realistic. The goal is a vario tone that represents the actual energy development of the glider. Energy differences because of up- or downwind should be noticeable, but energy transfers between cinetic and potential energy not.
If you adjust compensation in flight it will become clear.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

I was able to configure it to show the compensation value and the compensation setting in Tmp1 and Tmp2 telemetry values, but I wasn't really pleased with what I saw.
1) the Vspeed and airspeed values were all over the place, even when I dialed the compensation setting all the way down.
2) After a short time, I systematically get a "sensor lost" warning for the Tmp2 (TEST2) value, and this never recovers unless I restart the receiver and sensor.
When I switch Vspeed source to BARO1 (instead of AIRSPEED COMPENSATED), both the Vspeed and the airspeed are very stable again.
In TEST1, I have the CompensatedClimbRate, and that value is really all over the place, it goes up and down like crazy, no matter which setting I have in the PPM airspeed compensation setting.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

This is strange. Airspeed data should not change at all if the vario data source is changed. Please upload your config files.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

In this line:

// ***** 4.2 - Type of Vspeed to transmit *****
#define VSPEED_SOURCE FIRST_BARO // select between FIRST_BARO, BARO_AND_IMU, SECOND_BARO , AVERAGE_FIRST_SECOND, AIRSPEED_COMPENSATED or PPM_SELECTION

I had it set to AIRPSEED_COMPENSATED when the air data was acting up.
I then set it back to FIRST_BARO to test again, and air data was stable again.

That already led me to one conclusion: air data measurement itself is working fine.

Now I changed it to:
// ***** 4.6 - Vertical speeds calculations based on PPM *****
#define VARIO_PRIMARY AIRSPEED_COMPENSATED // select between FIRST_BARO, SECOND_BARO , AVERAGE_FIRST_SECOND, AIRSPEED_COMPENSATED , BARO_AND_IMU
#define VARIO_SECONDARY FIRST_BARO // select between FIRST_BARO, SECOND_BARO , AVERAGE_FIRST_SECOND, AIRSPEED_COMPENSATED , BARO_AND_IMU

And I think that is the solution, that is where the problem was: I used the compensated vspeed as second baro, which would create some sort of unstable control loop.
Now the air data is stable, and when I increase the compensation, I see the vertical speed getting more "unstable" (overcompensation).

But what remains a mystery to me is why the TEST2 value is lost after a minute or so. That still is the case.
EDIT: When I remove the FILL_TEST1_WITH_DTE (no longer reporting TEST1), the problem seems to be solved.

In attachment are the original config files of yesterday.
Attachments
oXs_config_advanced.h
(19.64 KiB) Downloaded 218 times
oXs_config_basic.h
(11.41 KiB) Downloaded 206 times
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

It is actually not intended that way.
#define VSPEED_SOURCE FIRST_BARO selects standard VSpeed from first physical baro sensor. MS5611 in your case.
#define VSPEED_SOURCE AIRSPEED_COMPENSATED selects airspeed compensated VSpeed
#define VSPEED_SOURCE PPM_SELECTION allows to switch between the two VSpeed defined in 4.6 (positive/negative PWM does the switching)

An easy test if compensation is active is to blow carefully into the pitot tube. Compensated VSpd reacts with positive values immediately, uncompensated VSpd does not change.

I did not update the code in my compensated varios for years, they still work perfect. There is a small chance that something broke in the code. There are not many pilots using compensated varios, so it may have gone unnoticed. I will try to flash one of my varios with the recent code and come back to you the next days if no one else has a better idea.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Ok, I set it according to what you stated, and now I can observe the behavior that you indicated: when I blow into the pitot, the vspeed changes. That wasn't the case with my previous settings.
I did see the airspeed and vspeed changing again, but when I turned the compensation factor below 100%, the changes in value became smaller.
I did find that the MS4525 airspeed sensor that I use shows considerable noise at very low to zero airspeed, which would explain the "instability" that I'm observing (at 0 airspeed). It does make sense that this then has an influence on the compensated vspeed.
I might try to have for instance and EDF unit blow at constant speed on the pitot, and then observe the measured airspeed value; it should be relatively constant.
Thanks again for thinking along.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

I did a test this morning logging airspeed measurement with the MS4525 sensor.
At rest, no airspeed, I get readings between zero and roughly 6.
I then had an EDF unit blowing over it at different speeds, and then you can see the margin/error on the reading decreases to around 2.
The vspeed varies with around +/- 0,2 m/s at low airspeed, but that variation increases to almost 1 m/s at slightly higher airspeed.

Compensation is set at 94% for this test.
Airspeed.png
(19.88 KiB) Not downloaded yet
Airspeed vspeed.png
(114.44 KiB) Not downloaded yet
I'm not really happy with those numbers.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

RCgirl wrote: Thu Dec 24, 2020 9:22 am At rest, no airspeed, I get readings between zero and roughly 6.
This is pretty normal. Variation decreases exponential with increasing airspeed. Imo it is better to simulate airspeed inhouse with a static pressure applied to the dynamic port of the MS4525. Vspeed should be nearly deadcalm inhouse at sensitivity 50. To be sure about the adjusted sensitivity it can be transmitted in a telemetry field.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Without compensation, vspeed was very stable at 0, and it wasn't responding "nervously" when moving the sensor up and down.
I will have a look at shortening the silicon tubing between pitot and sensor as much as possible, that can only improve performance of the airspeed measurement.
At normal airspeeds for a glider, around the 35 kts airspeed measured, variation on the vspeed is about +/- 0,8 m/s. That is not really good.
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

With the sensitivity dialed down to 20, airspeed fixed at 38kts with a syringe (but still fluctuating, might indicate a problem with the sensor), compensation at 82%, vspeed jumping between -0,4 and +0,4 m/s
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

RCgirl wrote: Thu Dec 24, 2020 11:32 am With the sensitivity dialed down to 20, airspeed fixed at 38kts with a syringe (but still fluctuating, might indicate a problem with the sensor), compensation at 82%, vspeed jumping between -0,4 and +0,4 m/s
Hmm, there is something wrong, airspeed and VSpd should be stable in your setup, even with sensitivity 50. Did you block MS4525 power supply with a capacitor near the sensor as described? And I would try if supplying Arduino over RAW with about 6,5V makes a difference (bringing Arduino regulator into play). I would also take care about some distance between TX and RX (telemetry) antennas and the sensors. But the last two are only guesswork.
Attachments
Vario_Airsp_GPS2.jpg
(338.61 KiB) Not downloaded yet
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

The supply voltage is 5,95V at the moment, and I did add a 100 nF capacitor to the airspeed sensor.
My next experiment was to switch between compensated and non-compensated with ppm. As soon as I switch to non-compensated, you see a super stable vspeed. As soon as compensation kicks in, values are all over the place again. I see only a minimal variation in airspeed, that shouldn't give me variations in vspeed of +/- 1 m/s anyway. Even with a value of 0 airspeed, the vspeed starts to "float around".

These are the settings that I used:
#define FIRST_BARO_SENSOR_USE MS5611
#define VSPEED_SOURCE AIRSPEED_COMPENSATED

#define AIRSPEED_SENSOR_USE MS4525

#define SECOND_BARO_SENSOR_USE NO_BARO
#define VARIO_PRIMARY AIRSPEED_COMPENSATED
#define VARIO_SECONDARY FIRST_BARO

I really wanted to show the graph of how stable the base measurements of vspeed and airspeed are without compensation, but somehow technology decided to abandon me completely today and decided to corrupt the logfile completely.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

Presumably you should test an older known working version now. Please find attached a 2016 oXs sketch which should work with your configuration out of the box. 2016 there was only one config file (config.h) but you will see a similar structure.
Attachments
Stratos2016.zip
(221.33 KiB) Downloaded 192 times
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Ok, I will give that version a try in the next few days, that should indicate whether or not the software is being the problem or not.
Merry Christmas, and thank you!
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Short update.
Problem was identical with your 2016 version, so it was a problem with hardware.
After some research, I found that capacitance on the i2C bus is important. As I had put hot-glue around the soldering of the connector between sensor and Arduino, this could have increased capacitance.
I removed the hot glue, but that still didn't solve the problem. I replaced the baro sensor module, and then things started to work close to normal.
Values still aren't super stable, but I'm wondering whether they ever are.
Airspeed is very hard to keep a constant value, even with the syringe, and thus I presume it is not so abnormal that the compensation logic responds to these small changes in airspeed.
I'm soldering new cables and connectors to it for final installation into the fuselage, and I think a good test flight will show whether or not it is usable as-is.
I will also have a look at existing telemetry logs of last summer, where I used the same baro sensor for the vario function, and compare the behavior with what I'm seeing now.
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

You are right. I've crosschecked with the 2016 version and compensated VSpd is indeed not useable. Now I remember I was using this version for glider performance measurement only. Then I've flashed back to 4.0 and everything worked as foreseen. Seems the newer versions are missing some filtering for airspeed data. Please find attached the tested V4.0 version. Sensitivity is transmitted in the fuel field, 50 is suitable again.
Attachments
openXsensor.zip
(124.1 KiB) Downloaded 127 times
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Ok, thanks for the effort you're doing for me.
I tested this version too, and monitored some values over telemetry.
In this first graph, the red line represents the compensation factor (scale axis on the right), the green line represents the vertical speed:
Image

As you can see, even for compensation factors under 90, vspeed jumps up and down by +/- 1m/s approximately.

I then added the measured baro altitude, and zoomed in on a portion where compensation = 0:
Image

You can clearly see the measurement error on baro altitude, and how that affects the vspeed calculation. But the effect is way smaller than when compensation > 0. The variation that I see here in vspeed is quite acceptable.
So, somehow, even with this version I'm getting unusable results.

What values for compensation are you using?
Attachments
varioV4_2.png
(29.92 KiB) Not downloaded yet
varioV4_1.png
(44.84 KiB) Not downloaded yet
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

This is a logfile with V4 I've just made. SC is switching between not compensated (1) and compensated VSpd (-1). There is +/- 0.1m/s noise in compensated mode (when airspeed is about constant) and no noise in not compensated mode. Sensitivity was 60% and compensation 110% in this case. If you test with identical setting we should see what causes your noise, baro or airspeed.
Unfortunately I was the only tester at the time, maybe we can now test on a broader basis.

Btw. when I made tests with the analog airspeed sensor, I had to add an RC filter to calm compensated VSpd down. The issue is presumably identical but could be solved with hardware: https://openrcforums.com/forum/viewtopi ... 00#p125971

Image
Attachments
Stratos_Test-2020-12-29.zip
(5.39 KiB) Downloaded 120 times
VSpd_comp.jpg
(208.45 KiB) Not downloaded yet
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

With exactly those settings, I get almost the same thing as before:
uncompensated: stable values, little noise
compensated: at airspeed 0, I get vspeed values between -2 and +2m/s
At airspeed different from 0, I see the response from the compensation, but I get higher fluctuations than what I see in your graph:
Image
Attachments
varioV4_3.png
varioV4_3.png (13.95 KiB) Viewed 13041 times
Carbo
Posts: 467
Joined: Fri Aug 02, 2013 6:55 pm
Country: Germany
Location: Freinsheim RP

Re: OpenXSensor vario configuration

Post by Carbo »

Your MS5611 seems to be OK since your VSpd (not compensated) is calm. Your MS4525 airspeed data seems also OK. Running the attached V4.0 firmware should result in a similar compensated VSpd with low noise (+/-0.1m/s). To crosscheck again I can flash the sketch you used in your test and report back. Or am I overlooking a detail?
RCgirl
Posts: 25
Joined: Sun Mar 23, 2014 1:58 pm
Country: -

Re: OpenXSensor vario configuration

Post by RCgirl »

Today I took up this project again, and re-soldered everything, keeping every lead and connection between the components as short as possible, hoping that this would explain the strange behavior, but alas, everything is still the same.
When I set compensation to 0, I get very normal values of airspeed and vspeed, and as soon as I enable compensation, the vspeed starts jumping in all directions. I'm really at a loss now, I think I'll just use it uncompensated, I want to get my glider ready for the flying season.

Post Reply

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