Home        Store        Learn        Blog

How to use servos correctly?

List,

Sorry if this is an obvious question but I am very new to all of this. I am trying to make a simple AUV with three thrusters as well as servos for control surfaces. I have the thrusters working. I am using an XBOX controller to control them and it works great. My issue arises with servos. My understanding is that servos are connected to FMU PWM-OUT and are powered by a BEC off of one of my ESC’s. I have done this and can see the rail is getting power. My understanding is that after this is done you need to set BRD_PWM_COUNT. I set this to 6 based on another post I read on the forums and really don’t have a good idea why that value is used. After this, i have set the joystick buttons 9 and 10 to servo_1_min and servo_1_max. This makes sense to me but I am not sure if it is correct. I have all of this setup but when I try to trigger the servo with the joystick buttons nothing happens. I can see power going to the servo and have tested it from raspberry pi via pigio so I am pretty sure its good. I have attached two images hoping that helps. Thank in advance.

Robi


Hi @Robi_Sen,

This is correct

You shouldn’t need to change this - ArduSub has it set to 4 by default, and the first three can be controlled using the joystick controls (the servo_n_* functions), or you can control all 4 using pymavlink. Out of interest, do you know where you got the impression that you should change it?

Assuming you want to control your servo by fully turning it in each direction, that should be fine. If you want to control it in smaller steps then you likely want servo_1_inc and servo_1_dec to increment/decrement the set angle.

From your image I assume you’re using a Pixhawk 4. The IO-PWM-in connection in your photo is for motor control - if the thrusters are working correctly then presumably you’ve correctly connected that to the I/O PWM OUT port of the Pixhawk 4. Servo connections go through the AUX pins, and it looks like you haven’t connected the FMU PWM OUT port from the Pixhawk 4 to the FMU-PWM-in port of your power management board (PM board), so there’s no way for the servo signal to get through. I expect plugging in that cable should solve your problem, since the rest of your setup seems fine :slight_smile:


On an unrelated note, if you’re not already on it I’d suggest using the ArduSub 4.2 firmware (Development instead of Stable), as it includes some changes to enable the leak detector and pressure sensor functionality with a Pixhawk 4 (as per here).

1 Like

Thanks Eliot. I don’t know how I missed the wiring. So embarrassing! As to your questions, I found the answer to changing your BRD _PWM_COUNT on a forum. Ill share it later if I can find the URL. I will install ArduSub 4.2. comment about ArduSub firearm. Thank you again Eliot.