# ArduSub PWM issue

**URL:** <https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044>\
**Category:** Blue Robotics Software\
**Tags:** ardusub\
**Created:** [February 10, 2021, 7:04am UTC](https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044 "2021-02-10T07:04:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ido](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@ido](https://discuss.bluerobotics.com/u/ido)\
**Post date:** [February 10, 2021, 7:04am UTC](https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044/1 "2021-02-10T07:04:56Z")

</div>

Hello everyone,  
I’ve got ver 4.2.0 of ArduSub and I’m using QGC.  
I have an ESC that works between 800-2200 PWM.  
I have defined my rc max/min to work in 2012/987us as my controller sends. I have changed the Servo(Motor) Max/Min params to 2200/800 and MOT\_PWM\_MIN/MAX to 1100/1900 BUT in the analyze tools the servo\_raw output shows me that the values are still between 1900/1100.  
I have checked in the analyze tools the rc input as well to see if there is something wrong with the values that the rc sends but they seem to be working as expected(2012/987).  
It seems like the ardusub code overrides the servox\_max/min parameters to always stay between 1900/1100.  
My servo outputs defined as they should (Motor1,motor2,motor3… and so on and Im using the bluerov2/vectored frame)  
Can you help me to solve this?

Thanks in advance for the help!

---

<div class="post-metadata">

**Author:** ![williangalvani](https://avatars.discourse-cdn.com/v4/letter/w/6f9a4e/32.png) [@williangalvani](https://discuss.bluerobotics.com/u/williangalvani)\
**Post date:** [February 10, 2021, 1:23pm UTC](https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044/2 "2021-02-10T13:23:53Z")

</div>

Hi,

The PWMs are additionally constrained to RCx\_MIN/MAX. Check [here](https://github.com/ArduPilot/ardupilot/blob/Sub-4.0/libraries/AP_Motors/AP_Motors6DOF.cpp#L229).

Changing RCx\_MIN/MAX should allow you to get the PWM values you want.

---

<div class="post-metadata">

**Author:** ![ido](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@ido](https://discuss.bluerobotics.com/u/ido)\
**Post date:** [February 12, 2021, 8:02pm UTC](https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044/3 "2021-02-12T20:02:50Z")

</div>

Well, this values are set to 800-2200 as well as on the controller’s rc and still, my rail output pwm values are not changed…

---

<div class="post-metadata">

**Author:** ![williangalvani](https://avatars.discourse-cdn.com/v4/letter/w/6f9a4e/32.png) [@williangalvani](https://discuss.bluerobotics.com/u/williangalvani)\
**Post date:** [February 16, 2021, 12:58pm UTC](https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044/4 "2021-02-16T12:58:52Z")

</div>

Right. After double-checking it, I can see why. The issue is [already filed](https://github.com/ArduPilot/ardupilot/issues/9830). The core issue is the “400” in the function [I’ve shared before](https://github.com/ArduPilot/ardupilot/blob/Sub-4.0/libraries/AP_Motors/AP_Motors6DOF.cpp#L229).  
`thrust_in` is constrained between -1.0 and 1.0, so that is never going to generate anything beyond 1900.

---

<div class="post-metadata">

**Author:** ![ido](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@ido](https://discuss.bluerobotics.com/u/ido)\
**Post date:** [February 16, 2021, 4:57pm UTC](https://discuss.bluerobotics.com/t/ardusub-pwm-issue/9044/5 "2021-02-16T16:57:17Z")

</div>

Thank you so much, that had really helped me to solve this!  
Can you help me to find/make a rc “kill switch” for the motors?  
I’d like to send pwm (if \> 1900us put motors to 1100 else do nothing) to a rc channel that is unused and turn all motors to their minimun (lets say 1100).  
Do you have any idea about how can I do it? Or if it already exist?

Thanks in advance!
