Hello and welcome to our community! Is this your first visit?
Register

  1. Arduino
  2. Uploading via the Arduino IDE

This page is a chapter in 'Arduino Uploading the AeroQuad flight software'

  1. Copy the whole content of the unzipped AeroQuad software to the sketchbook location of your Arduino IDE. This location can be found and/or changed under File » Preferences. Make sure to remove previous version of libraries which may already be there.

    Arduino IDE Preferences - Here the sketchbook location can be checked and/or changed.Arduino IDE Preferences - Here the sketchbook location can be checked and/or changed.


    In this case the sketchbook is located at "C:\Users\"User name"\Documents\Arduino".In this case the sketchbook is located at "C:\Users\"User name"\Documents\Arduino".


  2. Start the Arduino IDE and open the AeroQuad code through File » Open.

  3. Navigate to your sketchbook location with the previously extracted AeroQuad software, open the AeroQuad folder and select the "AeroQuad.ino" file. This will open the complete AeroQuad code with all the tabs.


    Before uploading the code to the Arduino, a few sections of the "UserConfiguration.h" tab need to be edited.
    First of all you have to select the right hardware in the section "Hardware Configuration". The user must uncomment the correct line based on the hardware that is being used in their quad.

    As an example, here's that section with the AeroQuad shield v2.1 and Arduino Mega selected as the hardware.

    Code:
    /****************************************************************************
    ************************* Hardware Configuration ***************************
    ****************************************************************************/
    // Select which hardware you wish to use with the AeroQuad Flight Software

    // 328p platform
    //#define AeroQuad_v1 // Arduino 2009 with AeroQuad Shield v1.7 and below
    //#define AeroQuad_v1_IDG // Arduino 2009 with AeroQuad Shield v1.7 and below using IDG yaw gyro
    //#define AeroQuad_v18 // Arduino 2009 with AeroQuad Shield v1.8 or greater
    //#define AeroQuad_Mini // Arduino Pro Mini with AeroQuad Mini Shield v1.0
    //#define AeroQuad_Wii // Arduino 2009 with Wii Sensors and AeroQuad Shield v1.x
    //#define AeroQuad_Paris_v3 // Define along with either AeroQuad_Wii to include specific changes for MultiWiiCopter Paris v3.0 board

    // Mega platform
    //#define AeroQuadMega_v1 // Arduino Mega with AeroQuad Shield v1.7 and below
    //#define AeroQuadMega_v2 // Arduino Mega with AeroQuad Shield v2.0
    #define AeroQuadMega_v21 // Arduino Mega with AeroQuad Shield v2.1
    //#define AeroQuadMega_Wii // Arduino Mega with Wii Sensors and AeroQuad Shield v2.x
    //#define ArduCopter // ArduPilot Mega (APM) with Oilpan Sensor Board
    //#define AeroQuadMega_CHR6DM // Clean Arduino Mega with CHR6DM as IMU/heading ref.
    //#define APM_OP_CHR6DM // ArduPilot Mega with CHR6DM as IMU/heading ref., Oilpan for barometer (just uncomment AltitudeHold for baro), and voltage divider
    Furthermore you have to select your flight configuration by uncommenting the correct lines in the section "Define Flight Configuration", as an example Quad in X-Configuration is selected. For more information about the available flight configurations refer to this page.

    Code:
    /****************************************************************************
    *********************** Define Flight Configuration ************************
    ****************************************************************************/
    // Use only one of the following definitions
    #define quadXConfig
    //#define quadPlusConfig
    //#define hexPlusConfig
    //#define hexXConfig
    //#define triConfig
    //#define quadY4Config
    //#define hexY6Config
    //#define octoX8Config
    //#define octoPlusConfig // EXPERIMENTAL: not completely re-tested
    //#define octoXConfig // EXPERIMENTAL: not completely re-tested


    // MOTOR ADVANCE CONFIG SECTION
    //#define CHANGE_YAW_DIRECTION // only needed if you want to reverse the yaw correction direction

    #define USE_400HZ_ESC // For ESC that support 400Hz update rate, ESC OR PLATFORM MAY NOT SUPPORT IT

    //
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // In the 3.0 code the motor numbering has changed to simplify motor configuration.
    // Please refer to our wiki (http://aeroquad.com/showwiki.php?title=Flight+Configurations)
    // or the .h files in ..\Libraries\AQ_FlightControlProcessor to see the new numbering for your flight model
    // the OLD_MOTOR_NUMBERING is compatible with the 2.x versions of the AeroQuad code and will not need re-ordering to work
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    //#define OLD_MOTOR_NUMBERING // Uncomment this for old motor numbering setup, FOR QUAD +/X MODE ONLY
    In the next section called "Optional Sensors" you can select the appropriate sensors you have installed. Moreover additional features can be configured in this section. Detailed explanation of this additional features can be found here.
    If you want to use a custom baud rate, uncomment "CONFIG_BAUDRATE" and enter the value you would like to use, otherwise leave it unchanged.


    Code:
    // *******************************************************************************************************************************
    // Optional Sensors
    // Warning: If you enable HeadingMagHold or AltitudeHold and do not have the correct sensors connected, the flight software may hang
    // For more information on how to activate theese features with your transmitter
    // Please refer to http://aeroquad.com/showwiki.php?title=Using+the+transmitters+sticks+and+switches+to+operate+your+AeroQuad
    // *******************************************************************************************************************************
    #define HeadingMagHold // Enables Magnetometer, gets automatically selected if CHR6DM is defined
    #define AltitudeHoldBaro // Enables Barometer
    //#define AltitudeHoldRangeFinder // Enables Altitude Hold with range finder, not displayed on the configurator (yet)
    //#define AutoLanding // Enables auto landing on channel AUX3 of the remote, NEEDS AltitudeHoldBaro AND AltitudeHoldRangeFinder to be defined

    //
    // *******************************************************************************************************************************
    // GPS Options
    // *******************************************************************************************************************************
    //#define UseGPS // Enables GPS (for mega v2.0/v2.1 on Serial1 & AeroQuad32 on Serial2)

    // Device specific settings
    //#define UseGPSMTKBINARY // Set MTK devices to binary protocol (only DiyDrones MTK1.6 protocol supported)

    //
    // *******************************************************************************************************************************
    // Battery Monitor Options
    // For more information on how to setup the Battery Monitor please refer to http://aeroquad.com/showwiki.php?title=Battery+Monitor
    // *******************************************************************************************************************************
    //#define BattMonitor // Enables Battery monitor
    //#define BattMonitorAutoDescent // NEED BattMonitor defined. If you want the craft to auto descent when the battery reaches the alarm voltage
    //#define POWERED_BY_VIN // NEED BattMonitor defined. Uncomment this if your v2.x shield is powered directly by the Vin/Gnd of the arduino
    //
    // Advanced configuration. Please refer to the wiki for instructions.
    //#define BattCustomConfig DEFINE_BATTERY(0,A4,51.8,0,A3,180.3,0)

    //
    // *******************************************************************************************************************************
    // Optional telemetry (for debug or ground station tracking purposes)
    // For more information on how to setup Telemetry please refer to http://aeroquad.com/showwiki.php?title=Wireless+Connection
    // *******************************************************************************************************************************
    //#define WirelessTelemetry // Enables Wireless telemetry on Serial3 // Wireless telemetry enable

    //#define MavLink // Enables the MavLink protocol
    //#define MAV_SYSTEM_ID 100 // Needs to be enabled when using MavLink, used to identify each of your copters using MavLink
    // If you've only got one, leave the default value unchanged, otherwise make sure that each copter has a different ID

    //#define CONFIG_BAUDRATE 19200 // overrides default baudrate for serial port (Configurator/MavLink/WirelessTelemetry)

    //
    // *******************************************************************************************************************************
    // Optional audio channel telemetry (for ground station tracking purposes)
    // This will output telemetry at slow (1200baud) rate once per second on Serial2.
    // *******************************************************************************************************************************
    //#define SlowTelemetry // Enables audio channel telemetry on Serial2
    //#define SoftModem // Enable usage of DAC as modem on AQ32 instead of Serial 2
    //#define SOFTMODEM_FSKv2 // Enable non standard FSK frequencies used by FSKv2 module (TCM3105 at 8Mhz)
    Now define how many channels your receiver has and the type of your receiver (PWM/PPM sum signal/Futaba sBUS) by (un)commenting the appropriate lines here:

    Code:
    //
    //
    // *******************************************************************************************************************************
    // Receiver Setup
    // For more information on how to connect your receiver to your AeroQuad board please refer to http://aeroquad.com/showwiki.php?title=Connecting+the+receiver+to+your+AeroQuad+board
    // *******************************************************************************************************************************
    //#define NormalReceiver // This does nothing really, but it indicates users that they don't have to define other options here if they have a normal receiver
    //#define RemotePCReceiver // EXPERIMENTAL Use PC as transmitter via serial communicator with XBEE
    //#define ReceiverSBUS // Use a Futaba sBUS RX, connect sBUS data line via an inverter (see wiki) to Serial2 RX, supports up to 8 channels on v2 and STM32 boards
    //#define ReceiverPPM // Use a PPM receiver
    //#define ReceiverHWPPM // Use a PPM receiver with HW timer (less jitter on channel values than PPM), needs a HW modification (see wiki)

    // You need to select one of these channel order definitions for PPM receiver
    //#define SKETCH_SERIAL_SUM_PPM SERIAL_SUM_PPM_1 //For Graupner/Spektrum (DEFAULT)
    #define SKETCH_SERIAL_SUM_PPM SERIAL_SUM_PPM_2 //For Robe/Hitec/Futaba/Turnigy9X+Er9X
    //#define SKETCH_SERIAL_SUM_PPM SERIAL_SUM_PPM_3 //For some Hitec/Sanwa/Others

    //#define UseAnalogRSSIReader // Reads RSSI for receiver failsafe, NEEDS A RECEIVER WITH FAILSAVE CONNECTED ON PIN A6 OF THE SHIELD
    //#define UseEzUHFRSSIReader // Reads RSSI and Signal quality on channel 7(RSSI) and 8(Signal Quality) of the EzUHF receiver (Receiver have to be configures this way)
    //#define UseSBUSRSSIReader

    //
    // *******************************************************************************************************************************
    // Define how many channels are connected from your R/C receiver
    // *******************************************************************************************************************************
    //#define LASTCHANNEL 6
    #define LASTCHANNEL 8
    //#define LASTCHANNEL 10 // EXPERIMENTAL only tested with ReceiverSBUS on AQ32, test extensively before using other boards/receiver types
    Select camera stabilization if you use your AeroQuad for aerial photography or FPV. For further information on camera stabilization visit our dedicated page.
    You may also want to control the nick angle of your camera gimbal with a switch/knob on your transmitter. To achieve this uncomment "CameraTXControl".


    Code:
    //
    // *******************************************************************************************************************************
    // Camera Stabilization
    // Servo output goes to D11(pitch), D12(roll), D13(yaw) on AeroQuad v1.8 shield
    // If using v2.0 Shield place jumper between:
    // D12 to D33 for roll, connect servo to SERVO1
    // D11 to D34 for pitch, connect servo to SERVO2
    // D13 to D35 for yaw, connect servo to SERVO3
    // Please note that you will need to have battery connected to power on servos with v2.0 shield
    // For more information please refer to http://aeroquad.com/showwiki.php?title=Camera+Stabilization
    // *******************************************************************************************************************************
    #define CameraControl
    //#define CameraTXControl // need to have CameraControl to work
    The next section is about the On-Screen-Display, visit our dedicated page for further information. To activate it uncomment the following lines:

    Code:
    //
    // *******************************************************************************************************************************
    // On screen display implementation using MAX7456 chip. See MAX7456.h in libraries for more info and configuration.
    // For more information on how to setup OSD please refer to http://aeroquad.com/showwiki.php?title=On-Screen-Display
    // *************************************************************.******************************************************************
    //#define OSD
    //#define ShowRSSI // This REQUIRES a RSSI reader
    //#define PAL // uncomment this to default to PAL video
    //#define AUTODETECT_VIDEO_STANDARD // detect automatically, signal must be present at Arduino powerup!
    //#define CALLSIGN "KF7YRK" // Show (optional) callsign
    //#define ShowAttitudeIndicator // Display the attitude indicator calculated by the AHRS
    //#define USUnits // Enable for US units (feet,miles,mph), leave uncommented for metric units (meter,kilometer,km/h)
    //#define OSD_LOADFONT // Include MAX7456 font into binary, give & on serial to upload

    //#define OSD_SYSTEM_MENU // Menu system, currently only usable with OSD or SERIAL_LCD
    The next section is about the support menu displayed on a LCD connect to Serial3 (or any port you choose here). For more information visit our dedicated page for further information. To activate it uncomment the following line:

    Code:
    //
    // *******************************************************************************************************************************
    // Support menu on serial enabled LCD display (16x2 characters). You can change serial port if needed
    // Note: Can NOT be enabled at the same time with OSD
    // For more information please refer to [url]http://aeroquad.com/showwiki.php?title=OnBoardMenu[/url]
    // *************************************************************.******************************************************************
    //#define SERIAL_LCD Serial3
  4. After you have customized the software to your needs, click on "Tools" » "Board" and select the flight controller board you are using. Next, click again on "Tools" » "Serial Port" and select the port your flight controller board is connected to.

  5. Now you can upload the code to the Arduino by clicking on "File" » "Upload".

  6. After a successful upload, you may move on to the next chapter (Setup and Calibration).

Tags:

This page has been seen 15,619 times.

    • Created by on
      Last updated by on