paiprashanth / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Current sensor do not measures current draw --- Differences between Arduplane and Arducopter codes could be the reason. #591

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi developers,

I have two attopilot current sensors wired to my APM boards like the wiki 
explains and for me only the voltage measurements are working properly. On both 
of them, APM Planner is showing always a complete charged battery ( 100% of 
charge in APM Planner HUD) and executing CLI battery test just shows the 
battery voltage.

I have set a similar installation for my friend's hexacopter, same attopilot 
sensor, same configuration procedure. It works perfectly. Good voltage and 
current draw measurement in his hexa makes me frustrated becasuse maybe I could 
have a bad soldering in one of my APM boards, but not on two... So after some 
reading and comparing two AP codes I encounter that they differ in some 
statements:

ARDUPLANE 2.32
------------------
In Arduplane.pde
------------------

// Number of milliseconds used in last medium loop cycle
static uint8_t          delta_ms_medium_loop;
..................

        // This case controls the slow loop
        //---------------------------------
        case 4:
            medium_loopCounter = 0;
            delta_ms_medium_loop    = millis() - medium_loopTimer;
            medium_loopTimer        = millis();

            if (g.battery_monitoring != 0){
                read_battery();
            }

            slow_loop();
            break;
    }
----------------
In sensors.h
----------------
    if(g.battery_monitoring == 4) {
        current_amps1    = CURRENT_AMPS(analogRead(CURRENT_PIN_1)) * .1 + current_amps1 * .9;   //reads power sensor current pin
        current_total1   += current_amps1 * (float)delta_ms_medium_loop * 0.0002778;        // .0002778 is 1/3600 (conversion to hours)
    }
----------------

ARDUCOPTER 2.5.3
----------------
In Arducopter.pde
----------------
                // This case controls the slow loop                 //---------------------------------                 case 4:                         medium_loopCounter = 0;                          if (g.battery_monitoring != 0){                                 read_battery();                         } 
----------------
In sensors.h
----------------
        if(g.battery_monitoring == 4) {                 current_amps1    = CURRENT_AMPS(analogRead(CURRENT_PIN_1)) * .1 + current_amps1 * .9;   //reads power sensor current pin                 current_total1   += current_amps1 * 0.02778;    // called at 100ms on average, .0002778 is 1/3600 (conversion to hours)         } 
----------------

Weather is too windy for now. We have flied the Hexa in a sports center and the 
Arduplane tests were made in home. Airplane does not have attached the 
propellers so maybe the current draw could not be sufficient, but I think the 
current sensor must show some readings, not always 0.00

Sorry if this issue is a rookie question but after two days of works, I have 
not idea how to solve this and I have not found the solution searching others 
issues.

Regards from Spain and thanks for your effort.
Dario.

Original issue reported on code.google.com by proyecto...@gmail.com on 7 Apr 2012 at 12:55

GoogleCodeExporter commented 8 years ago
Sorry, forgot to mention...

I have a 1280 APM1 and the other is a 2650 APM1.

The hexa has a 2650 APM1 board.

All are configured through APM Planner 1.1.60 on Windows 7 x32 starter.

Original comment by proyecto...@gmail.com on 7 Apr 2012 at 1:03