Powermeter

From MultiWii
Revision as of 04:41, 7 October 2013 by Hamburger (Talk | contribs) (fine tune)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Powermeter

A powermeter provides two types of information;

* the current measured in mA consumed at each moment from the battery, 
* the accumulated energy drawn over time, measured in mAh

This can tell you a number of things, foremost if the C-rating of the battery is suitable for the current draw of that particular copter and two, how much energy (mAh) has been drawn since powerup - by simple subtraction one may derive how much energy is left (if it was fully charged to begin with).

Powermeter with hardware sensor

For measurement a simple device called current sensor is used. For the powermeter in MWii, a sensor is requred which measures the current from the battery and maps it to an analog voltage in the range of 0 up to 5V which is consecutively read by MWii. First experiments were successfully made with these sensors http://amploc.com/store/index.html but most other current sensors should work as well.

How To

  • get the sensor and the datasheet of your sensor.
  • get the battery voltage reading to MWii right first. Yes, even though strictly speaking it is not needed when using a current sensor, do it. Get the battery voltage reading to MWii right first
  • attach the sensor output to analog pin 2 (promini). Be prepared to install low path filter set to about 25 Hz to sensor input. That is a low pass RC filter. It is needed if the value seen by MWii is too jumpy.
  • check your average cycle time or for better accuracy use the new feature to fixate the cycle time to a given value.
  • setup the config.h section next

powermeter hardware sensor config.h (v2.3 or newer)

As example amploc 25A sensor has 37mV/A (from datasheet), promini arduino analog resolution is 4.9mV per unit; units from [0..1023], independant of cycle time, PLEVELDIV is set internally

  • #define POWERMETER_HARD
  • #define PINT2mA 130 // used for telemtry display: one integer step on arduino analog translates to mA (example 4.9 / 37 * 1000. Larger value of PINT2mA will get you larger displayed value for power (mA and mAh)
  • #define PSENSORNULL 510 // to start with - what the arduino analog input sees for zero current; depends on sensor. Find the output voltage for zero current in the datasheet, then convert it to arduino value [0Volt ; 5Volt] -> [0 ; 1023]

powermeter hardware sensor config.h (v2.2 or older)

As example amploc 25A sensor has 37mV/A (from datasheet), promini arduino analog resolution is 4.9mV per unit; units from [0..1023], cycle time 4000us, sampling rate is cycle_time * PSENSORFREQ , so 4000*6=24000 micro seconds

  • #define POWERMETER_HARD
  • #define PINT2mA 13 // used for telemtry display: one integer step on arduino analog translates to mA (example 4.9 / 37 * 100
  • #define PLEVELDIV 1133 // compute : 1133 = 37 / 4.9 * 10e6 / 24000 * 3600 / 1000
  • #define PSENSORNULL 510 // to start with - what the arduino analog input sees for zero current; depends on sensor. Find the output voltage for zero current in the datasheet, then convert it to arduino value [0Volt ; 5Volt] -> [0 ; 1023]

fine tune

  • configure, compile, upload,
  • run with sensor not hooked to battery, so it sees 0A current.
  • If possible, run this with mwc not powered via usb but via battery, else the usb power may influence the Vss of the arduino and lead to false readings.
  • use GUI or telemetry to view either power (mAh) or current(A). Current and power should be and stay at 0. If not, you must change PSENSORNULL and repeat the fine tuning. If you are a wizard you can modify MWii code to display that value for you...
  • attach sensor to the battery powerline, so it can measure the current drawn from the battery
  • if neccessary, tweak PINT2mA for exact results. Higher value here gives larger number of mA and mAh displayed.
  • done! Enjoy true readings of actual current and energy consumed.

next steps

You may want to setup a warning level for energy (mAh). This can be done via GUI or the lcd.config.menu. If you have a wireless connection you may want to setup telemetry for further information during flight.

Powermeter in software only

The software version does an estimation only. It relies on your combo of battery type (Voltage, capacity, voltage drop over time under load), ESC, ESC settings, motors, props and multiwii cycle time - change any one of those and the values are off! If tuned well, accuracy is about 10%.

How To

  • get the battery voltage reading to MWii right first. It is mandatory.
  • setup the config.h section :
  • enable POWERMETER_SOFT. PLEVELSCALE = 50, PLEVELDIV = PLEVELDIVSOFT = 5000

fine tune

  1. go fly your typical flight (routine and duration)
  2. at end connect to GUI or LCD and read the power value; write it down (example 4711)
  3. charge battery, write down amount of energy needed (example 722 mAh)
  4. compute alarm value for desired power threshold (example 750 mAh : alarm = 4711 / 722 * 750)
  5. set alarm value in GUI or LCD
  6. enjoy your new battery alarm - possibly repeat the fine tune procedure