Alt/Vspd and Cells won't co-exist

Development & General Chat for the superb openxvario project.

Moderator: rainer

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

Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 1:43 pm

Hi I've built a number of these sensors and have had great success so far.

I'm developing a PCB to mount Arduino, MS5611, a current sensor and 5x PD resistor chains so that I can monitor a 4S lipo "cells".

The problem I have is that with Number of Cells set to 4 (or other numbers) the Alt and V.Spd always read zero.
The sensors are detected by the Tx, but just stay at zero.
If I comment out the Number of cells line, Alt and V.Spd work fine.

I'm using A0,A1,A2,A6 for cells. A7 for pack volts (for when balance lead isn't connected).
A3 is Current sense.
This leaves A4 & A5 for the MS5611.

Hopefully I'm just missing something very simple.

Cheers
Chris

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

Re: Alt/Vspd and Cells won't co-exist

Post by jhsa » Tue Jul 10, 2018 2:37 pm

Please zip and post your config files. :)
Also what radio and firmware are you using?

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

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 2:39 pm

A little more info might help:-
basic
// --------- 1 - Telemetry protocol ---------
#define PROTOCOL FRSKY_SPORT

// --------- 2 - Data to transmit ---------
// ***** 2.1 - Frsky data *****
#define VFAS_SOURCE VOLT_5
all others commented out

// --------- 4 - Vario settings ---------
// ***** 4.1 - Connecting 1 or 2 barometric sensor(s) *****
#define FIRST_BARO_SENSOR_USE MS5611

// ***** 6.2 - Voltage parameters *****
#define ARDUINO_MEASURES_VOLTAGES YES

// ***** 6.3 - Max number of Lipo cells to measure (and transmit to Tx) *****
#define NUMBEROFCELLS 4

// ***** 6.5 - Current parameters *****
#define ARDUINO_MEASURES_A_CURRENT YES



(advanced)
#define DATA_ID_VARIO 0x00 // = sensor 0 used for Alt and Vspeed
#define DATA_ID_FLVSS 0xA1 // 1 used for Cell values
#define DATA_ID_FAS 0x22 // 2 used for vfas , current and fuel

// ***** 6.2 - Voltage parameters *****
#define PIN_VOLTAGE 0 , 1 , 2 , 6 , 7 , 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 2700 , 2700 , 2700 , 2700 , 2700 , 2700 // set value to 0 when no divider is used for a voltage; can contains decimals
#define RESISTOR_TO_VOLTAGE 1000 , 4700 , 10000 , 12000 , 15000 , 18000 // 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 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 // optionnal, can be negative, can have decimals

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 2:41 pm

I'll zip and post my config files now.

I'm using OpenTx 2.2.1 on a Horus X12
OpenXSensor is
// This is version : 8.2.12 (29 dec 2017)

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 2:47 pm

Here are my config files.


Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 2:50 pm

zip file didn't seem to attach first time
Attachments
oXs_config_basic_advanced.zip
(8.76 KiB) Downloaded 22 times

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

Re: Alt/Vspd and Cells won't co-exist

Post by mstrens » Tue Jul 10, 2018 4:25 pm

Your config seems ok.

It seems that you a using a AVR328 at 8mHz (3.3Volt).

Perhaps the MCU has no enough power to perform all calculations in due time. I don't think this is the reason but if you have a 16mHz (5v) arduino, it could make sense to test it.

Otherwise we can try to activate some debug options to understand what happens.

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 4:50 pm

OK mstrens many thanks.
You're correct, I am using a 3.3v arduino pro mini because it's on board 3v3 regulator takes care of any supply differences that might vary between a 4 cell nimh, 2 cell life or BEC supply for the RC, or indeed any supply fluctuations during flight.

I think I do have a 5V one. That might take a day or two to try though.
Leave it with me and I'll let you know the outcome.

If my PCB is successful, (it is if you don't want both "cells" and altitude) would it be of interest to share somehow?

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 6:01 pm

Here's one built for VFas, Curr & cells. The other built for VFas, Curr & Alt/Vspd.

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Tue Jul 10, 2018 6:13 pm

Second go at posting the photo
Attachments
Screenshot_20180710-191040.jpg

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

Re: Alt/Vspd and Cells won't co-exist

Post by mstrens » Wed Jul 11, 2018 6:21 am

I just made a test with an oXs having only a MS5611.
I used your config.
It seems to work: I got Alt, vspeed, vfas (=0) and current (=0). I did not got cells because oXs does not send cells data if voltages are not in expected ranges.

Could it be that your arduino are running with a AVR168 MCU instead of a AVR328?
The AVR168 MCU has only 1K ram instead of 2k and this is not enough for your config.

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Wed Jul 11, 2018 7:31 am

Thanks mstrens.
I've just done similar.
First with a 5v Arduino. Which worked fine.
Then with a new 3.3V one and that works too. (Without cells connected because it's separate to my "mother" PCB at the moment.
The original still shows the symptoms. Comment out "Number of cells" and alt/Vspd reads zero - even with no cells physically connected. So our tests are valid.
So I still need to do some soldering to remove "faulty" Arduino from PCB and replace it with the working one.

It is entirely possible that this is a rogue unit with the wrong processor, I guess.

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Wed Jul 11, 2018 7:43 am

Argh - of course above I meant "comment out "number of cells" and Alt/Vspd works. Sorry.

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

Re: Alt/Vspd and Cells won't co-exist

Post by jhsa » Wed Jul 11, 2018 8:35 am

Mstrens asked you if the problematic Arduino has an Atmega168 chip instead of an Atmega328.
You might have not seen the question? Please read his post again :)

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

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Wed Jul 11, 2018 9:14 am

Apologies I thought the question was rhetorical.

I couldn't read the chip type as there was a patch of white paint on it. But scratching that off has revealed MEGA328P
See photo.
Attachments
Screenshot_20180711-100936__01.jpg

Chrisbott
Posts: 18
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: Alt/Vspd and Cells won't co-exist

Post by Chrisbott » Wed Jul 11, 2018 9:47 am

Ok I don't know what's going on but I just went through this sequence.
1 Resoldered my ms5611 back on to the suspect Arduino board.
2 Tested and Alt/Vspd worked fine. (Not 100% sure here what the config is at this point).
3 Uploaded from AVR with // removed from "number of cells" line.
4 Tested and Alt/Vspd stayed at zero.
5 Uploaded with // back in.
6 Tested - working
7 Uploaded with // removed, just as a double check.
8 Tested and Alt/Vspd is working. Along with cells, when I plug in the balance connector.

So currently even the suspect Arduino is fine.
I honestly don't think I changed anything else.
There must be some human error here on my part but I can't see what it is.
I'm not inclined to test any further as all works as I want it to.

I'll report back if the issue shows up again at all.

Many thanks for the very prompt help. I'm sorry if I wasted anyones time.

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

Re: Alt/Vspd and Cells won't co-exist

Post by jhsa » Wed Jul 11, 2018 10:18 am

You did NOT waste anyone's time. We all always learn something :)

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

Post Reply

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