Alt/Vspd and Cells won't co-exist

Development & General Chat for the superb openxvario project.

Moderator: rainer

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

Alt/Vspd and Cells won't co-exist

Post by Chrisbott »

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: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

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

Post by jhsa »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Here are my config files.

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

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

Post by Chrisbott »

zip file didn't seem to attach first time
Attachments
oXs_config_basic_advanced.zip
(8.76 KiB) Downloaded 299 times
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

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

Post by mstrens »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Here's one built for VFas, Curr & cells. The other built for VFas, Curr & Alt/Vspd.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Second go at posting the photo
Attachments
Screenshot_20180710-191040.jpg
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

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

Post by mstrens »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Argh - of course above I meant "comment out "number of cells" and Alt/Vspd works. Sorry.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

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

Post by jhsa »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

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: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

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: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

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

Post by jhsa »

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
User avatar
Eagle71
Posts: 12
Joined: Fri Sep 07, 2012 3:01 pm
Country: -

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

Post by Eagle71 »

@Chrisbott
Your PCB looks pretty fine. Can You make it OpenSource here.
Maybe I can modificate it for my 0805 SMD resistors (to smal for strip layer).

Ciao Eagle71
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Hi. I'll see what I can do to share the PCB. Some time in the next few days if that's OK?
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

I'm going to try to upload a .rar of the PCB Gerber files. I'll also add some jpgs
Attachments
OPenX_PCB_CB.rar
(14.72 KiB) Downloaded 185 times
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Here are the jpgs of the PCB.

I think it's mostly self explanatory. But fire away with any questions.

I'll try to find time to do more of a description soon.
I don't have a schematic at this point.
Attachments
PCB-3.JPG
PCB-2.JPG
PCB-1.JPG
djatila666
Posts: 4
Joined: Mon Feb 25, 2019 10:03 pm
Country: -

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

Post by djatila666 »

ChrissBolt good job. would you mind sharing the component you used?

Thank you a lot
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

C1 = Current sensor filter = 0.1uF
C2 = Current sensor filter = 0.1uF
R1 = Current sensor filter = 1K - 10K or larger - Experiment to suit.

R2 = LiPo Pack volts R to Volts = 18K
R3 = LiPo Pack volts R to Gnd = 2.7K

R4 = Cell 1 R to Gnd = 2.7K
R5 = Cell 1 R to volts = 1K

R6 = Cell 2 R to Gnd = 2.7K
R7 = Cell 2 R to volts = 4.7K

R8 = Cell 3 R to Gnd = 2.7K
R9 = Cell 3 R to volts = 10K

R10 = Cell 4 R to Gnd = 2.7K
R11 = Cell 4 R to volts = 12K

Obviously all those resistor values have to be included in the appropriate config file.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

I'm just wondering if this should really have it's own thread rather than be lost in this one?
Weds
Posts: 27
Joined: Mon Jan 02, 2012 4:30 pm
Country: -

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

Post by Weds »

Hi Chris

Are you thinking of making the PCB commercially ? I would be very interested in a board
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

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

Post by Chrisbott »

Hi Weds whereabouts in the world are you?
I have no intention of doing these commercially but do still have a couple in the box, that I'd be willing to post within the UK.
Happy to do the odd one at cost to help the open source nature.
I can get more made, that takes about 3 weeks at the (low) price I'm prepared to pay.
Weds
Posts: 27
Joined: Mon Jan 02, 2012 4:30 pm
Country: -

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

Post by Weds »

PM sent Chris...

Post Reply

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