http://www.rctimer.com/index.php?gOo=go ... oodsid=861
http://dlnmh9ip6v2uc.cloudfront.net/dat ... Output.pdf (spec sheet)
50V/90A = 63.69mV / Volt 36.60mV / Amp
I have the current and voltage sensor soldered between the lipo and power distribtion board with the current sensing pin connected with the analogue pin 2 on my crius all in one pro.
I have started by looking at the current sensor - i want to get my flight controller counting the mAh used in flight.
Looking at the code the relevent section appears to be;
Code: Select all
/********************************************************************/
/**** powermeter (battery capacity monitoring) ****/
/********************************************************************/
/* enable monitoring of the power consumption from battery (think of mAh)
allows to set alarm value in GUI or via LCD
Full description and howto here http://www.multiwii.com/wiki/index.php?title=Powermeter
Two options:
1 - hard: - (uses hardware sensor, after configuration gives very good results)
2 - soft: - (good results +-5% for plush and mystery ESCs @ 2S and 3S, not good with SuperSimple ESC) */
//#define POWERMETER_SOFT
//#define POWERMETER_HARD
/* PLEVELSCALE is the step size you can use to set alarm */
#define PLEVELSCALE 50 // if you change this value for other granularity, you must search for comments in code to change accordingly
/* larger PLEVELDIV will get you smaller value for power (mAh equivalent) */
#define PLEVELDIV 5000 // default for soft - if you lower PLEVELDIV, beware of overrun in uint32 pMeter
//#define PLEVELDIV 36000 // fixed value for hard - do not tune
#define PLEVELDIVSOFT PLEVELDIV // for soft always equal to PLEVELDIV
//#define PLEVELDIVSOFT 5000 // for hard fixed to 5000
#define PSENSORNULL 510 // set to analogRead() value for zero current; for I=0A my sensor gives 1/2 Vss; that is approx 2.49Volt;
#define PINT2mA 132 // one integer step on arduino analog translates to mA (example 4.9 / 37 * 1000
This has changed from previous versions.
I am trying to configure mine to provide sensible readings over bluetooth on my smart phone to start with.
I have set powermeter_hard because i am using the hardware sensor
I have left #define PLEVELSCALE 50 alone because i don't understand it and don't fancy trying to search for the other comments in the code
I have left //#define PLEVELDIV 5000 commented out because it's for the software current sensor
I have left #define PLEVELDIV 36000 because it tells me it's fixed for the hardware and not to tune it
I have left //#define PLEVELDIVSOFT PLEVELDIV commented out because i'm using the hardware sensor
I have left #define PLEVELDIVSOFT 5000 because it tells me to set it to 5000 for the hardware sensor
I am not sure about #define PSENSORNULL 0 but i get almost no current comsumed when the hexacopter is sitting unarmed so i might have it right?
I calculated #define PINT2mA 134 with 4.9 / 36.6 (from the sensor specs 36.60mV / Amp) * 1000
Code: Select all
/********************************************************************/
/**** powermeter (battery capacity monitoring) ****/
/********************************************************************/
/* enable monitoring of the power consumption from battery (think of mAh)
allows to set alarm value in GUI or via LCD
Full description and howto here http://www.multiwii.com/wiki/index.php?title=Powermeter
Two options:
1 - hard: - (uses hardware sensor, after configuration gives very good results)
2 - soft: - (good results +-5% for plush and mystery ESCs @ 2S and 3S, not good with SuperSimple ESC) */
//#define POWERMETER_SOFT
#define POWERMETER_HARD
/* PLEVELSCALE is the step size you can use to set alarm */
#define PLEVELSCALE 50 // if you change this value for other granularity, you must search for comments in code to change accordingly
/* larger PLEVELDIV will get you smaller value for power (mAh equivalent) */
//#define PLEVELDIV 5000 // default for soft - if you lower PLEVELDIV, beware of overrun in uint32 pMeter
#define PLEVELDIV 36000 // fixed value for hard - do not tune
//#define PLEVELDIVSOFT PLEVELDIV // for soft always equal to PLEVELDIV
#define PLEVELDIVSOFT 5000 // for hard fixed to 5000
#define PSENSORNULL 0 // set to analogRead() value for zero current; for I=0A my sensor gives 1/2 Vss; that is approx 2.49Volt;
#define PINT2mA 134// one integer step on arduino analog translates to mA (example 4.9 / 37 * 1000
The PINT2mA value is massively different in this latest dev release than previous versions - several orders of magnitude higher.
So - assuming i've not made any stupid mistakes the only two variables to tune are '#define PINT2mA' and '#define PSENSORNULL'. Is this correct?
I calculated '#define PINT2mA' the formula above and got 134.
I am pretty sure i have '#define PSENSORNULL' correct but not certain.
I then flew my hexacopter for 1 min in the hover position above my bed with a full battery, used the phone to measure the mAh used, then my battery charger to measure the amount of mAh put back into the battery to get it back to full charge. I realise this may not be a perfect means of calibrating, depending on the quality of my balance charger, but i think it's good enough to test with for now.
A 1 min flight shows '492' consumed via the phone and 220mAh of charge put back into the battery pack afterwards. So i'm seeing values that are roughly double what they should be.
Can anyone shed any light on what i'm doing wrong here? Thanks!