The Old Flyer's Posts (4)

Sort by

3689415371?profile=original

 

The Telemaster during pre-flight checks. 

3689415417?profile=original

 

APM, GPS, Air speed sensors and bubble level in the center payload bay.

 

Hobby Lobby's 74" Telemaster

Motor: Electrifly Rimfire 42-50-800kv GMP4700

ESC: Cermark ESC70BL

Prop: APC  16X8

Battery: Lightmax 3s 5000mAh or 2ea; 4000mAh

Receiver: Spektrum AR 7000

Aileron Servos: HS82 MG

Flap Servos: HS81 MG

Rudder Servo: HS85 MG

Elev. Servo HS85 MG

Camera: Canon SD1100IS

 

APM 2.1.2 MOD FOR POWER SENSOR

Planner 1.0.20

 

Planner worked very well loading software updates, .params and waypoint files.

HIL Simulations worked well with X-Planes

 

Still needs tuning but flight over an area survey path went well.

See:   01-07-11 12-00 9.kmz

The APM Log file is:   01-07-11 12-00 9.log

.param file: Cadencia 07-01-11 FLIGHT.param

Mission Check List: UAV APM Mission Check List 07-01-11.rtf

 

We are now ready to sort out the needed waypoint commands to snap pictures.

 

 

Read more…

How to add a power sensor to the APM

3689380844?profile=original

If you make these changes to your APM shield you will be able to see your system battery voltage and current on a GCS in real time.

When the system developers incorporate the changes to the software release, Power efficiency in watts/distance could be displayed and if the battery capacity is entered, "est. time remaining" could be available.


I used the AttoPilot 90A/50V Voltage/Current Sensor with Connectors



AttoPilot Voltage/Current Sensor with connectors


The sensor is also available from SparkFun http://www.sparkfun.com/products/9028


SparkFun Power sensor board (Same as AttoPilot board)


The sensor provides a scaled output for battery voltage and current. The outputs are scaled for a 12 bit 3.3V ADC. Full range is 51.8 Volts and 89.4 Amps.

The connector that is wired into the AttoPilot sensor is pinned for a direct connection to the APM shield.


To prep the shield I left the first two resistor positions open (no resistors installed) and shorted the last two positions.

I installed a 3 pin header. The 4th pin from the bottom of the row is ground (the black lead). The next pin up is battery voltage (the red lead). The 3rd pin is the battery current (white lead).





I noticed that during the "test -> battery" only 1 reading was displayed and it was inaccurate.


I changed the 'sensors' file so that the battery read continues until you hit Enter to exit.




To incorporate the Power Sensor I had to modify these files:

sensors

defines.h

test

config.h

APM_Config.h

ArduPilotMega


Here are the changes I made:


sensors


#if POWER_SENSOR == 1

void read_battery(void)

{

battery_voltage1 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN1)) * .1 + battery_voltage1 * .9; //reads power sensor voltage pin

battery_voltage2 = BATTERY_CURRENT(analogRead(BATTERY_PIN2)) * .1 + battery_voltage2 * .9; //reads power sensor current pin

battery_current = battery_voltage2;

}

#endif


#if BATTERY_EVENT == 1

void read_battery(void)

{

battery_voltage1 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN1)) * .1 + battery_voltage1 * .9;

battery_voltage2 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN2)) * .1 + battery_voltage2 * .9;

battery_voltage3 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN3)) * .1 + battery_voltage3 * .9;

battery_voltage4 = BATTERY_VOLTAGE(analogRead(BATTERY_PIN4)) * .1 + battery_voltage4 * .9;


#if BATTERY_TYPE == 0

if(battery_voltage3 < LOW_VOLTAGE)

low_battery_event();

battery_voltage = battery_voltage3; // set total battery voltage, for telemetry stream

#endif


#if BATTERY_TYPE == 1

if(battery_voltage4 < LOW_VOLTAGE)

low_battery_event();

battery_voltage = battery_voltage4; // set total battery voltage, for telemetry stream

#endif

}

#endif


defines.h


#define BATTERY_VOLTAGE(x) (x*(INPUT_VOLTAGE/1024.0))*VOLT_DIV_RATIO

#define BATTERY_CURRANT(x) (x*(INPUT_VOLTAGE/1024.0))*CURR_DIV_RATIO





