Individual cell voltages.openTx 2.2

Development & General Chat for the superb openxvario project.

Moderator: rainer

Post Reply
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Individual cell voltages.openTx 2.2

Post by Chrisbott »

Hi, new here, hope you don't mind looking at my question?

I have built a few OpenXsensors simply to report Current and VFas. They work superbly.

I'm now trying to measure individual cell volts as well but OpenTx doesn't discover any extra sensors. I'm using OpenTx 2.2 on a Horus.

I can configure so that voltages A3 and A4 are reported but that's not what I want.

Should I be seeing a "Cells" sensor, like the FrSky version?
Any ideas where I'm going wrong?

Thanks.

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

Re: Individual cell voltages.openTx 2.2

Post by mstrens »

Normally you should get "Cells" sensor like the Frsky version.
In order to get individual cells voltage, you have to take care that:
- the line "#define NUMBEROFCELLS " is uncommented and that you assign it a value equal to the number of cells to measure (e.g. 2); when the value is 0, oXs does not calculate/transmit individual cell voltage.
- in line "#define PIN_VOLTAGE " you set as first value the pin connected to first cell and as second the pin connected to the second cell
- you have to connect a 2s lipo (so both pins get simultanously a voltage in the expected range because individual cell voltages are transmitted only if there are more than 0.5 V (and probably less than 5V))

Note : if you use A4 for cell measurement, take care not to activate in your config a sensor that should be connected to the I2C bus (like a baro, an airspeed, an external Adc) because I2C uses A4 and A5.

If this does not help, please put here your config files and report the values that you get for Volt_1 and Volt_2.

PS : not sure but perhaps you have also to configure some calculated fields on TX side when using openTx 2.2.x. Someone else could confirm or infirm.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by Chrisbott »

Many thanks. There's plenty of things there to check. From memory I think I had most things right, but will report back after another session on it later today.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by Chrisbott »

Well you certainly cracked it, and saved me some time.

I had all settings correct, but I'd only tried it with a bare Arduino board just to check before I made the resistor ladder and added the current sensor.
I've now made the complete sensor and I get a "Cells" sensor detected now, but only when a lipo is connected to the balance connector. That's actually a pretty neat trick.

In OpenTx 2.2 you then have to add calculated sensors. You can have each cell, and the total, and the lowest, highest and delta. (Or just the ones you want).

Anyway, many thanks for the steer. I have other questions but will save for another post.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by Chrisbott »

OK further questions if that's OK?

1) I've used a 3.3v 8mhz Arduino nano pro so that I have supply headroom from a 5v BEC or 4.8v NiMh. I'm using the on board 3.3v regulator as a V reference and to supply the ACS758 current sensor. Are there any issues with this approach? I see that this limits the max current reading to whatever 3.3v represents, but I'm ok with that.

2) To measure individual lipo volts, I need to set the number of cells at the time of programming. Would it ever be possible for the unit to sense the number of cells attached, and set it's self up accordingly?

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

Re: Individual cell voltages.openTx 2.2

Post by mstrens »

1) I do not see any issue with your aproach.

2) In the config file, you can use a set up that declare for example 4 voltage pins and you can declare that there are 4 cells. Then if you connect only a 2S lipo (on the first 2 pins), oXs will work and transmit only 2 cell voltages. If you connect a 3S, it will transmit 3 cell voltages...
So you can use the same oXs without changing the programming for different number of cells.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by Chrisbott »

Oh! Excellent. You guys think of everything.

Can't thank you enough. :D :D
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by Chrisbott »

Update.
Running the ACS758 at 3.3v means it's output voltage is lower per Amp. So config.h needs a tweak to accommodate that. The good news is that this means the 100A one still measures up to 100A.

One minor downside is that the chips are factory trimmed with a 5v supply. So when using 3.3v, the offset voltage for zero amps is slightly different for every chip. This means each one needs measuring and tweaking in to config.h too.

Otherwise things appear to work a treat.
gragile63
Posts: 3
Joined: Tue Nov 12, 2019 4:52 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by gragile63 »

Hello
Sorry if in my message there are misunderstandings in my message, I am French and I go through a translator.
I'm posting here, this is the subject that most closely matches my problem.
The answers here have made me progress, but I still have a problem with the detection of cells at the radio.
My project and read the voltage of 3 batteries independently, lipo or ni / mh.
My installation: 3 voltage divider bridges ici , connect respectively to A0; A1; A2
Arduino nano atmega 328p for testing, radio frsky horus x10, rx X8R.
I have activated different probe in the config to see the proper functioning, it is displayed correctly (VFAS, A4, curr etc), but for the detection of a single cell only appears, and I do not know how to do for 3 cells to appear on the radio.
I enclose my config
Thank you in advance for your help, do not hesitate to ask me for more clarity
cordially
gragile63
Posts: 3
Joined: Tue Nov 12, 2019 4:52 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by gragile63 »

here are my 2 files

config_advanced

config_basic
chemat

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

Re: Individual cell voltages.openTx 2.2

Post by Carbo »

Seems you want to display 3 independent batteries (divided to a 1s voltage) as cell voltages of one 3s battery.
To simulate this, simply change this line:
#define RESISTOR_TO_VOLTAGE 30.0 , 30.0 , 30.0 into
#define RESISTOR_TO_VOLTAGE 30.0 , 60.0 , 90.0
and (I hope) it will work.

To reduce the risk of "lost in translation", best to contact mstrens in french ;)
gragile63
Posts: 3
Joined: Tue Nov 12, 2019 4:52 pm
Country: -

Re: Individual cell voltages.openTx 2.2

Post by gragile63 »

thank you for the return
I may have always tested a single displayed cells
I keep hope :) :)

Post Reply

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