Voltage monitoring on PX4

809 views
Skip to first unread message

xerr...@gmail.com

unread,
Sep 13, 2013, 10:50:43 AM9/13/13
to drones-...@googlegroups.com

Hi,

I am wanting to monitor voltage and current on a PX4, I also have the PX4IO and want to use the virtual pins 100 and 101.

I found the pin 101 for current but I am not sure where the pin 100 for voltage is? It doesn't say where the virtual pin 100 is in the wiki like it does for the pin 101?

the wiki says

"

  • PIN = 100 A virtual analog input pin for voltage of a battery connected to the 6V to 18V input of the PX4IO voltage regulator.
    • This is the normal pin to use for LiPo monitoring on the PX4IO.
    • If using this pin then set VOLT_DIVIDER to 1 for correct battery voltage reading.
  • PIN = 101 A virtual analog input pin for a battery current sensor connected to the “current” pin next to the power connector on the PX4IO.
    • This pin can accept up to 3.3 volts.
    • WARNING: If voltages higher than 3.3 are used there is a risk of causing the PX4IO to malfunction, forcing the PX4FMU to reboot.
    • For use with a current sensor, a 0.1uF capacitor between this pin and ground will help reduce “noise”.

"

also, is it ok to use the current/voltage monitor output from the 3dr power brick on pin 101 for current? (with the .1uf cap)? 


thanks for any help,

John

Gary McCray

unread,
Sep 13, 2013, 12:31:17 PM9/13/13
to drones-...@googlegroups.com
Hi John, 

When you get an answer, I'll see that it gets in the Wiki, we would all like to know.

Regards,

Gary

Robert Lefebvre

unread,
Sep 13, 2013, 12:46:13 PM9/13/13
to drones-discuss
My impression from reading that is there is not actually a pin 100 that is available to use.  It sounds like it is permanently connected to the battery input of the PX4 and is intended to be used for voltage monitoring of the the PX4 battery supply.

If this is the case, it makes it even more important for us to implement the option for a second voltage monitor.  The input can only handle up to 18V, so anybody using a high-power system (>4S) will not be able to monitor their battery voltage using the standard setup.




--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

xerr...@gmail.com

unread,
Sep 13, 2013, 1:37:15 PM9/13/13
to drones-...@googlegroups.com
Hi,

The first time I read through the info on it that was my thought too but I want to be sure.  there is a second place to monitor voltage but it is also only good for up to 18.6v.

the other thing that I am worried about is the voltage from the current output pin of the 3dr power brick, I havent measured it yet but I am hoping someone can tell me if it is ok to use. I am wanting to use it on an octa-quad.  I have modified a 3dr power brick, I replaced the .0005 ohm shunt resistor with two 0.001 ohm in parallel tojust about double the max current rating of the module. I am hoping the output wont go over the 3.3v at high current?   I guess I will find out :)

John

Gary McCray

unread,
Sep 13, 2013, 3:34:43 PM9/13/13
to drones-...@googlegroups.com
Now that you mention it Robert, 

I recall an earlier discussion regarding a question I asked previously and I am pretty sure you are right, the voltage monitor is only taken off the battery power in jack on the PX4IO board and so is measuring supply voltage to the PX4 boards.

I believe it was initially envisioned that the supply to the PX4s would always be the same as supply to the vehicle (which limits you to a max of 4 cell LiPo among other things.)

In fact I am pretty sure it is just a resistor divider between the power in jack and the input to an A/D converter pin and there is no externally available connection.

I will clarify this on the wiki.

Best regards,

Gary

Robert Lefebvre

unread,
Sep 13, 2013, 3:40:53 PM9/13/13
to drones-discuss
If this is the case then we DEFINITELY need a a second voltage input. No question about it, lot of people will want to run higher voltage.  I'm totally fine losing the current monitor.  I've never used it, and never really understood what it's purpose was.  Overcurrent is OK.  But I would never rely on battery mAH as a judge for flight time, because it can dump very eary.  Voltage is king.

xerr...@gmail.com

unread,
Sep 13, 2013, 4:12:56 PM9/13/13
to drones-...@googlegroups.com

Hi,

thanks for the reply's, I am going to try it. If the voltage from the current monitor pin on the 3dr power brick is below 3.3v I will try current monitoring too.  the main thing I want the current monitoring is for doing compassmot. I too watch the voltage more than anything else for flight time too.

I will let you guys know what I find.

John

Gary McCray

unread,
Sep 13, 2013, 4:13:25 PM9/13/13
to drones-...@googlegroups.com
Hi Robert,
Actually we have one, pin 5 of the DF13 - 15 pin connector on the PX4FMU can accept up to 18.6 volts and it's intention was I believe for it to be used as a voltage monitor as well.
This is listed as Pin 10 and it is not in common with the battery voltage monitor on the PX4IO which goes to the PX4IO's on board processor.
Clearly if you want to use a higher voltage than 18.6 volts you will need to supply an appropriate resistor divider.
But you can set the VOLT_DIVIDER parameter in the Advanced Parameter list to scale appropriately.
I actually checked the schematics of the PX4FMU and PX4IO to make sure this is correct.
Hope this helps,
Gary

