1. Introduction:
Pixhawk 3DR kit is delivered by default with a 4S maximum power module. For those wanting to use 5S or 6S or higher voltage batteries there is currently, to my best knowledge, no “how-to” guide for the Pixhawk board. I therefore decided to document it for others who might need it too.
For those who would like the same “how-to guide” for APM 2.x , here is a link I wrote a while ago:
Pixhawk comes standard with three (redundant) ways to powered it up:
1-USB : not used to fly obviously; just useful on the ground for connection on a ground station software.
2-The power module port accepting a maximum input voltage of 5.7volts (and will not get destroyed up to 20 Volts input)
3-The RC input pins. Will accept a maximum voltage of 5.7volts also (and is also protected up to 20 Volts)
This guide assumes a use of Pixhawk’s power module port which provides not only a way to power the board but also the pins to measure current and voltage values of the main battery.
This guide assumes a use of a 6S battery in combination with a Attopilot current & Voltage sensor board. This Attopilot “power module” replaces the 3DR 4S limited power module. The Attopilot board comes in three flavors: 45 amps, 90 amps or 180 amps.
The choice of the right Attopilot board (45A, 90A or 180 A) will depend on your motor/props combination: take the Attopilot version that has the smallest amps capacity above your max multicopter current consumption. However we will introduce in this guide a way to use the 90 amps Attopilot board to measure up to 150 amps, still using Pixhawk’s power module port.
2. Attopilot description:
An Attopilot board provides three wire soldering pads to solder : a current measurement wire, a voltage measurement wire and a ground wire. See picture below:
Attopilot 90A support up to 50Volts for a maximum of 90A. However the resistor specifications exceed the 90A limitation which makes it possible to use it for measuring 150 amps (we will take this as a assumed max current as our example for the rest of the explanation).
The datasheet of Attopilot specifies that the Voltage measurement wire outputs an analog voltage of 63,69 milliVolt per Volt. Similarly the current measurement wire outputs an analog voltage of 36,60 milliVolt per Volt.
So for a 6S battery the maximum analog voltage values will be:
-For voltage measurement: [min 0V - max 1.6V]
-For current measurement: [min 0V – max 3,3 V]
3. Pixhawk power port description (pinout):
Reusing the excellent pixhawk infographics published in the wiki, the image shows circled in yellow where the power port is on the pixhawk board.
The power port is a so-called DF13 connector with 6 pins.
The six pins of this connector are assigned in the following order, starting by the red wire on the leftmost pin:
Power Port Pinout Description:
- 1- Vcc (5V input)
- 2- Vcc (5V input)
- 3- I (Battery current measurement analog voltage input)
- 4- V (Battery voltage measurement analog voltage input)
- 5- Ground
- 6- Ground
4. Wiring Case 1 : to measure up to a maximum of 90 amps
The connections between Attopilot and Pixhawk are shown in the illustration below:
We have added an optional BEC in the illustration that would be connected to the Vcc and Ground wires of the power module. It is optional as Pixhawk could alternatively be powered via the RC inputs.
4. Wiring Case 2 : to measure up to a maximum of 150 amps
The connections between Attopilot and Pixhawk will integrate resistors to be able to measure up to 150 amps.
Indeed the ADC of this power port on Pixhawk has a range of 0-3.3V. This means that for the maximum true current of 150 amps, we want the current analog wire of Attopilot to output maximum 3.3Volts (as it is the case in case1 for 90 amps max without additional resistors).
Note : this part has been updated with a resistor scheme simplification (only one resistor to add in parallel rather than the originally classical R1, R2 resistors divider) thanks to a contribution of Bo, a diydrones member who analyzed in depth the Attopilot circuitry.
So we will build a small resistors divider on wire 3 (current measurement) & wire 5 or 6 (Ground) as follows:
The Attopilot current measurement output masks a circuit that contains an existing output resistor called Rl. According to the Attopilot datasheet, the following equation links to measured current I (called MeasuredCurrent in the equation), the output analog voltage for current measurement Vout, and an existing Rs resistor in Attopilot:
What we want is to get Vout = 3,3 when Current =150 amps. To do this we will add a new external resisto (Rx) in parallel with the existing Attopilot Rl resistor, so that the new resulting Rl resistor (called Rl’) must be (knowing that Rs = 0.5Mohm as per Attopilot specs):
Therefore we can calculate the Rx resistor value we need to add in parallel as follows:
So, Rx must be ~ 110kohm to have a Vout at 3.3V when the measured current is 150 amps.
You can choose another max amp output (but I would not advise higher than 150 amps with the 90 amps Attopilot, otherwise use the 180 amps version instead) and calculate the resulting Rx resistor
As a result, when the current is 150amps, Vout will have value of 3.3Volts.
5. Mission planner / parameters configuration in battery monitor screen:
In the battery monitor parameters screen, you can manually select which current and voltage sensor you are using. In the present case, you will select the power module and modify the following parameters to make the mission planner voltage and current display match the real values (measured using a wattmeter for example). The explanation below is an extract from the Arducopter parameters list.
Battery monitoring (BATT_MONITOR)
Controls enabling monitoring of the battery’s voltage and current
Value | Meaning |
0 | Disabled |
3 | Voltage Only |
4 | Voltage and Current |
Battery Voltage sensing pin (BATT_VOLT_PIN)
Setting this to 0 ~ 13 will enable battery current sensing on pins A0 ~ A13. For the 3DR power brick on APM2.5 it should be set to 13. On the PX4 it should be set to 100. On the Pixhawk powered from the PM connector it should be set to 2.
Value | Meaning |
-1 | Disabled |
0 | A0 |
1 | A1 |
2 | Pixhawk |
13 | A13 |
100 | PX4 |
Battery Current sensing pin (BATT_CURR_PIN)
Setting this to 0 ~ 13 will enable battery current sensing on pins A0 ~ A13. For the 3DR power brick on APM2.5 it should be set to 12. On the PX4 it should be set to 101. On the Pixhawk powered from the PM connector it should be set to 3.
Value | Meaning |
-1 | Disabled |
1 | A1 |
2 | A2 |
3 | Pixhawk |
12 | A12 |
101 | PX4 |
Voltage Multiplier (BATT_VOLT_MULT)
Used to convert the voltage of the voltage sensing pin (BATT_VOLT_PIN) to the actual battery’s voltage (pin_voltage * VOLT_MULT). For the 3DR Power brick on APM2 or Pixhawk, this should be set to 10.1. For the Pixhawk with the 3DR 4in1 ESC this should be 12.02. For the PX4 using the PX4IO power supply this should be set to 1.
This is a parameter to adjust to match the real Voltage value with the displayed mission planner value.
Amps per volt (BATT_AMP_PERVOLT)
Number of amps that a 1V reading on the current sensor corresponds to. On the APM2 or Pixhawk using the 3DR Power brick this should be set to 17. For the Pixhawk with the 3DR 4in1 ESC this should be 17. Units: A/V.
This is a parameter to adjust to match the real Voltage value with the displayed mission planner value.
There you go! I hope this will help you configure your pixhawk with higher than 4S batteries.
Cheers,
Hugues
Comments
According to the eagle files the 500uOhm on the PM is rated at 4W It's max rated current is 126A (~8W), and it max overload current is 252A see datasheet further down is says it can handle 4 times the rated power for 5seconds.
If you have 150A, you be pushing 11.25W through it. So it might be ok for transient current, but I think I would recommended spending $20 on the 180A version if you are exceeding 90A continuous. (the 180A version uses a 250uOhm resistor so disapates less power)
If you are using 5V (as on the APM) you are still limited by the max current at 8W @126A max, but you won't exceed the 5V in on the ADC (again ok for transient, not good for continuous)
see https://www.sparkfun.com/products/9028 which also has a good datasheet from attopilot on the above calculations.
You're welcome.
@Peter & Emin, I will post pictures once I am done and can make cables for you if you want (let me test fully first...)
@Gary, I have updated the resistor calculation, can you update the wiki or provide me a wiki edit access? Thx
@Bo, resistor calculation updated thx to you!
+1 to that Peter
@Bo, thank you for your in depth analysis of the electric attopilot diagram. Although the resistor divider modifies the "equivalent" RL resistor on Vo analog output, thus meaning we would not reach the full 3.3V ADC range at full amps loading, we are lucky that in software we can adjust the Bat_amp_pervolt parameter to match the mission planner reading with the real measured amp value (using a wattmeter).
I will update the guide with your proposed solution which in fact simplifies it even more ( one resistor instead of two) and would in theory make a better use of the full 3.3v resolution. Thank you for that.
Nice write up for the same question I emailed 3drobotics. I'm a newbie to this type of modification. Any chance you could post a detailed picture of the complete setup? I'd like to see how you soldered your resistors in place. Heck, you could probably sell kits since 3d Robotics seems to be asleep at the wheel with 6s batteries! I'll buy one!
Yes, while this is all true, you could also remove the 73.2 resistor to simplify the maths, as stated i have not checked the current reported vs a multimeter or have any ideas as to the max current that can be measured but it should be as per the 3dr claims for the stock device (60 or 90 amps i think) as the circuit was not changed other than removing the 5v regulator. What i was going for was to "recycle" the power adapter supplied with the pixhawk to be used to some degree on 6s system and i believe i achieved what i set out to do. voltage sense is pretty good and that is what i will be monitoring mostly. Also I was itching to fly and not keen to wait for shipping again ; )
@Hugues,
Have you proven this 150 A scenario by measuring the current with an ammeter and comparing it to what the Pixhawk reports?
I ask because I do not believe that the voltage division is as straightforward as it seems. If you look at this schematic from the AttoPilot documentation, you will see that they are using the INA169 current monitor from TI.
This device sets its output voltage using the following equation:
In the 90A AttoPilot configuration, Rs is 0.5 mOhm and RL is 73.2 kOhm, so
If, however, you hang a resistor divider off of the "Analog I sense out" node, you place resistors in parallel with the 73.2 kOhm resistor, effectively changing the value of RL. For your scenario of R1=10kOhms, R2=15kOhms, the effective RL becomes
and the resulting volts per amp equation becomes
To complicate things just a bit more, you're then dividing this 9.32 mV/A down before sending it to the Pixhawk, so the Pixhawk sees
If you want to adjust the current range of the AttoPilot, you can do so much more directly by adjusting the size of the gain resistor, RL. The easiest way, if you're comfortable soldering surface mount resistors, is to simply replace RL. For 150 A measurement range, you would select
If you're not comfortable soldering surface mount parts, you could place a single resistor, we'll call it Rx, between the current measurement output of the AttoPilot and ground, in parallel with RL. Sizing Rx appropriately to adjust the effective parallel resistance will again modify the gain of the circuit. To get 150A measurement range, we would need
Of course, you could save yourself all this math by just buying the 180 A version of the AttoPilot. ;)
What is left is essentially the same circuit as the attopilot, It uses the same INA169 chip and associated resistors/caps (possible similar values) Not sure as the the max current that can be measured at this stage but this can be adjusted with the resistor divider as in article. In effect i just removed the 5 volt regulator for pixhawk supply and removed the +5V wires from lead.
"...but i removed the piggyback board, tantalum cap and diode.."
Hm, what's left? Can you please explain more or make a photo?