Run a servo on a UART

TimOD

Member
Hello all,
Is it possible to connect a standard servo (signal wire) to a uart port? Id power it off a ubec. I am able to remap the port to a servo in CLI.
What betaflight settings would I need to use?
Cheers for the help.
 

IanSR

Active member
Been a long time but iirc the signal wire goes to the tx pad and yes assign the port as a servo through the cli.

I did this quiet a while back trying to make a gimbal with one of those tiny brushed f3 flight controllers and it worked like a charm, but the thing is long since departed this earth and I didn't bother rebuilding it so can't list out the details sorry.

Just remembered I followed the instructions of some Australian chap on YouTube for it then adapted them, he was building a single axis gimbal for a 808 keychain cam so if you search you might be able to find it, Andrew was his name I think.
 

HilldaFlyer

Well-known member
Hello all,
Is it possible to connect a standard servo (signal wire) to a uart port? Id power it off a ubec. I am able to remap the port to a servo in CLI.
What betaflight settings would I need to use?
Cheers for the help.

Sounds like you are doing something like I'm trying to do... add servos to a quad? A little more info may help get a more correct answer.
I'm new to the FC scene... so hopefully what I say will be accurate. If not, I accept correction with dignity.

The answer is yes, sometimes. The UART must be assigned to a timer in the MCU that does not conflict with other timers. Most UARTs are on their own timer (I believe), so you should be fine. I, myself, would be looking for anther output pin, unless you don't have any... Many of the full-sized flight controllers have at least 6 if not 8 output pins for peripherals. If they all have the same timer, then they will have to use PWM out if you use an analog servo on the same timer. But... most flight controllers use different MCU timers for the 8 output pins... so you're in luck.

What I understand is that each FC has a hex file that tells the MCU what timers are used. It is best if you choose a output that is on the same timer as the other servos. Here is a reference for the following:
Here is a reference for information regarding servos

SPRacingF3 / target.c
This flight controller lists:
Output 1: TIM16 CH1
Output 2: TIM17 CH1
Output 3: TIM4 CH1
Output 4: TIM4 CH2
Output 5: TIM4 CH3
Output 6: TIM4 CH4
Output 7: TIM15 CH1
Output 8: TIM15 CH2

Note that outputs 3-6 are all on the same timer. Therefore all peripherals must use the same timing i.e. all motors, all servos but Dshot and servo on the same timer will not function.

With the timers of the above MCU set there are two options for this board -
1) Servos on Output 1 & 2 with motors on Output 3~6
2) Motors on Output 1~4 and servos on Output 7 and 8

What I'm trying to understand is why can't a board like this have motors on 3-6 and four servos on 1, 2, 7, and 8?
 
Last edited:

IanSR

Active member
If you are using a brushless flight controller like an omnibus f3 it's far easier to assign the servo to one of the unused motor pwm ports (5 to 8) and reassign that as a servo from a motor than it is try and go through all the hassle of assigning timers to UART ports.
 

TimOD

Member
This is the fc I'm using. Despite it saying it's supported by Inav I can't for the life of me get Inav to work on it so im on betaflight. (does anyone know if they use different drivers of something cause flashing and running beta flight works fine but inav wont connect after flash).
I am trying to make a fling wing.
I have motors attached to M1 and M2 and have Servos attached to signal wires of M3 and M4 (Using a ubec to power them) I was trying to use tx 1 to control retractable landing gear.
This far I have gotten the receiver taking to the fc and shows in receiver tab correctly.
I can manually control the motors through through betaflight on the motor's tab. (however the motors adjuster doesn't change when I move the throttle, not sure if this correct).
I have mapped two servos to the motor ports ports and these respond in the motor tab to tx inputs (but the servo's don't move)
I have mapped the 3rd servo to tx1 but can't seem to get it to respond in betaflight. (maybe I need to use passthrough?

these are my CLI commands:
# setup custom plane mixer
mixer customairplane

resource MOTOR 1 none
resource MOTOR 2 none
resource MOTOR 3 none
resource MOTOR 4 none
resource SERVO 1 none
resource SERVO 2 none
resource SERVO 3 none
resource SERIAL_TX 1 none

resource MOTOR 1 B00
resource MOTOR 2 B01
resource SERVO 4 A03
resource SERVO 5 B05
resource SERVO 3 A09



#mixing motors
#motor Motor Thr Roll Pitch Yaw
mmix reset
mmix 0 1 0 0 0.3
mmix 1 1 0 0 -0.3

# sero Mixing
# Rule Servo Source Rate Speed Min Max Box

smix reset
# predifined pitch
Smix 0 3 10 100 0 0 100 0
Smix 1 4 10 100 0 0 100 0

# input pitch
Smix 2 3 1 100 0 0 100 0
Smix 3 4 1 100 0 0 100 0

# Input roll
Smix 4 3 0 100 0 0 100 0
Smix 5 4 0 -100 0 0 100 0

any help with any of these issues would be great. I'm at my wits end and feeling like throwing the whole dam mess of a cliff.
 

Attachments

  • RXSR-FC (OMNIBUS F4 Fireworks V2) -manual.pdf
    929.8 KB · Views: 0

ElectriSean

Eternal Student
Mentor
iNav and Betaflight use the same drivers, but flashing and connecting for configuration use different drivers. Quite frequently the one used for flashing gets murdered by windows, which is why the driver fixer tool exists.

It looks like you're about half way there on your servo adventure, you need to map a channel to the servo, probably through the mixer somehow. Passthrough sounds like it may be what you're after too, I've never played with this in BF.