Robert Lefebvre

unread,
Sep 13, 2013, 4:23:53 PM9/13/13
to drones-discuss
Ok, so that's in addition to the current detecting pin?

Why is that page about the PX4 analog pins located under a Mission Planner directory?  Seems a strange place for it.  I wanted to try and figure out where the PX4 current pin is so I didn't have to ask this question, but I'm not sure where to look for that.

Gary McCray

unread,
Sep 13, 2013, 4:39:19 PM9/13/13
to drones-...@googlegroups.com
Hi Robert, 

That's where all the common pages that get auto copied to all the other vehicle sites (plane, copter, rover) live now.

Used to be in developer, but once we added Planner, it actually worked better to put them there.

The common pages will actually turn up on each of the vehicle sites within an hour or so after editing and except for actual mission planner ones aren't even in the planners table of Contents.

Trust me it actually makes sense.

Best Regards,

Gary

Andrew Tridgell

unread,
Sep 13, 2013, 5:31:19 PM9/13/13
to xerr...@gmail.com, drones-...@googlegroups.com
Hi John,

The "virtual" pins 100 and 101 are actually measured on the PX4IO
microcontroller, and are presented to the APM code on the FMU board via
those virtual pin numbers.

You can set BATT_VOLT_PIN to any of the analog input pins on the PX4
listed in the wiki. All of them will give you a result in volts,
automatically scaling for the right scaling factor on that input.

For example, if you have an external voltage monitor that outputs 0..5V
and you are not using the airspeed pin for an airspeed sensor then you
are probably best off putting the voltage monitor on the airspeed input
and setting BATT_VOLT_PIN=11. That will give you an input that can take
up to 6.6V.

Similarly you can use any of the analog inputs for current, by setting
BATT_CURR_PIN.

So you really just need to match up your sensors voltage output range to
the input that best fits and then use that one. Just make sure your
sensor won't give a voltage above the rated range of the input.

Cheers, Tridge

Gary McCray

unread,
Sep 13, 2013, 6:00:15 PM9/13/13
to drones-...@googlegroups.com
Hi All, Ive now added explanatory text and a Image of the PX4IO which should clarify all PX4FMU / PX4IO analog options to the PX4 analog pin page.
Gary

Gary McCray

unread,
Sep 13, 2013, 6:19:25 PM9/13/13
to drones-...@googlegroups.com, xerr...@gmail.com, and...@tridgell.net
Hi Tridge, 

Thank You for clarifying the Parameter setting information even more Tridge, I am going to edit copy your response and put it in the analog pins section as well.

I don't understand how the autmatic scaling works, wouldn't you need to set the VOLT_DIVIDER scaling to match the scaling for the appropriate sensor range (example 0 to 30 volts) that was output scaled to 0 to 5 volts?

I have put the information you presented into the PX4 Analog Pins page, but I am concerned that it may still be a bit fuzzy related to this issue. 

Best Regards,

Gary

xerr...@gmail.com

unread,
Sep 13, 2013, 6:41:44 PM9/13/13
to drones-...@googlegroups.com, xerr...@gmail.com, and...@tridgell.net
Hi,

Thanks Tridge,  that helps alot!! 

Does anyone know the voltage range of the current monitor pin on the 3dr power brick? I have the wire and cap installed for the pin 101, but I am worried it might go over 3.3v at high current.

maybe I should just use pin 10 or 11

thanks again,

John

Arthur Benemann

unread,
Sep 13, 2013, 6:46:10 PM9/13/13
to drones-...@googlegroups.com

If this is the case then we DEFINITELY need a a second voltage input. No question about it, lot of people will want to run higher voltage.  I'm totally fine losing the current monitor.  I've never used it, and never really understood what it's purpose was.  Overcurrent is OK.  But I would never rely on battery mAH as a judge for flight time, because it can dump very eary.  Voltage is king.
Could you elaborate on that?

I'm currently using the discharged value reported by ardupilot (current integral), and I found that it matches very well to the reported mAh by my charger. On the other hand voltage is a little hard to be trusted, the flat discharge curve of LiPos give almost no info about the level of charge. Worst then that the abrupt derivative on the end of the charge just gives a hint of the level when you have almost zero battery.

Robert Lefebvre

unread,
Sep 13, 2013, 6:54:02 PM9/13/13
to drones-discuss
Huh.  I haven't had much problem using the voltage levels, but it I don't ride the backside of the curve much.  When I get to 3.5V/cell under load, I land.  Usually ends up with the 80% discharge rule, and everything is good.  The only problem with voltage is that it sags so much under heavy load.  

