Skip to content

Servo stretch feature for wider range servo PWM pulses #2773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

frank26080115
Copy link
Contributor

There are some servos that require PWM pulses about 500us to 2500us to get their full range of motion

There are some people who purchase "servo stretcher" devices to translate pulses from 1000-2000us to 500-2500us just to use these servos. However, this obviously costs money, space, and weight. So why not just add this feature to ELRS?!

Previously, there was a "narrow" flag for the pulses that made them half as long. My code addition converts this to both a "half" mode and a "stretched" mode. The checkbox in the web-ui has changed into a drop-down.

I have tested this and observed the signals on a logic analyzer to confirm the pulse widths. I have also checked that loading and saving from the web-ui works as expected.

@Dtran54
Copy link

Dtran54 commented Jun 11, 2024

This feature is super useful for a lot of servos that use extended range PWM.

Copy link

@Camo55 Camo55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no downsides I can see with this.

@CapnBry
Copy link
Member

CapnBry commented Jun 13, 2024

This has a lot of things that needs fixing, mainly the config struct can't just be changed like that, and the way this is calculated loses even more source resolution. I don't have time to get into it now though.

To work around the former, does anyone actually use that 750us mode? Is that even a thing? I added it because when I wrote all the PWM stuff one person said to me "Can you make it so the pulses are half as long?" and I had never heard of that but I threw it in because everything was new then so it was easier than it would have been to add it later.

If 750us isn't a thing, then we could just use that bit for this and save a lot of headache/code. Does anyone know if that can be removed?

@frank26080115
Copy link
Contributor Author

frank26080115 commented Jun 13, 2024

config struct can't just be changed like that,

Actually I made it so that anybody else migrating from the old struct will still have their settings be effective until the next time they use the web interface to configure. I also have never heard of a practical use for 750us mode and would agree to simply turning it into a stretched mode. But how do we make sure

the way this is calculated loses even more source resolution

I can easily change this such that the calculation happens in the same place where CRSF_to_US used to happen so we preserve as much resolution as possible.

@lesharodin
Copy link

Yes its useful for plane pilots who are switching to ELRS
#2522

@rburrow87
Copy link

To work around the former, does anyone actually use that 750us mode? Is that even a thing? I added it because when I wrote all the PWM stuff one person said to me "Can you make it so the pulses are half as long?" and I had never heard of that but I threw it in because everything was new then so it was easier than it would have been to add it later.

If 750us isn't a thing, then we could just use that bit for this and save a lot of headache/code. Does anyone know if that can be removed?

I mostly fly LOS fixed wing and heli, and I don't think 750us is really a thing outside of yaw servos for RC helicopters (which generally use a flight controller anyway), and probably some specialized cases that I can't think of. I'm not aware of any other radio system in the hobby with a PWM receiver that can support the 750us servo operating range. I'm sure one person will be upset if it gets removed though, haha!

@Camo55
Copy link

Camo55 commented Jun 14, 2024

It's also useful for Drag Racing and similar folks who like to turn their rates up to 125% to "Get a little extra power and speed" out of their systems supposedly.

@frank26080115
Copy link
Contributor Author

if narrow mode is 500-1000 anyways, and the new stretched mode is 500-2500, can we assume that anybody who used to use 500-1000 can simply edit their mixer since those ranges overlap?

as far as I can tell, the resolution will be similar and it's not like using 500-1000 increases the update rate anyways, the PWM generator's frequency never changes.

@Mkorho
Copy link

Mkorho commented Jun 16, 2024

image

Why add non standard 500us-2500us PWM when standard 150% 732us-2268us is not supported and EdgeTX only supports 150% max anyway.

Why make stretched non standard pwm mode for ELRS?

@frank26080115
Copy link
Contributor Author

The goal is to help people save money, save space, and save weight, by avoiding products such as this servo stretcher, or this (example 2), or this (example 3), or this (example 4), or this (example 4). These products exist because of the limitations of older receivers and old standards, while EdgeTX itself is not to blame, this is going to provide an option to mitigate that old constraint.

The last commit I just did replaced the narrow flag with the stretch flag, and I think it could work as an implementation that satisfies everybody, even people who were previously using the narrow flag. I have also resolved the resolution issue and now it should have as much resolution preserved as possible.

Please review, thanks!

@Mkorho
Copy link

Mkorho commented Jun 17, 2024

Then why not add standard 150% 732us-2268us.
100% and 120% modes are allready supported in ELRS.
Allmost all radios support 150% mode.
And most 3D pilots use 150% mode to get full travel without using longer servo arms.

@Ncerzzk
Copy link
Contributor

Ncerzzk commented Jun 18, 2024

It seems there are different requirements for different pwm range, so why not add mixer support so that people could config custom pwm range. (I just like a Mixer Salesman. Orz...)
PixPin_2024-06-15_17-53-48

on the other hand, I could understand that the requirement for custom pwm range is not so widely(compare to the amount of ELRS users), and it would make the pwm out a bit more complex.

@Votius
Copy link

Votius commented Jun 22, 2024

This is a great feature to add. With more adoption of ELRS in planes, combat robotics, rc cars/trucks/crawlers since the RM MT12 was released, this is the time to get this added. We need to get this reviewed please!

@adras
Copy link

adras commented Aug 2, 2024

I could really need this as well. I'm would really love using the full range of my servo.
What's the current state of this?
What's left to do?

@Sea-Kerman
Copy link

seems to work from my initial testing, the servo does indeed go twice as far, to the full 270 degrees

@dempfi
Copy link

dempfi commented Oct 9, 2024

Found this PR while looking for how to enable double pulse width that's already mentioned in the docs. Tested the PR and it does indeed work.

@Gjeremie
Copy link

I agree with all of your comments,

A standard 150% 732us-2268us travel is needed for steering servo to have the full steering angle without using longer servo arms (rc car racing)
And in a low latency mode (333hz or even better F1000 mode)

@RNewDeal
Copy link

Will the feature ever be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.