Skip to content

Latest commit

 

History

History
242 lines (184 loc) · 11.7 KB

2_5_Config_BetaFlight.md

File metadata and controls

242 lines (184 loc) · 11.7 KB

Install and configure BetaFlight

1 Install and flash BetaFlight firmware

BetaFlight is flight controller firmware for flying multi-rotor craft and fixed wing craft. Because of its cutting edge performances, BetaFlight is one of the largest flight firmwares in the FPV drone racing and freestyle community.

2.1 Install BetaFlight Configurator

BetaFlight Configurator is a tool for us to flash and calibrate firmwares.

Setup Guide shows steps to install BetaFlight Configurator.

  1. Download deb for Ubuntu 20.04.

  1. Install deb pkg by running
    sudo dpkg -i  betaflight-configurator_10.9.0_amd64.deb  
  1. Run BetaFlight Configurator and see the following interface

2.2 build BetaFlight for Aocoda H743

2.2.1 Build Betaflight firmware from source

Steps to build firmware H743 for example

  1. install official firmware, i.e. .hex
  2. save the result of diff all into config.txt
  3. use make to build firmware .hex
    cd Betaflight
    make TARGET=STM32H743
  1. check output message from make
    text	   data	    bss	    dec	    hex	filename
    466697	   6364	  90236	 563297	  89861	./obj/main/betaflight_STM32H743.elf
  1. get the built firmware it is located at BetaFlight/obj/XXX.hex.

2.3A flash BetaFlight to Aocoda H743

  1. connect autopilot board to a work station through a USB port. It is supposed to see the LED flashing after connection.

  2. run BetaFlight Configurator

  3. write customized firmware

    • enable DFU mode of the autopilot board
    • enable "no reboot sequence"
    • enable "Full clip erase" if your previous installation failed and you cannot connect your autopilot
    • click "Load Firmware" and choose the obtained firmware XXX.hex.
    • click "Flash Firmware" and the process is done when 'programming:successful' can is shown.
  4. load pre-built config

    • wait for 20s for the autopilot board to refresh, and disconnect and reconnect the USB cable if it does not response.
    • click button connect on the top right
    • choose ''Apply custom defaults''
    • click CLI tap
    • load file and choose preconfig.txt, i.e. the txt file in the 3rd step or Aoco_H7_Config_Manufacturer.txt in /firmware/Aocoda. Do not worry if you see some errors in the terminal.
    • type save in the terminal and it will automatically reboot. Then after connecting again, we should be able to see a 3D quadrotor model. This 3D model will show the same attitude of the autopilot when we rotate it, which means the firmware can obtain sensor information through ports on Aoco.

2.3B flash BetaFlight to KakuteH7Mini

  1. Enable DFU mode of KakuteH7Mini and connect it to a base station with Betaflight Configurater running.
  2. Download and flash official firmware by choosing KakuteH7Mini as the target board with
    • "no reboot sequence" enabled
    • "full chip erase" enabled
    Then, click Flash Firmware.
  3. Find the built firmware BetaFlight/obj/XXX.hex, chick local firmware and choose it.
  4. Flash own firmware with
    • "no reboot sequence" enabled
  5. Reboot and choose ''Apply custom defaults''

3 Configure and calibrate BetaFlight

REMOVE propellers before doing anything else

3.1 Configure transmitter and receiver

3.1.1 Bind receiver and transmitter

Please see Transmitter searching for RadioLink AT9S Pro and RadioLink R12DSM

3.1.2 Configure receiver using BetaFlight Configurator

  1. Define ports as Serial (via UART)

  2. Choose protocol

    • SBUS and switch the RadioLink R12DSM into S-BUS model when the LED flashes blue.
    • PPM not tested
  3. Enable Telemetry port.

  4. It is suggested to use our transmitter test thrust, roll, pitch, yaw controls by seeing the 3D model's animation. You can modify the sequence of AETR1234 in Channel Map according to your needs. AETR1234 means

  5. Adjust sticks' sensitivities with the buttons in green circles such that central positions of sticks should correspond to around 1507. Note use the buttons in green circles to make the range of each channel to be 1505-2000, especially for the thrust channel as Betaflight does not allow arming if the thrust channel is above 1050 by default.

3.2 Configure motors

