New beta version of openXsensor (=openXvario)

Development & General Chat for the superb openxvario project.

Moderator: rainer

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

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

jhsa wrote: Fri Apr 07, 2017 12:55 pm
mstrens wrote: Fri Apr 07, 2017 11:26 am Another solution could be to use a differential pressure sensor like the MPXV7002DP.
This is already supported by oXs.
Hmmm, how would you do this? because on glow fuel powered models the fuel tank is most of the times pressured by the exaust gases, so it pushes the fuel to the engine's carburator..

João

EDIT: Minimum operating temperature from this sensor is 10ºC? This is not even good for measuring airspeed :mrgreen: Not where I live anyway ;)
This is not an issue because it is a differential sensor. It has 2 inputs. You connect one input to the top of the tank (in the air) and the other to the bottom.
This kind of pressure sensor is quite accurate and does not need calibration.

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

Yes, but the pressure inside the tank is not always the same.. Depends on the pressurization from the motor, I believe..
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
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: RE: Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

RightRudder wrote:The elements can be epoxy coated so electrical potentials are insulated from the fuel. It doesn't need to be vertical, it can be on an angle but it needs to cover the vertical distance from max to min fuel. This approach avoids the problems you mentioned with external plates and tank sizes, proximity to external things that can change the capacitance etc. This commercial one is made for measuring fuel on airplanes.

https://www.aircraftspruce.ca/catalog/e ... uelsys.php
An aerobatic airplane is always changing position..
When that sensor is horizontal, it doesn't work.. :)

Anyway, I am trying some stuff here.. :)

João
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
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

jhsa wrote: Fri Apr 07, 2017 5:48 pm Yes, but the pressure inside the tank is not always the same.. Depends on the pressurization from the motor, I believe..
As it is a differential pressure, it measures only the difference of pressure between top and button of tank. This is only the height of the liquid
User avatar
Kilrah
Posts: 11108
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: New beta version of openXsensor (=openXvario)

Post by Kilrah »

jhsa wrote: Fri Apr 07, 2017 5:48 pm Yes, but the pressure inside the tank is not always the same.. Depends on the pressurization from the motor, I believe..
Yeah but a differential solution makes that irrelevant. Still problematic for orientation changes though.

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

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

I had a look at the code.
It can't be used in oXs because it uses the CPU for a long time.
It should be totally rewritten in order to use arduino timer and perhaps interrupts.
I do not think it can be quite reliable.
Even if it is once calibrated, I expect that it will drift over time and temperature.

I think it is better to use a chip to measure the capacity.
I founded this module which is cheap.
https://fr.aliexpress.com/item/J34-Free ... f8ad461ce5

It can detect up to 12 touch pad.
If the touch pads are disposed in a matrix of 5 * 7 on one side of the tank, it could detect some good level indication even if the tank is not flat.
I do not know if someone use it already for such a purpose
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

I made a mistake in previous post. A matrix of 5 * 7 pads can only work when only one pad is active at the same time.
In our case, we can only use 12 pads that could be arrange in e.g. 4 * 3

There is a cheap board on aliexpress that should probably work out of the box (need rigth arduino code) if it fit the tank dimension.
https://fr.aliexpress.com/item/Free-shi ... 8306d43a2b

A solution around MPR121 seems me far better.
This chip can measure up to 13 capacitors with a higher accuracy than just an Arduino. It integrates 3 levels of filtering and discharge a lot the Arduino.
Measuring several pads should allow to get better accuracy than with only one pad.
Taking care of the orientation of the tank would also be better.
Chip also include a kind of autocalibration in order to find good values for internal setup.
It would not avoid some calibration with real tank. Still using several pads provide a much better alarm detection of low level even if device is not perfectly calibrated.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

Thanks for your help Mstrens, I will have a look for sure. But people that know me from this forum since 7 years know that I don't quit ideas that easily until I prove that they don't work one way or the other :)
So, I for now I will continue to give this a try.
I think that one of the big problems of a capacitive setup like this might be the proximity of other metal objects in the model.
For now, I might have found a way of connecting it to the oXs :)
Will test it.

Thank you

João
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
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

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
Zebble
Posts: 7
Joined: Tue Apr 11, 2017 4:38 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by Zebble »

mstrens wrote: Fri Jan 27, 2017 1:26 pm Here a version of oXs that should calculate the temperature using a NTC.
I did not (yet) put the new parameters and the description in the 2 oXs_config files but you can find some description starting at line 980 in the .ino file.

