This posting covers initial set-up of the APM 2.5+ or 2.6 in a multirotor. I’m using a DJI F550 and Spektrum RC but you could put the APM on a pizza box and it would fly. The main resource for APM copter is here http://copter.ardupilot.com/ but there’s quite a lot of additional info which may help in setting up the Ardupilot Mega flight controller especially in a non-ArduCopter platform. First build the ‘copter and install the APM, RC receiver etc.
General Wiring
Use a power module like the 3DR module to power up the APM. Use a power lead from the APM to the Rx to power the RC Rx.
Connect the RC Rx channel signals to the APM input channels. The channel assignments are:
- Rx Aileron – APM Ch1
- Rx Pitch – APM Ch2
- Rx Throttle – APM Ch3
- Rx Rudder – APM Ch4
Connecting the RC channels from the Rx to the APM can be done two ways: By wiring the named RC Rx channels to the named APM channels, or by wiring the numbered channels (1 to 1 etc) and then configuring the RC channels configuration in the Tx software. I think it’s much easier to set the wiring from the start using the named channels.
This link is very useful: http://copter.ardupilot.com/wiki/connecting-your-rc-input-and-motors
Additional RC channels can be connected up as needed (optional):
- Flight Mode. The APM Ch5 input allows you to switch between different flight modes, so connect the APM Ch5 to an RC channel that you want to use for flight modes. On my Spektrum DX8 there is a 3-position switch for ‘f-mode’ that uses the RC Aux1 channel so I connect the Rx Aux1 (Ch6) to the APM Ch5.
- Super Simple. I also set my DX8 Ch7 to the APM Ch7 and subsequently configured this in Mission Planner standard params to engage ‘Super Simple’ mode.
- Gimbal Pitch. The rotary control of the DX8 is handy to control the camera gimbal pitch. This rotary control is ‘Aux3’ or Ch8 on the Spektrum DX8, so I routed that from the Rx to the AlexMos Simple BGC input ‘RC Pitch’ rather than to the APM.
When you come to calibrate the RC channel PWM signals later, you can check the correct channel assignments and correct any polarity issues. That’s about it for the Rx wiring to the APM. Now for the APM outputs to the ESC/Motor channels. The airframe documentation may state a particular motor configuration, but this might be for a different flight controller (like the DJI Naza). To state the obvious, use the motor configuration from the APM documentation not the documentation of the airframe (see the ‘connecting your RC wiki’ linked above).
Setting Up APM Firmware
With the main wiring done, it’s time to set up the APM firmware and settings.
To install firmware to the APM, plug in the USB connector between the APM to a PC and use the Mission Planner software http://ardupilot.com/downloads.
Updating the firmware can’t be done when the Mission Planner ‘connect’ setting is active to allow communication between the APM and the PC, so don’t ‘connect’ when installing firmware.
Set the frame type under ‘initial setup’, ‘mandatory hardware’, e.g. to ‘X’ if flying an X config.
Setting APM Configuration
With the firmware loaded, click ‘connect’.
Set compass type in ‘initial setup’, ‘mandatory hardware’, ‘compass’. On APM 2.5+ the compass magnetometer is in the flight controller but on the APM 2.6 with the 3DR uBlox LEA-6H compass in the GPS module the magnetometer is upside down under the GPS so the setting is ‘ROTATION_ROLL_180’.
Do the compass calibration. See Randy MacKay’s video at: http://www.youtube.com/watch?v=DmsueBS0J3E
Calibrate the accelerometers. Use the mission planner and follow the instructions to place the ‘copter steady in a variety of orientations. It’s quite important the ‘copter is steady and not wobbling around for this.
Calibrate radio (channels’ pwm) under Mission Planner ‘Initial Setup’ ‘Radio Calibration’ (joysticks and switches). If you are using switches to control flight modes note down the PWM ranges for the switch positions and if necessary configure the RC Tx so the switches you want to use control the channels you want to control.
Check the motors spin up OK and in the right direction (props not mounted). If a motor is spinning the wrong way, swap any two wires on motor to reverse the direction. The following link shows which way the motors need to spin: http://copter.ardupilot.com/wiki/connecting-your-rc-input-and-motors
At the moment the APM ‘Loiter’ PID is quite aggressive by default, and it’s recommended to set the loiter PID P from 1 to 0.5 (under ‘configuration’ ‘APM:Copter PIDS’) and click ‘Write Params’. http://diydrones.com/forum/topics/arducopter-3-0-1-released
Set the flight modes under in ‘initial setup’ ‘mandatory hardware’ ‘flight modes’ and click ‘save’ suggest stabilise, and alt hold, and loiter.
Preliminary Tests
Now install the props to motors, and carry out some tests before flying the ‘copter.
Check the APM is stabilising the copter properly. Make sure the flight mode is ‘stabilize’. Hand-hold the copter and power on the motors. Physically tilt the airframe in roll, pitch yaw while holding the copter and feel that the are motors trying to stabilise the ‘copter level. If the ‘copter doesn’t ‘fight’ to keep itself level, something is wrong with the APM connections to the ESC/Motors or the motors are spinning the wrong way or the props are wrong.
Next check the servos on the flight RC are in the correct direction. Hand-hold the copter and power on the motors. Use the RC Tx to command roll, pitch yaw while holding the copter and feel that motors try to respond. If the copter pulls the wrong way, one or more servo settings needs to be reversed. There are two ways to do this, either configuring the RC Tx setup to reverse the servos or reverse them using the Mission Planner ‘Config/Tuning’ ‘Standard Params’ settings for each servo channel.
On my F550 with a Spektrum DX8 I use the following settings in the Tx config:
- Throttle : Normal
- Aileron : Reverse
- Elevator : Reverse
- Rudder : Reverse
Battery and Current Monitoring
One of the most vital safety functions is to have a way of monitoring the voltage on the flight LiPo during the flight. There are a few ways to do this. I personally use the Spektrum TM1000 which is really easy to use – just connect it to the AR8000 receiver, solder the voltage leads to the power distribution board and set the alarm levels in the Tx for the minimum voltage you want on the LiPo. The really cool thing about the Spektrum TM1000/DX8 is you get a battery warning through your RC without needing any kind of base station equipment.
Or you can use the 3DR telemetry radios. To let the APM monitor the flight lipo voltage you need to be using the 3DR power module, and set up the APM battery monitor under ‘initial setup’, ‘optional hardware’ to: voltage and current 3DR power module APM 2.5+ 3DR Power Module, and also set the battery capacity textbox.
Checking the Compass
Correct operation of the APM compass is vital, and I would say don’t use any flight mode but ‘stabilize’ until you’re sure the compass is OK under flight conditions, i.e. with the motors running. I had a quite nasty crash with GeoFence when I made the mistake of not setting up and checking for correct compass operation. See this link: http://www.youtube.com/watch?v=_zDO5e3YMi4
The problem here was twofold: (i) I used an APM2.5+ with the compass module in the APM unit and mounted this inside the airframe, too close to the power distribution and (ii) although I did a good compass calibration I never checked whether the motors running affected it (which it did). After the crash I found the compass reversed almost 180 degrees with the motors running. So when the Geofence kicked in, the completely wrong heading info caused total loss of control. My third mistake was not toggling the flight-mode to get control back from the Geofence. So I do recommend wiring up channel 5 flight mode and using it!
To properly check the compass, use ‘Compass MOT’ as shown here: http://www.youtube.com/watch?v=0vZoPZjqMI4
For this you do need to set up the APM to monitor the battery as mentioned above. Or use the older style compass health check shown here: http://www.youtube.com/watch?v=4E0jKcuMRWA
Initial Flights & Trimming
There’s a very informative post on setting up and the Compass MOT here: http://diydrones.com/forum/topics/arducopter-3-0-1-released
Trimming covers two main areas to do with achieving level flight, and separately achieving good response and stability under dynamic flight conditions.
Auto Trim procedures for achieving level flight can be seen at: http://www.youtube.com/watch?v=FGiX-8m-6fw (auto trim old method) http://www.youtube.com/watch?v=ayA0uYOqKX4 (save trim – new method) http://www.youtube.com/watch?v=e3OF9ih50PU (comparison of methods)
Auto Tune for the controller PIDs can be seen here: http://copter.ardupilot.com/wiki/autotune/
Orientation
I’m still at the stage where I can lose orientation of the ‘copter when it’s beyond a certain distance.
It’s quite nice to be able to flick the flight mode into ‘Loiter’ in these situations, and if possible walk towards the ‘copter till you can see orientation.
One other strategy is to use bright LED lighting. I put up a separate post with my thoughts on that http://modwg.co.uk/led-lighting/.
Otherwise it’s possible to use simple or super simple modes to get control back. To set up for this needs the GPS and compass to be properly operating. You also need to set channel 7 to give the simple and super simple overrides to all flight modes: http://copter.ardupilot.com/wiki/flight-modes/simpleandsuper-simple-modes
On my F550 it’s better to reverse the Spektrum channel 7 servo direction i.e. Aux2 : Reverse so the switch positions are more intuitive. And of course don’t take off until there’s a solid GPS lock!
Please feel free to mail me comments on this posting.