I am using ArduCopter V2.9.1. I am programming with Arduino 1.0.4.

I have placed the following lines into the APM_Config.h.

#define BATT_MONITOR 4
#define LOW_VOLTAGE 11.1
#define VOLT_DIV_RATIO 3.56
#define CURR_AMP_PER_VOLT 27.32
#define CURR_AMPS_OFFSET 0.0
#define HIGH_DISCHARGE 6400 //mah of battery

// Battery failsafe
#ifndef FS_BATTERY

#define INPUT_VOLTAGE 5.13

But when I open up the serial monitor and go to test it, it displays 0's for everything. When I open up the Mission Planner, it says the monitor is disabled, sensor is 0:other, APM Ver 1. However, it has stored the values below for everything else. 

Am I doing something wrong? I have verified that the 3DR power module is working by using the mission planner to configure it. For my project, I need to have everything configured without using the Mission Planner.

Views: 753

Reply to This

Replies to This Discussion

So since no one responded, I tracked down the issue myself.

Apparently the values in Parameters.ino were not matching the Config.h values.

GSCALAR(battery_monitoring, "BATT_MONITOR", BATT_MONITOR),

    // @Param: FS_BATT_ENABLE
    // @DisplayName: Battery Failsafe Enable
    // @Description: Controls whether failsafe will be invoked when battery voltage or current runs low
    // @Values: 0:Disabled,1:Enabled
    // @User: Standard
    GSCALAR(failsafe_battery_enabled, "FS_BATT_ENABLE", FS_BATTERY),

    // @Param: VOLT_DIVIDER
    // @DisplayName: Voltage Divider
    // @Description: Used to convert the voltage of the voltage sensing pin (BATT_VOLT_PIN) to the actual battery's voltage (pin voltage * INPUT_VOLTS/1024 * VOLT_DIVIDER)
    // @User: Advanced
    GSCALAR(volt_div_ratio, "VOLT_DIVIDER",     VOLT_DIV_RATIO),

    // @Param: AMP_PER_VOLT
    // @DisplayName: Current Amps per volt
    // @Description: Used to convert the voltage on the current sensing pin (BATT_CURR_PIN) to the actual current being consumed in amps (curr pin voltage * INPUT_VOLTS/1024 * AMP_PER_VOLT )
    // @User: Advanced
    GSCALAR(curr_amp_per_volt,      "AMP_PER_VOLT", CURR_AMP_PER_VOLT),

    // @Param: INPUT_VOLTS
    // @DisplayName: Max internal voltage of the battery voltage and current sensing pins
    // @Description: Used to convert the voltage read in on the voltage and current pins for battery monitoring.  Normally 5 meaning 5 volts.
    // @User: Advanced
    GSCALAR(input_voltage,  "INPUT_VOLTS",      INPUT_VOLTAGE),

    // @Param: BATT_CAPACITY
    // @DisplayName: Battery Capacity
    // @Description: Battery capacity in milliamp-hours (mAh)
    // @Units: mAh
    GSCALAR(pack_capacity,  "BATT_CAPACITY",    HIGH_DISCHARGE),

        // @Param: LOW_VOLT
    // @DisplayName: Low Voltage
    // @Description: Set this to the voltage you want to represent low voltage
    // @Range: 0 20
    // @Increment: .1
    // @User: Standard
    GSCALAR(low_voltage,    "LOW_VOLT",         LOW_VOLTAGE),

       // @Param: BATT_VOLT_PIN
    // @DisplayName: Battery Voltage sensing pin
    // @Description: Setting this to 0 ~ 13 will enable battery current sensing on pins A0 ~ A13.
    // @Values: -1:Disabled, 0:A0, 1:A1, 13:A13
    // @User: Standard
    GSCALAR(battery_volt_pin,    "BATT_VOLT_PIN",    BATTERY_VOLT_PIN),

    // @Param: BATT_CURR_PIN
    // @DisplayName: Battery Current sensing pin
    // @Description: Setting this to 0 ~ 13 will enable battery current sensing on pins A0 ~ A13.
    // @Values: -1:Disabled, 1:A1, 2:A2, 13:A13
    // @User: Standard
    GSCALAR(battery_curr_pin,    "BATT_CURR_PIN",    BATTERY_CURR_PIN),

I went through and double checked that all of the #defines in the Config.h matched the third item in each ()

The Config.h over writes the values in the Parameters.ino. Likewise, anything in the APM_Config.h over writes the Config.h, which ultimately over rights the Parameters.ino

If you are using the 3DR Power Module, you must define BATTERY_VOLT_PIN as 13 and BATTERY_CURR_PIN as 12

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service