Welcome to Multi-Rotor UK. Please login or sign up.

Monday,August 26, 2019, 05:59:17

Login with username, password and session length

Shoutbox

Andy7:
24 Aug 2019 19:21:05
 ~~
Gaza07:
23 Aug 2019 19:26:42
I agree it does look a lot better for some reasom SMF shorten any recent posts display  :rolleyes:
Andy7:
23 Aug 2019 10:29:15
Nice! Looks loads better.  :beer2:
Gaza07:
22 Aug 2019 22:47:32
Sorted mate  ~~
Andy7:
22 Aug 2019 10:27:36
Sure. But basically, all the subjects are getting cut off.
Gaza07:
21 Aug 2019 18:14:54
Can you pm me a screen shot of what you mean
Andy7:
21 Aug 2019 12:15:41
Gaza - can you make the subject line section in the forum topic list wider? It's cutting off the subject field really short.
Andy7:
19 Aug 2019 09:14:20
Good for you!  ~~
DarkButterfly:
18 Aug 2019 19:13:57
Had another negative encounter, it's been a few years since the last one, just an uneducated ******, going on about drones being illegal yada yada yada.    :-/
Still that didn't spoil my flying time, had an absolute blast  ~~
Gaza07:
07 Aug 2019 19:52:01
ooooh mrs jones  :D
Members
  • Total Members: 8066
  • Latest: badger1
Stats
  • Total Posts: 196588
  • Total Topics: 19805
  • Online Today: 60
  • Online Ever: 530
  • (Tuesday,June 26, 2012, 08:34:46 )
Users Online
Users: 0
Guests: 40
Total: 40

Theme Changer





3d - Printworx

Printing 3d Forum

RC Timer Current and Voltage sensor in Multiwii 2.2 (or later)

Started by teslahed, Friday,June 21, 2013, 18:25:12

Previous topic - Next topic

teslahed

I';ve got myself an rctimer current and voltage sensor which i am trying to get working on my FPV hexacopter with the latest dec code of Multiwii ( MultiWii_dev_2013_04_08_r1391 ).

I have the current and voltage sensor wired into my crius all in one Pro such that the current pin goes into Analog PIN 2 and the voltage pin goes into Analog PIN 3 (not tuned yet) and the earth pin just goes to one of the motor earth pins on the board - i assume i need to do that?

So far i am trying to tune the current sensor to give sensible readings via bluetooth on my android phone. I have looked through the code and found the relevent section;

/********************************************************************/
  /****           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 1510 // (*) default for soft - if you lower PLEVELDIV, beware of overrun in uint32 pMeter
    #define PLEVELDIVSOFT 5000 // for soft always equal to PLEVELDIV; for hard set 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 3  // (*) for telemtry display: one integer step on arduino analog translates to mA (example 4.9 / 37 * 100
    #define I_MAX   500 // maximal range of current sensor


But i am finding this hard to make sense of. There is a wikipedia article;

http://www.multiwii.com/wiki/index.php?title=Powermeter

from which i managed to understand that;

#define PINT2mA 13 // used for telemtry display: one integer step on arduino analog translates to mA (example 4.9 / 37 * 100

appears to be the variable to alter for tuning the power meter. Is this correct?

To tune my current sensor i have been hovering the hexacopter over my bed for approximately 1 min with a full battery, measuring the reported mAh drained with my smartphone over bluetooth, then recharging the battery back to full and using my charger to report the mAh put back in. I realise this may not be perfectly accurate but i think it will be good enough for my purposes.

Does this sound reasonable so far or am i missing anything? I haven';t found much information online regarding this so any help will be greatly appreciated.

The end goal is to get this working with a MinimOSD so that the current and voltage readouts display when i';m flying on video.
One circlip short of a quadcopter.
 1 lobe short of an antenna.

teslahed

I';m slowly building up a database of results;

Phone reports mAh                 Charger reports mAh                   #define PINT2mA value
162                                       221                                            2.98
180                                       232                                            2.98
276                                       237                                            3.00
?                                           ?                                                2.99
One circlip short of a quadcopter.
 1 lobe short of an antenna.

teslahed

I have tried a different technique;

I have tried precisely following the wikipedia instructions;

http://www.multiwii.com/wiki/index.php?title=Powermeter

* get the sensor and the datasheet of your sensor.
50V/90A = 63.69mV / Volt 36.60mV / Amp
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Current/DC%20Voltage%20and%20Current%20Sense%20PCB%20with%20Analog%20Output.pdf

* 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
I have skipped this step because it seems more complex than what i am trying to do and i don';t see any relationship between the two tasks.

* 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.

attached but no low pass filter - the readings aren';t jumpy

check your average cycle time or for better accuracy use the new feature to fixate the cycle time to a given value.
used 4000uS average

#define POWERMETER_HARD
Done

#define PINT2mA 13 // used for telemtry display: one integer step on arduino analog translates to mA (example 4.9 / 37 * 100
so 4.9 / 36.6 * 100 = 13.388

#define PLEVELDIV 1133 // compute : 1133 = 37 / 4.9 * 10e6 / 24000 * 3600 / 1000
1120.408

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]
the counter goes up very slowly until i start the motors - i am assuming the consumption measured at idle is about right for now.

I have set these variables in the code and flown for 1 min above my bed using a full 3 cell 1800mAh battery so that afterwards i can recharge the battery and see how many mAh go back in.

The mAh used is given as ';1559'; on my bluetooth smartphone.

The battery was charged back to full with 210 mAh

There seems to be no relationship at all between these two values.

Can anyone explain to me what i';m doing wrong here?
One circlip short of a quadcopter.
 1 lobe short of an antenna.

firey1

still trawling the web to help  :crossfingers:
MIKE

550 RC Spider quad for FPV
550 Alien quad (my sons now)
F450 quad
450 size bell 212, MD500,Augusta 109
600 size Huey running apm 2.5  3 planes  Taranis and 9xr  radios Skyzone FPV goggles

teslahed

I have had another go at this;

/********************************************************************/
  /****           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


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 telsl 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

I have been testing this using my bluetooth phone and the multiwii software app. I can fly over my bed for 1 min, measure the total mAh used, then recharge the battery back to full and see how much is going back in.

A typical 1 min flight uses 220mAh of charge

My phone reports that my hexacopter has consumed a total of ';498';

I don';t understand why the values are different and i suspect i am missing one or two things in the code because i am not sure i fully understand that either.
One circlip short of a quadcopter.
 1 lobe short of an antenna.

Commando

Greetings, if you don';t plug the pins (voltage and current) does the meter counts?
Because wen I activate the code "define #POWERMETER_HARD" gives crazy high values.