Ardustation battey voltage display issue. Help needed please!

I am experiencing some trouble with my new ArduStation! I wired the + terminal of my 6s LiPo (22.2v nominal) in series with an additional 164k ohms resistor(s). That makes the divider 100/(240+100+164)*25.2=5, so the max volts at the divider output is 5v with a fully charged 6s LiPo (25.2v). All is good so far! I purchased an ArduStation, assembled it , loaded the code with the battery monitor disabled, tested it, all is still good! All data is coming in fine, all screens appear normal with good data! Airspeed reads 16 standing still but other than that nothing strange. Now things go downhill. I altered the code to scale the voltage to reflect the new voltage divider ratio.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
NEW
//0-8
#define BATTERY_EVENT 1
and
//0-9
#define INPUT_VOLTAGE 5250.0                                --Measured at Vcc and GND with my DVM
and
#define BATTERY_VOLTAGE(x) (x*(INPUT_VOLTAGE/1024.0))/0.000198413  --1/5400 this is how we scale the voltage
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

OLD
//0-8
#define BATTERY_EVENT 0
and
//0-9
#define INPUT_VOLTAGE 5200.0
and
#define BATTERY_VOLTAGE(x) (x*(INPUT_VOLTAGE/1024.0))/0.000294117  --1/3400

*****************************************************************************************************************
*****************************************************************************************************************

Here is the problem, with the new code loaded I get a battery voltage displayed on the ArduStation that wraps around from the bottom right hand side of the screen to the top left had side of the screen overlapping the ROLL angle! The AIRSPEED also now shows 216 while not moving. Also I just noticed while I was trying to take pictures that the Ardustation screens while telemetry is coming in is "flickering" and not very clear. I didn't notice this before.

Ardupilot code is v2.6.2
Ardustation code is v1.3

I am using uBlox and the IMU with Ardupilot and the shield V2, I have the baud rate set at 38400 baud on Ardustation
I attached all my code for both Ardupilot and ArduStation, as well as pictures of the ArduStation with telemetry.

The top picture shows the ArduStation with active telemetry coming in, the bottom is static comm disconnected.




Help me out here guys I'm stumped!

Nathaniel

Tags: ArduStation, Battery, Display, Monitor, Problem, Voltage

Views: 113

Attachments:

Reply to This

Replies to This Discussion

Here is how I dealt with this issue in Ardupilot 2_6_2 under GCS_AP_Standard
Serial.print(",BTV:");
Serial.print(battery_voltage/1000000); // mjc

In ArduStation_v13, I reformatted screen like this,
I moved fields a little to fit data display better

Now all Labels are 3 characters, Added "S" for Number of Sats on top line right side
but can't get SATs data sent from ArdPilot with ArduIMU v2 and Shield v1

case 2:
lcd.clear();
lcd.print("ROL~");
lcd.print(roll);
lcd.setCursor(8, 0);
lcd.print("PCH~");
lcd.print(pitch);
lcd.setCursor(16, 0);
lcd.print("S~");
lcd.print(numSV);
lcd.setCursor(0, 1);
lcd.print("ASP~");
lcd.print(airSpeed);
lcd.setCursor(10, 1);
lcd.print("GSP~");
lcd.print(groundSpeed);
lcd.setCursor(0, 2);
lcd.print("ALT~");
lcd.print(altitude);
lcd.setCursor(10, 2);
lcd.print("DAL~");
lcd.print(holdAltitude);
lcd.setCursor(0, 3);
lcd.print("CRS~");
lcd.print(course);
lcd.setCursor(10, 3);
lcd.print("BAT~");
lcd.print(battery);
break;
Mark,

Thanks for your reply! I'll give it a try.It's certainly a lot simpler than what I was considering. I was thinking about rounding the float to two decimal places as is shown here in the Arduino playground.

Was it necessary to reformat the terms to three characters to get it to work, or was that just a personal preference to clean up the screen , and make it more readable?

Thanks,

Nathaniel
I needed more space for Sats and decimal point in battery
you need to add these lines in ArduStationV13 tab

long time_of_week =0; //mjc GPS TOW data in ms
int mode_sw =0; //mjc RC Tx: Mode Switch status flag 1-up, 2-mid, 3-down
int numSV =0; //mjc number of locked Sats

Here is my current ArduStationv14 build it has Greg Fletchers uplink code, Mode_Switch and TOW
Attachments:
Mark,

I just went through your 1.4 b version comparing it to mine. I understand the changes OK, but what is the "up-link" used for?

Nathaniel
To set send new PID values and waypoints up to ArduPilot_2_6_x in flight, but I am running out of AT328 memory so I need to add I2C 256k eprom to hold all the variables and PID schedules for different flying modes, a work in progress, Uses pins 4 & 5 for I2C so no battery voltage sensor, but should be able to add I2C voltmeter /ammeter latter.
Thanks Mark! I'll give this a shot and let you know what I think. :))

Nathaniel
Mark,

I couldn't get any IMU data with your version 1.4 b. I made the adjustment

Serial.print(",BTV:");
Serial.print(battery_voltage/1000000); // mjc

to battery voltage in version 1.3 and that corrected the problem I was having. I went for a drive and tested it out and all is OK! I like some of the formatting changes you have implemented in 1.4 b, I think I will spend some time going through the code and implement some of them in my version one at a time and see if I can't find what's casing me to lose the IMU data.

Thanks for your help :))

Nathaniel
Has anyone figured this out for 2.7.1? When I connect everything up my battery always reports full regardless of it's real value. I tried adding a divisor of 10000 into the code in the GCS_Standard_Text (Serial.print(battery_voltage/100000,DEC); //added the divide symbol and numbers after it) and that decreased my reported battery level. But it was still not reporting the level properly. Any ideas or suggestions?
Hi BriFly,

The code change I posted above worked for me (Thanks Mark!), when using the ArduStation pictured above in the beginning of this post. I read your post here, and implemented the following change in GCS_Standard_text.

Serial.print(",BTV:");
Serial.print((((battery_voltage/1000)-18.6)/.51),DEC);

Leonard Lisboa's explanation here does a good job of explaining his change (Thanks Leonard!). For me the changes above worked well, however I changed the scaler from /.66 to /.51 in order to prevent the FULL charge state from being prematurely shown as less than full charge. I use a 6-Cell LiPo battery with a "full" charge it reads 25.2 volts, however the voltage quickly drops off to something around 24 volts once I start to make the takeoff run. I reduced the value of the scaler in order to make the reporting for anything over 23.7 volts read FULL on the scale. I used a value of 18.6 volts for my "0" on the scale to give me a safety margin, I don't like to bring the pack voltage down to 3 volts per cell when I can't read the individual cell voltages. Hope this helps. One additional note there was a change in how the battery_voltage is reported the factor was changed,as such it was necessary to change the divisor from 1000000 to 1000. This makes more sense now as we are making a change from millivolts to decimal voltage. So if anyone is reading this for use with ArduStation, as of this writing use 1000 instead of 1000000 when modifying the serial print line in the standard GCS. Alternately, and perhaps a better solution would be to modify the ArduStation code to covert the value reported by the GCS_Standard_text back to a decimal voltage instead of a scale of 0-10. That way you can use either GCS or ArduStation with the same GCS_Standard_text.

Best Regards,

Nathaniel

BTW is BriFly a reference to the movie "The Fly", and the character Brindle Fly?

RSS

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service