NOTE: REMOVE propellers if you did not do that.

  1. Check frame type and motor order.

    Choose QUAD X as our chassis is TransTEC Lightning X Lite. Other chassis may lead to different choices here.

    The ESC board has marks, i.e. 1,2,3,4, help place motors in order. It is suggested to choose the same layout as shown here. Please remember the direction of the quadrotor on the autopilot is illustrated by an arrow in white.

  2. Test motors' spinning

    Now, it is time to test if we can spin motors. To do that, the first thing is to connect a battery to the ESC board while keeping the connect between the work station and the autopilot board.

    Then, it is necessary to set the ESC/Motor Output dropdown to the correct protocol. Usually DShot300 or DShot600 should be chosen for most ESCs available nowadays. Here is the explanation given by BetaFlight Configurator;

    • DShot300 is better for FCs with slower processors, like F411 boards. DShot600 is better for faster processors, like anything from the F7 family. F405 may work too, but it can cause too high of a CPI load when a lot of peripherals are in use
    • The DShot speed also depends on the gyro (and thus also the PID loop) speed. If you have a gyro that runs at 8kHz (MPU6000), you can use DShot600. If you have a gyro that runs at 3.2KHz (BMI270), you should use DShot300. Using higher DShot speeds on slower gyros shoudn't cause any issues, but it also won't give you any benefits.

    On the right side, we click "I understand the risk", then we can test motors' spinning individually by using sidebars with 1,2,3,4 or together using Master. if The motors, ESC, and the autopilot board are connected correctly, we should be able to see motors are spinning according to our commands.

  3. Change motors' spinning direction.

    After successfully spinning motors, we need to check the motors' direction if they are in the correct way that is shown on the left.

    As we can see, motor 1 and 4 are in clockwise direction, while motor 2 and 3 are in counterclockwise direction. If one or two motors are not spinning in the correct way, then we can click button Motor direction and change the direction of them.

    Choose motor by index first, and then if the direction is wrong, we just need to click "Reverse".

3.3 Configure flight modes

There are several modes:

  • Arm mode. It used as a kill switch as it can enable and disable motor output.
  • Angle mode. The input to the autopilot board is angle, that is usually chosen for manual flights.
  • Angle_rate_hold. This mode can receive angle commands and bodyrate commands, which is used for auto flights.
  1. Set Arm mode.

    • Click Add Range
    • Choose Auto and switch SwF of transmitter on and off, then it will automatically set the channel of SwF, maybe AUX 1, for mode Arm.
    • There is a yellow bar for every mode. In fact, the area covered by that corresponds to the transmitter' channel's status.

    Take Arm for instance, when the channel is in the yellow bar's area, the drone is armed, while the channel is outside, the drone is disarmed.

  2. Set Angle mode and Angle_rate_hold mode Make them use the same channel of SwG, then adjust the yew bar for two stages where one stage of SwG corresponds to mode Angle, and the other lies in mode Angle_rate_hold.

    Read the following resources:

    1. Modes Tab from BetaFlight, https://betaflight.com/docs/wiki/configurator/modes-tab
    2. Betaflight 4.3 Modes Tab, https://youtu.be/kDAotpevszs?si=QKJp7 5aN2eq35jE8

Other modes can be found at Modes:

  1. If we link two modes, then enabling one will trigger the other.
  2. ACRO mode takes commands as body rates from pilots. This mode is usually used in FPV. In fact, you cannot find this mode and it is a default mode: the drone switches to ACRO mode if we arm the drone while no mode, like Angle mode, is chosen.

3.4 Configure power & battery

  1. check if BetaFlight Configurator find the correct number of cells.

  2. Choose battery source Two options are available here

    • Onboard ADC means the voltage and current are measured by the autopilot's ADC.
    • ESC means they are measured by ESC telemetry. To use ESC telemetry for voltage measurement, the ESC board needs have a pin named after telemetry that is connected to the autopilot. A pin named after current is needed for current measurement.

    We choose Onboard ADC when batteries of 2s-6s are used, then ESC is a better choice when batteries of more than 6s are chosen.

  3. Amperage Meter (Current)

    • This depends on ESC instead of autopilots.
    • The parameter Scale in Amperage Meter should be given by manufacturer. As for our Aocoda 3060A 4 in 1 site in Taobao, the scale is set to be 160. It is 120 for KakuteH7Mini site at Holybro.
  4. Voltage Meter (Voltage) Here is what we should do first

    • connect a battery to the drone
    • connect a voltage meter to the battery to read the voltage

Click the button Calibration, entre the voltage value read from the meter anc lick button Calibrate.

After hearing the music, we can click the button Save.

3.4 Calibrate sensors

Aocoda has embedded an accelerometer and a gyroscope.

First let us calibrate the accelerometer. Place the drone on the flat surface, and then click the button Calibrate Accelerometer.

It finishes when the message "Accelerometer calibration finished" is displayed on the top left. Note do not move the drone during the calibration.

3.5 First flights and PID tuning

##TODO