16-Apr-2016, 10:59 PM (This post was last modified: 26-May-2017, 11:05 PM by Oscar. Edit Reason: Formatting )
I always considered current sensor, amps and mAh measurements out-of-reach concepts, left for specialized / proprietary hardware for big-brand builds like the Vortex, DJI etc. I knew Cleanflight Configurator supports the concept and browsing through the docs few weeks back, I stumbled on the Virtual Current Sensor description It looked simple enough so I tried it, seems to work pretty well, so I decided to share my quick setup.
DISCLAIMER: Standing near an armed multi-rotor running at full throttle is dangerous! Do at your own risk. Check and re-check your straps or other stabilization system and ensure the craft cannot lift, tilt, fall off or cut through the restraints. Make sure the propellers and other moving parts are not at risk of snagging/cutting something.
As the docs state, the virtual sensor needs to be calibrated with an offset and scale parameters using two recommended methods:
Setup
This is the most important step. Ensure your quad will not endanger anybody or cause damage when running at full throttle. I strapped mine down to a heavy saw-horse as shown below and ensured the blades spin free and the LiPo/power analyzer are safely out of the day.
Measure The Current
The Cleanflight docs indicate to measure current at disarm Imin and at full throttle Imax. If your VTX requires additional button to power-on, press it. I personally chose to ignore the initial current spike at full throttle, and waited a second or so to settle before taking the value. I am not sure if motor-stop is factored anywhere, as it doubles the Imin value, I guess this is question for the firmware developers.
Calculate The Parameters
In addition to the current measurements, you need your max_throttle value - available in the Configuration tab or via CLI:
This value substracted by 1000 will give you TMax. The formula is available from the Cleanflight docs - https://github.com/cleanflight/cleanflig...asurements
Since the formula is a bit long and I have several quads, I created this spreadsheet that gives the final numbers easily. Feel free to download and share: https://www.dropbox.com/s/4b6l1yuyb7xk7k....xlsx?dl=0
Configure Flight Controller
Enable the current sensor and enter the calculated offset and scale parameters
Alternatively via CLI:
Final step is to set the current meter type to virtual. I did not see a GUI version for this and the CLI value differs between Cleanflight and Betaflight as follows:
Configure OSD
Enable amperage display in the MW-OSD GUI and select FC as the source. When all is working, the OSD will reflect the estimated current and mAh drained from the battery.
Things to keep in mind
This is a cross-post from my blog: http://jaisor.net/index.php/2016/04/16/c...-tutorial/
DISCLAIMER: Standing near an armed multi-rotor running at full throttle is dangerous! Do at your own risk. Check and re-check your straps or other stabilization system and ensure the craft cannot lift, tilt, fall off or cut through the restraints. Make sure the propellers and other moving parts are not at risk of snagging/cutting something.
As the docs state, the virtual sensor needs to be calibrated with an offset and scale parameters using two recommended methods:
- Actual Current Measurement - with a power analuzer, current meter, etc
- Battery Charger Measurement - with a charger that show accurately how much mAh were charged.
Setup
- Power analyzer or any other convenient way to measure the LiPo current when disarmed and at full throttle
- High-C charged LiPo capable of sustaining full throttle of your quad for a few seconds.
- Quad running Cleanflight or Betaflight
- OSD - MinimOSD running MW-WII firmware. Oscar Liang has an excellent tutorial for how to configure this OSD
- Propellers - choose the most common of your
This is the most important step. Ensure your quad will not endanger anybody or cause damage when running at full throttle. I strapped mine down to a heavy saw-horse as shown below and ensured the blades spin free and the LiPo/power analyzer are safely out of the day.
Measure The Current
The Cleanflight docs indicate to measure current at disarm Imin and at full throttle Imax. If your VTX requires additional button to power-on, press it. I personally chose to ignore the initial current spike at full throttle, and waited a second or so to settle before taking the value. I am not sure if motor-stop is factored anywhere, as it doubles the Imin value, I guess this is question for the firmware developers.
Calculate The Parameters
In addition to the current measurements, you need your max_throttle value - available in the Configuration tab or via CLI:
Code:
# get max_throttle
max_throttle = 1850
This value substracted by 1000 will give you TMax. The formula is available from the Cleanflight docs - https://github.com/cleanflight/cleanflig...asurements
Since the formula is a bit long and I have several quads, I created this spreadsheet that gives the final numbers easily. Feel free to download and share: https://www.dropbox.com/s/4b6l1yuyb7xk7k....xlsx?dl=0
Configure Flight Controller
Enable the current sensor and enter the calculated offset and scale parameters
Alternatively via CLI:
Code:
feature CURRENT_METER
set current_meter_scale = 350
set current_meter_offset = 40
Final step is to set the current meter type to virtual. I did not see a GUI version for this and the CLI value differs between Cleanflight and Betaflight as follows:
Code:
# Cleanflight:
set current_meter_type = 2
# Betaflight:
set current_meter_type = VIRTUAL
Configure OSD
Enable amperage display in the MW-OSD GUI and select FC as the source. When all is working, the OSD will reflect the estimated current and mAh drained from the battery.
Things to keep in mind
- This method will provide only estimated current measurements.
- The calculated parameters are unique to your individual build
- Changing electronics, motors or even propellers will require re-calibration
This is a cross-post from my blog: http://jaisor.net/index.php/2016/04/16/c...-tutorial/