Anyway, I need dual voltage input in any case, so I'll try to get it in.


--

Gary McCray

unread,
Sep 13, 2013, 7:23:11 PM9/13/13
to drones-...@googlegroups.com
Hi all, 
Everything now updated, hopefully clearer and is on other sites too: http://planner.ardupilot.com/wiki/common-px4-analog-pins/
Hope this helps,

On Friday, September 13, 2013 7:50:43 AM UTC-7, xerr...@gmail.com wrote:

Robert Lefebvre

unread,
Sep 13, 2013, 7:36:28 PM9/13/13
to drones-discuss
Cool.  Now, just out of curiosity, why are these called "virtual" voltage pins?


--

xerr...@gmail.com

unread,
Sep 13, 2013, 7:45:49 PM9/13/13
to drones-...@googlegroups.com
Nice job on the wiki, actually on the entire wiki, I am amazed at how fast the new wiki is coming along.


thanks,

John

Gary McCray

unread,
Sep 13, 2013, 8:17:27 PM9/13/13
to drones-...@googlegroups.com
Hi Robert,

I think the reason is that they are not actual "pins" on the PX4FMU main microcontroller.

Since they are actually A/D pins on the PX4IO microcontroller, they are reassigned to pretend to be pins on the Main PX4FMU microcontroller, hence as far as the main microcontroller is concerned they are virtual.

That is also why the virtual pins are from 100 up since that is above the range of the actual (mapped) IO pins on the PX4FMU.

Possibly not the best use of the word virtual, but relative to the PX4FMU it works.

Possibly they could have just as well been called "external" pins.

Let me know if I'm wrong here Tridge,

Regards,

Gary

xerr...@gmail.com

unread,
Sep 13, 2013, 8:30:50 PM9/13/13
to drones-...@googlegroups.com
I just tried the pin 100 for voltage, it works, no problem and nothing else to connect except power. I havent tried the current yet but the  params for using the virtual pins are BATT_VOLT_PIN = 100 and BATT_CURR_PIN= 101, acutally the MP put them in when you pick the px4 in the pull down list.

John

john...@gmail.com

unread,
Sep 13, 2013, 8:44:44 PM9/13/13
to drones-...@googlegroups.com
Using voltage as a battery indicator is feasible on a copter since the load current is relatively constant during flight. But there are lots of pitfalls with different brands of lipo do not behaving the same. A "cheap" lipo with a low C rating can easily be pushed below 3.5v at normal usage loads and still have a lot of energy left. And on a plane it is even more difficult since your load will vary greatly depending on how you fly.

john...@gmail.com

unread,
Sep 13, 2013, 8:46:20 PM9/13/13
to drones-...@googlegroups.com
It is also almost hopeless to estimate remaining flight time by looking at voltage, because of the linear lipo discharge curve.

xerr...@gmail.com

unread,
Sep 13, 2013, 9:22:50 PM9/13/13
to drones-...@googlegroups.com
I just tried the current monitor on pin 101, it works but I dont think I am going to get away with using it with the 3dr power brick. I measured the voltage out of the pin on the power brick and was getting about 400mv at around 10 amps. at least the MP was showing 10 amps, this was at full throttle with n octa-quad without props. does that sound correct? 10 amps with no props?

so If I am getting 400mv at 10amps does that mean I would get 800ma at 20A? If so it would hit around 3.3v at 80amps. I guess it is safer to use a different pin, pin 11 for current I guess?

thanks for any input

John

xerr...@gmail.com

unread,
Sep 13, 2013, 10:54:31 PM9/13/13
to drones-...@googlegroups.com
Gary,

Hi, I am looking to use pin 11 and I noticed in the the wiki page the text  says it is on pin 2 of the 3 pin connector but  in the picture it looks like you have the pin 11 label over the end pin (pin 1 or 3) you may want to correct this. I almost messed up on it.

Thanks,

John


On Friday, September 13, 2013 7:17:27 PM UTC-5, Gary McCray wrote:

Gary McCray

unread,
Sep 13, 2013, 11:52:34 PM9/13/13
to drones-...@googlegroups.com
Nothing worse than a dyslexic wiki editor, fixed, good catch.
Thank you, Gary

xerr...@gmail.com

unread,
Sep 14, 2013, 12:46:24 AM9/14/13
to drones-...@googlegroups.com
Hi,

I have a question and I think it should be added to the wiki too.  I ended up using pin 10 for current monitoring. I tested it and found the current to be off, at least it was reading 3 amps at full throttle. I found the parameter AMP_PER_VOLT. it says it should be 17 for apm and pixhawk but for me that lowered it even more (1 to 2 amps at full thr)

I am wondering what this value should be to get the correct readings?  I set it at 54 and that gives me 7 amps draw at full throttle on an octa-quad with no props.

John
Reply all
Reply to author
Forward
0 new messages