If this is not clear of if you do not get the expected result, just let me know.

Note : this has been added to the beta version 8 which should normally support Jeti protocol, an external ADC (to increase accuracy and support another airspeed sensor) and BMP280 baro sensor.
Thanks mstrens!

NTC code looks fantastic. Thanks for adding this!

Looks like it's locked to a single sensor. Any chance of extending this to additional sensors, or am I missing something?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

[/quote]

Looks like it's locked to a single sensor. Any chance of extending this to additional sensors, or am I missing something?
[/quote]

It is not clear for me what you mean by "locked to a single sensor".

One oXs device replies to some sensor ID's send by the Rx (in fact oXs can send several data on the same ID).
The ID's used by oXs can be defined in file oXs_out_frsky.h in following lines.
The values have to be selected in the list here below. I will add later a better explanation in the oxs_config_description.h file

#define DATA_ID_VARIO 0x00 // = sensor 0
#define DATA_ID_FLVSS 0xA1 // 1
#define DATA_ID_FAS 0x22 // 2
#define DATA_ID_GPS 0x83 // 3
#define DATA_ID_RPM 0xE4 // 4
#define DATA_ID_ACC 0x67 // 7
// #define DATA_ID_SP2UH 0x45 5
// #define DATA_ID_SP2UR 0xC6 6

//list of 28 device ID codes is (in sequence)
// 0x00,0xA1,0x22,0x83,0xE4,0x45,0xC6,0x67,0x48,0xE9,0x6A,0xCB,0xAC,0x0D,0x8E,0x2F,0xD0,0x71,0xF2,0x53,0x34,0x95,0x16,0xB7,0x98,0x39,0xBA,0x1B
Zebble
Posts: 7
Joined: Tue Apr 11, 2017 4:38 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by Zebble »

mstrens wrote: Tue Apr 11, 2017 8:14 pm
Looks like it's locked to a single sensor. Any chance of extending this to additional sensors, or am I missing something?
[/quote]

It is not clear for me what you mean by "locked to a single sensor".
[/quote]

Hi mstrens!

My apologies. I should have clarified. The new NTC code seems to be locked to a single sensor. Any chance it will be extended to more?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

Indeed, in current code, only one NTC is supported.
Do you need more than one. If so how much?
RightRudder
Posts: 241
Joined: Tue Jan 15, 2013 9:41 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by RightRudder »

I haven't downloaded the latest oXs version to see, but on www search I found this code which allows you to enter the coefficients for your own thermistor, in the last section of this page:

http://playground.arduino.cc/ComponentLib/Thermistor2
Zebble
Posts: 7
Joined: Tue Apr 11, 2017 4:38 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by Zebble »

mstrens wrote: Wed Apr 12, 2017 6:21 pm Indeed, in current code, only one NTC is supported.
Do you need more than one. If so how much?
Would be good to have at least 2 (Same as the Frsky RPM sensor), 5 would be awesome for a friend who is running a 5-cylinder radial.

