How to set pwm range bigger then normal

#1

Hello

I need to control my servo from 600 us to 2500 us, but when I change PWM_AUX_MIN and PWM_AUX_MAX in airframe file, it still does’t work, when I’m starting my plane. Now I have to use an additional arduino board to change the range of pwm, but it takes a lot of space. I would be really pleased, if there is a way to do this, without an additional board.

Pigwomaniak

#2

Hello,

Does it work if you use the module PWM ? https://dev.px4.io/en/middleware/modules_command.html
For exemple “pwm min -c 4 -p 600” and “pwm max -c 4 -p 2500”
It will be rewritten at startup so if it works like you want, you’ll have to write it in a startup script in init.d directory.

Vivien

1 Like
#3

That was very essential for me as well, I wrote it in extras.txt in the etc folder of the SD card: pwm max -c 56 -p 2450
pwm min -c 56 -p 650 one line may contain more than one output.
However, a upper limit of 2150uS (PWM_HIGHEST_MAX) is hardcoded in the source file drv_pwm_output.h (driver directory) and has to be changed to 2500us for using limits above 2150us.
Mavlink Console shows all pwm values and limits with “pwm info”

1 Like
#4

Thank you very much for help!

Now I will try it, and if I find problems I will ask again for help.

Pigwomaniak

#5

Vivien
Could you show example how to wite it properly in init.d?

#6

taileron
There is one tiny problem I have no etc folder on my sd card. All folders are about logs.

#7

You have to create the folder : mySDcard/etc/mixers/myMixer.mix

For exemple for a quad x model you can write at the end of mySDcard/etc/init.d/4001_quad_x : “set PWM_AUX_MIN 800” and “set PWM_AUX_MAX 2200”

#8

… in the sd´s etc I created an extras.txt file that contains the settings about pwm limits and attention the pwm_highest_max is still hardcoded at 2150uS

#9

So I have to create extras.txt and there I have to write there comand like this:
" max -d /dev/pwm_output1 -c 1 -p 2300"
I have tried to put this comand in my custom airframe file but it do not work. I think also that there is no need to make new init.d file with “set PWM_AUX_MAX 2200” if I already have it in my airframe file in firmware. Am I correct?

#10

for main outs syntax in extras.txt is:
pwm max -c 456 -p 2200
pwm min -c 456 -p 750
pwm failsafe -c 123 -p 900

-d /dev/pwm_output1 has to be in between for doing it for aux instead of main

pwm info -d /dev/pwm_output1
shows the loaded aux pwm limits with mavlink console to control the activity of the entries

the same syntax can be typed directly into the mavlink console and immediately takes the results for testing all before adding it to the extras.txt file to the sd