Before you get too frustrated and get destructive, consider a different FC. iNav is pretty much developed on the basic Omnibus stuff, it's good and fairly inexpensive. Even the cheap clones are decent. The board you have is really designed for miniquads, and probably won't ever be popular with the inav crowd.
 

TimOD

Member
how about this?
It has dedicated servo pins and all the other features I wanted.
OmniNXT-F7-Top-pinout_1024x1024@2x.jpg
 

Attachments

  • RXSR-FC (OMNINXT F7) -manual.pdf
    855.9 KB · Views: 0

HilldaFlyer

Well-known member
any help with any of these issues would be great. I'm at my wits end and feeling like throwing the whole dam mess of a cliff.

Hang in there - it is possible! Snap a photo of the rig... I'd like to see it.
Are you, by any chance, trying to make a TailSitter VTOL? Sure looks like it....
Motor mixes are connected to Stabilized roll?
Servos mixed to pitch?

Yeah... you're at the same point I've been all winter with my project -frustrating TOTALLY! One of the guys in my club who is EE (etheli - see link below) has contributed to the betaflight code reminded me that INAV, BetaFlight are open source and are not "commercial plug n' play" because basically it is a bunch of guys putting the code together for fun. I applaud them for there efforts, but it is not plug n' play if you do something other than stuff that has been tested.

I'm sure you've seen this: Setup for a Fixed Wing Aircraft
Boris' Note:
I would not trust this as nobody is testing it, but it may work.
iNav fork puts a lot of effort in airplane modes. Its better to try them.
The page is to help those that wish to Experiment and Test Fixed Wing functionality with BetaFlight.
Do Remember that YOU are the TESTER.

And do remember that I am new at this too, so I don't KNOW the answer... just try telling you what I'd do...

I've just got a micro F4 board to work on the wing, one motor, but I wasn't adding any new stuff,
So it sounds like you need to remap what would be PWM 5 to the UART Tx pin.

This resource for Serial_TX 1 has to be turned off, which it is with "resource SERIAL_TX 1 none"
Now that SERIAL_TX 1 output pin needs to be fed a resource.

I'm assuming you want servo 5 to operate the retracts?

From the lines above, resource B05 is going to a servo plug (which would have been labeled PWM5 on a full-sized F4)
I don't think this matter but you don't want two resources connected to the same resource so I would disable that output with
"resource SERVO 5 none"

From above it looks like you are wanted servo 5 to be operated with resource B05.
Map the B05 resource to the Serial Tx 1 pin:
"resource SERIAL_TX 1 B05"

Let me know what happens... I'm trying to do kind of the same thing on Micro F4 Omnibus only I'm just goofing off trying to map a servo to the motor 2 pin since I only have one motor and to the Serial_TX 1 (just to see if I can).

I really hope that works.
 

HilldaFlyer

Well-known member
Using a full featured board would provide you will all the pins like that F7.
But don't you want to conquer the challenge?
 

TimOD

Member
Hang in there - it is possible! Snap a photo of the rig... I'd like to see it.
Are you, by any chance, trying to make a TailSitter VTOL? Sure looks like it....
Motor mixes are connected to Stabilized roll?
Servos mixed to pitch?

Yeah... you're at the same point I've been all winter with my project -frustrating TOTALLY! One of the guys in my club who is EE (etheli - see link below) has contributed to the betaflight code reminded me that INAV, BetaFlight are open source and are not "commercial plug n' play" because basically it is a bunch of guys putting the code together for fun. I applaud them for there efforts, but it is not plug n' play if you do something other than stuff that has been tested.

I'm sure you've seen this: Setup for a Fixed Wing Aircraft
Boris' Note:
I would not trust this as nobody is testing it, but it may work.
iNav fork puts a lot of effort in airplane modes. Its better to try them.
The page is to help those that wish to Experiment and Test Fixed Wing functionality with BetaFlight.
Do Remember that YOU are the TESTER.

And do remember that I am new at this too, so I don't KNOW the answer... just try telling you what I'd do...

I've just got a micro F4 board to work on the wing, one motor, but I wasn't adding any new stuff,
So it sounds like you need to remap what would be PWM 5 to the UART Tx pin.

This resource for Serial_TX 1 has to be turned off, which it is with "resource SERIAL_TX 1 none"
Now that SERIAL_TX 1 output pin needs to be fed a resource.

I'm assuming you want servo 5 to operate the retracts?

From the lines above, resource B05 is going to a servo plug (which would have been labeled PWM5 on a full-sized F4)
I don't think this matter but you don't want two resources connected to the same resource so I would disable that output with
"resource SERVO 5 none"

From above it looks like you are wanted servo 5 to be operated with resource B05.
Map the B05 resource to the Serial Tx 1 pin:
"resource SERIAL_TX 1 B05"

Let me know what happens... I'm trying to do kind of the same thing on Micro F4 Omnibus only I'm just goofing off trying to map a servo to the motor 2 pin since I only have one motor and to the Serial_TX 1 (just to see if I can).

I really hope that works.

I'm sorry I'm not following you here. If you do this would you not be remapping B05 from serial_TX to none and then back to SeriaL_tx? Wouldn't you map B05 to none and then to Servo 5? Otherwise the fc would continue thinking that pin is the TX and not know where to send the signal for the servo?
 

HilldaFlyer

Well-known member
I'm sorry I'm not following you here. If you do this would you not be remapping B05 from serial_TX to none and then back to SeriaL_tx? Wouldn't you map B05 to none and then to Servo 5? Otherwise the fc would continue thinking that pin is the TX and not know where to send the signal for the servo?

After review... Maybe you're right. Like I said... kind of out of my league here.
I'll have to try this on my board and see what happens.