I assume the intention is to make them available as config options (ie. #define T1_SOURCE VOLT_1) or something similar? Perhaps #define T1_SOURCE NTC_1, etc?

I'm new to the OXS code, but will help where I can if you want to point me in the right direction to make these config options.

Thanks again,

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

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

Zebble wrote: Wed Apr 12, 2017 9:11 pm
mstrens wrote: Wed Apr 12, 2017 6:21 pm Indeed, in current code, only one NTC is supported.
Do you need more than one. If so how much?
Would be good to have at least 2 (Same as the Frsky RPM sensor), 5 would be awesome for a friend who is running a 5-cylinder radial.

I assume the intention is to make them available as config options (ie. #define T1_SOURCE VOLT_1) or something similar? Perhaps #define T1_SOURCE NTC_1, etc?

I'm new to the OXS code, but will help where I can if you want to point me in the right direction to make these config options.

Thanks again,

-zeb
I will look at the easiest way to implement several NTC in future version.
Config would be easier if all NTC have the same characteristics. Is this acceptable?
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

Is it possible to configure a NTC and insert its value in the code?

Thanks
João

Sent from my thor 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
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

Yes, latest version on github support one NTC.
It was just for a test for a member so it is not yet documented in config.h file.
Still it is documented in the ino file. Just do a search on NTC.

Later on I will move the documentation to a better place
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

That is interesting, thanks. I am about to use a TMP37 temperature sensor, but its max temperature is quite close to the engines temperature, so I'm not quite sure if it would be idea. The NTC might be a good option. Any link for the best one?

Thanks.

João

Sent from my thor 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
Zebble
Posts: 7
Joined: Tue Apr 11, 2017 4:38 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by Zebble »

mstrens wrote: Thu Apr 13, 2017 6:04 am I will look at the easiest way to implement several NTC in future version.
Config would be easier if all NTC have the same characteristics. Is this acceptable?
Thanks mstrens!

One would likely be just fine. If it's possible to add 2, I think that's the max that would ever be needed. The most common seem to be 10K or 100K and any implementation would likely keep the same coefficient of each one...
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

One option to keep config simple and to reduce the number of data being sent could be to calculate and transmit only one temperature (the max) of several NTC and to consider that each NTC have the same coefficient.
Is this good enough?
Zebble
Posts: 7
Joined: Tue Apr 11, 2017 4:38 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by Zebble »

mstrens wrote: Sat Apr 15, 2017 2:45 pm One option to keep config simple and to reduce the number of data being sent could be to calculate and transmit only one temperature (the max) of several NTC and to consider that each NTC have the same coefficient.
Is this good enough?
For anything more than 2 cylinders, that would be fine. If the "hottest" cylinder could be identified somehow, that would also be beneficial. For 2 cylinders, it would be better to have individual temperatures.

Does that make sense?
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

I have prepared a new version where you can measure up to 6 NTC (with the same characteristics).
When there is only one or two, you can get the temperature(s).
When there are more than 2, you get the lowest and highest temperature and the index of the highest.

I will put it soon on github
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

Nice addition.. Thanks.
Now, how would I connect an NTC to the oXs? Just directly to an analog input or would it be part of some resistor divider with one going to VCC?
Sorry if this was already covered..

João

Sent from my thor 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
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

it wil be explained in the config description.

Here the draft:
// 6.4 - Convert voltage to temperature (° Celcius) ********************************************************************
* In order to measure a temperature it is possible to use special electronic component (like lm35) that generates a voltage proportional to the teperature.
* In this case, you can just connect the output of this component to an arduino analog pin and configure oXs in section 6.2 in order to measure the voltage.
* Adding an offset and a scaling (see section 6.2) accordingly with the characteristic of you component, oXs can directly calculate the temperature in the defined measurement Voltage.
* You can then ask oXs to transmit this voltage to the desired telemetry field (e.g. T1) filling a set up as explained in section 2.
*
* Still this kind of component is not foreseen to measure high temperature (e.g. higher than 150 °C).
* You can then use thermistors (= NTC).
* The drawback of NTC is that the generated voltageis not proportional to the temperature and it requires some extra calculations.
* oXs let you use one or several NTC (e.g. one per cylinder) in order to measure high temperature(s).
* For each NTC, you have to add a resistor in serie accordingly to this schema
* < Arduino Vcc > --[serie resistor]-- <Arduino analog pin> --[NTC]-- <ground>
* If you use several NTC, all NTC and resistors have to be identical and they have to be connected to Arduino analog pin that are consecutive (as defined in PIN_VOLTAGE)
*
* oXs reuses the mVolt calculated by oXs. The config must be adapted in a such a way that this mVolt is equal to the raw value returned by the ADC * 1000 (for better accuracy)
* Therefore, in section 6.1 and 6.2 ,
* USE_INTERNAL_REFERENCE must be as comment (so with // in front off)
* USE_EXTERNAL_REFERENCE must be as comment (so with // in front off)
* REFERENCE_VOLTAGE must be as comment (so with // in front off)
* RESISTOR_TO_GROUND must be set on 0 (for the index being used)
* OFFSET_VOLTAGE must (normally) be set on 0 (for the index being used)
* SCALE_VOLTAGE must be set on 204.6 (=1000 * 1023/5000) (for the index being used)
* Then you have to define some parameters in section 6.4
* FIRST_NTC_ON_VOLT_NR specify index of first voltage being used for conversion to temperature (e.g. 3 means VOLT_3) (so it is not the code of analog pin; this one is define in section 6.2)
* LAST_NTC_ON_VOLT_NR specify index of last voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
* In this expample, it means that you expect to measure 3 temperatures based on NTC connected to the pins used for VOLT_3, VOLT_4 and VOLT_5
* note: if you use only one NTC, you must specify the same value for FIRST_NTC_ON_VOLT_NR and for LAST_NTC_ON_VOLT_NR
* if you do not use NTC, keep this line as comment
* SERIER_ESISTOR specify the resitance (in Ohm) connected between Arduino Vcc and NTC (and analog pin)
* TERMISTOR_NOMINAL specify the nominal resistor of NTC (in Ohm) (e.g. 100000)
* TEMPERATURE_NOMINAL specify the nominal temperature of NTC (in degree Celcius) (e.g. 25)
* B_COEFFICIENT specify B coefficient of NTC (e.g. 3950)
* Those last 3 parameters depend on the thermistor being used; they are normally specified in the datasheet of the NTC
* For best result, select a SERIERESISTOR that is nearly equal to the NTC resistor at the temperature that you expect to measure.
* When you use 1 or 2 NTC, the temperature(s) will be registered in VOLT_X and VOLT_Y where X is the value of FIRST_NTC_ON_VOLT_NR and Y the value of LAST_NTC_ON_VOLT_NR
* If you use more than 2 NTC, oXS will register in :
* VOLT_X the lowest temperature
* VOLT_X+1 the index of the highest temperature (1 being the index of the first NTC)
* VOLT_Y the highest temperature
* You can then define how to transmit those data in section 2
************************************************************************************************************************
//#define FIRST_NTC_ON_VOLT_NR 5 // uncomment this line when thermistor are used; specify index of first voltage being used for conversion to temperature (e.g. 5 means VOLT_5)
#define LAST_NTC_ON_VOLT_NR 6 // specify index of last voltage being used for conversion to temperature (e.g. 6 means VOLT_6)
#define SERIE_RESISTOR 4700 // resitance connected to Arduino Vcc (in Ohm)
#define TERMISTOR_NOMINAL 100000 // nominal resistor of NTC (in Ohm)
#define TEMPERATURE_NOMINAL 25 // nominal temperature of NTC (in degree Celcius)
#define B_COEFFICIENT 3950 // B coefficient of NTC
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

Thanks

João
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
Zebble
Posts: 7
Joined: Tue Apr 11, 2017 4:38 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by Zebble »

mstrens wrote: Mon Apr 17, 2017 6:47 am I have prepared a new version where you can measure up to 6 NTC (with the same characteristics).
When there is only one or two, you can get the temperature(s).
When there are more than 2, you get the lowest and highest temperature and the index of the highest.

I will put it soon on github
That's great mstrens! Thanks so much. Looking forward to testing.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

I put on github a new branch named "test with magnetometer".
It is version 8.2.0.
It is just a beta version; it means I did not really test it.
It contains quite many changes:
- oXs_config.h file is now splitted in 2 files oXs_config_basic.h and oXs_config_advanced.h. The idea behind is that in most cases, a user should only edit the basic file. I hope it reduces the complexity for most users. In basic file there nearly no need anymore to comment/uncomment some lines (just select now the type of sensor or YES/NO)
- oXs can calculate the heading given by the magnetometer HMC5883 which is part of the GY-86 module. This was asked by user that wanted to add an oXs in the Tx and compare the position/orientation of the Tx with those of the plane.
- oXs can calculate one or several temperature(s) based on thermistors (which is an advantage to mesure high temperatures)
- oXs can calculate the fuel consumption if it is connected to a fuel flow sensor
- the advance file allow to modify the SPORT_SENSOR_ID (useful in case of conflict when several sensors are used simultanously)
- the advance file allow to specify several ways of filling TEST_1, TEST_2, TEST_3 allowing to send some more data to TX.

Let me know if you find some bugs.
I will put this version in master branch when it is tested enough.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: New beta version of openXsensor (=openXvario)

Post by jhsa »

mstrens wrote: Tue Apr 18, 2017 10:45 am
- oXs can calculate the fuel consumption if it is connected to a fuel flow sensor
I am still working on the Capacitive fuel sensor idea. I don't give up an idea that easily :)
But no changes will be needed to oXs. It will connect to it via an analog pin and detect a voltage.
Latest addition is an ACC so the arduino will read the capacitor (Tank) when the model is close to level..

João
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
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: New beta version of openXsensor (=openXvario)

Post by mstrens »

What do you use to convert capacitor to analog voltage (an electronic board with a 555 ?)
Why not trying to use a MPR121. The board is only about 1€5 on aliexpress and it offers much more and is foreseen to measure low capacity.

I expect that using an ACC to detect when the model is close to level will require quite a lot of filtering (can easily be done in arduino) due to the vibration.

Post Reply

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