test


static int8_t

test_battery(uint8_t argc, const Menu::arg *argv)

{

print_hit_enter();

#if POWER_SENSOR == 1

while(1){

for (int i = 0; i < 20; i++){

delay(20);

read_battery();

}

Serial.printf_P(PSTR("Volts:"));

Serial.print(battery_voltage1, 2); //power sensor voltage pin

Serial.print(" Amps:");

Serial.println(battery_voltage2, 2); //power sensor current pin

if(Serial.available() > 0){

return (0);

}

}

#else

Serial.printf_P(PSTR("Power Sensor Not enabled\n"));

#endif

delay(3000);



#if BATTERY_EVENT == 1

while(1){

for (int i = 0; i < 20; i++){

delay(20);

read_battery();

}

Serial.printf_P(PSTR("Volts: 1:"));

Serial.print(battery_voltage1, 4);

Serial.print(" 2:");

Serial.print(battery_voltage2, 4);

Serial.print(" 3:");

Serial.print(battery_voltage3, 4);

Serial.print(" 4:");

Serial.println(battery_voltage4, 4);

if(Serial.available() > 0){

return (0);

}

}

#else

Serial.printf_P(PSTR("Battery Event Not enabled\n"));

#endif

delay(3000);

}



config.h


//////////////////////////////////////////////////////////////////////////////

// Battery monitoring

//

#ifndef POWER_SENSOR

# define POWER_SENSOR DISABLED

#endif

#ifndef BATTERY_EVENT

# define BATTERY_EVENT DISABLED

#endif

#ifndef BATTERY_TYPE

# define BATTERY_TYPE 0

#endif

#ifndef LOW_VOLTAGE

# define LOW_VOLTAGE 11.4

#endif

#ifndef VOLT_DIV_RATIO

# define VOLT_DIV_RATIO 3.0

#endif

#ifndef CURR_DIV_RATIO

# define CURR_DIV_RATIO 3.0

#endif


APM_Config.h


// Battery monitoring

#define POWER_SENSOR ENABLED

#define BATTERY_EVENT DISABLED

#define BATTERY_TYPE 0

#define LOW_VOLTAGE 9.6

#define VOLT_DIVRATIO 15.7 //AttoPilot sensor voltage ratio (Minor adjustments to these values

#define CURR_DIV_RATIO 30.35 //AttoPilot sensor current ratio allow calibration to desired accuracy)


ArduPilotMega


// Sensors

// --------

float airpressure_raw; // Airspeed Sensor - is a float to better handle filtering

int airpressure_offset; // analog air pressure sensor while still

int airpressure; // airspeed as a pressure value

float battery_voltage = LOW_VOLTAGE * 1.05; // Battery Voltage of total battery, initialized above threshold for filter

float battery_voltage1 = LOW_VOLTAGE * 1.05; // Battery Voltage of cell 1, initialized above threshold for filter

float battery_voltage2 = LOW_VOLTAGE * 1.05; // Battery Voltage of cells 1+2, initialized above threshold for filter

float battery_voltage3 = LOW_VOLTAGE * 1.05; // Battery Voltage of cells 1+2+3, initialized above threshold for filter

float battery_voltage4 = LOW_VOLTAGE * 1.05; // Battery Voltage of cells 1+2+3+4, initialized above threshold for filter

float battery_current;



Read more…

3 Tips for APM Software Users

Tip 1. ID the ArduPilotMega files that you are working with.


I put this at the top of the files:

//

// FILE: file-name

//


When you edit files in the Arduino IDE there is no indication of the file name you are working on. The added preamble helps a lot.


Tip 2. Add identifying information to the system file so that the CLI header will reflect the current condition of the system software.


The original CLI header shows:


The 'system' file segment that places the header file on the CLI window is:

(In the Arduino window - use Edit-->Find... "Init to get to the right place)



My modified header shows the serial port baud rates that are set, which GPS and GCS PROTOCALs have been chosen, and any special conditions that have been set:



The changes made to the system file were:



Tip 3. If you get the dreaded:


I get this message when I try to change the Sketchbook location to a different release version.

The solution is easy!

Just reboot your computer. Then start Arduino again

I know that is a pain, but that will solve the problem.


I hope these tips help.


Read more…