我想在制作中的全景穿越机上安装一个升降舵机,用来保护全景相机的镜头,于是需要在BetaFlight的地面站下控制舵机,在网上找到了这个教程,能解决问题。


Betaflight servo setup (controlled by aux channel) – YouTube

 


How can I configure a servo in Betaflight?


For servo to work you need a free pin on your board and this pin must have timer function.

为了让舵机工作,你必须找一个空闲的引脚,而且这个引脚必须具有计时功能。

  • Go to Configuration tab in Betaflight Configurator and enable SERVO_TILT and hit “Save and Reboot” 打开“设置”,将  SERVO_TILT 打开,点击“保存并重启”
  • enter image description here
  • Then setup the switch you want to use on your transmitter and in Betaflight. Let’s say it was AUX4. Make sure it shows in the Receiver tab and that the signal is received.
  • Then go to the CLI tab and type resource (resource list for older BF) and hit Enter. What you’re looking for is resources with MOTOR or PWM function. For example on my board there are 6 MOTOR outputs. I assume you fly 4-motors copter and you also have some spare MOTOR pads.
    You need to remember the MCU pin and MOTOR number and of an output you want to use (C09 and MOTOR 5 for me).
    enter image description here
  • Then you need to type:
    resource MOTOR 5 NONE
    resource SERVO 1 C09
    save
    Use your own MOTOR and MCU pin number instead of 5 and C09!
    This will remap MOTOR5 pad to be able to work with PWM Servos.
    Servos numbering in CLI starts from 1
  • After reboot you can go to the CLI tab and type resource again to make sure everything worked as expected.
    enter image description here
  • Go to the Servos tab in Configurator and hit the checkbox with with your AUX channel on Servo 0 row (AUX4 for me). If you can’t see the servos tab check “Enable Expert Mode” on the top right. Save.
    Servo numbering on the Servos page starts from 0. So Servo 1 from CLI tab is Servo 0 here.

enter image description here

  • You can now power on transmitter and enable the live mode on the Servos tab.
  • Go to the Motors tab (remove props if you have LiPo connected!). There are servos output there.
    If you switch the switch you set to AUX channel you should see Servo 1 output to change the value.
    enter image description here enter image description here
  • Now you’ve remapped MOTOR 5 pad to act as a servo output. You can connect your servo’s signal wire to it and find any spare 5V and ground pads for it.
  • If the servo moves automatically as the quadcopter moves check that the CAMSTAB mode is disabled. The screenshot below shows it active, which you won’t want if trying to manually control the servo. CAMSTAB enabled

If you don’t have any spare MOTOR or PWM pad you can remap LED_STRIP 1 resource if you’re not using it for LED. Here’s the guide how you can do this: https://youtu.be/jiD6aC0l1VQ

If you need more than 2 servos to control check Sources for how to use Channel Forwarding instead.

Sources:
1: https://github.com/betaflight/betaflight/wiki/Servos-&-SERVO_TILT-for-3.1
2: https://github.com/betaflight/betaflight/wiki/CHANNEL_FORWARDING-for-3.1
3: https://youtu.be/jiD6aC0l1VQ
4: https://youtu.be/cHi1fKP1LRI
5: https://oscarliang.com/betaflight-resource-remapping/


Betaflight servo setup (controlled by aux channel) – YouTube


附录:舵机线的三个颜色的作用

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注