Community Forum

Servo example did not response

(Huy Vu) #1

Hello, I have trouble with the servo example on both C++ and Python. I connect a SG90 servo to pin 1, connect 5v power to pin 12 by a breadboard power supply module, then run the Servo example on Python but the servo does not response. I check the voltage on pins and it is 5v on each one, I also stop running arducopter. How can I fix this!
Thank you

(Tatiana Andreeva) #5

Hi @vqh2308,

Could you post here the output you get after you run the example?

(Barry Bolton) #6

Does not look like you are plugged in to the signal pin. Looks like the lead that goes to the bread board is only plugged in to the low and middle pin which only power and ground

(Huy Vu) #7

Hello Tatiana! Here is my result

Hello Barry, the 12 pin is my BEC plug in, which power my pins for pwm output, so I only need to plug in power and ground.

(Barry Bolton) #8

Ah yes I see now…

(Tatiana Andreeva) #9


Is there any chance that something is wrong with the servo? Do you have another servo to test?

(Huy Vu) #10

So I checked the ADC on Navio2, I saw this

A1 output is 18V, but when I used a multimeter to checked, the output on every pin is 5V. Is there anything wrong?

(Tatiana Andreeva) #11

Hi @vqh2308,

Values you see in the ADC example output are correct. There’s an issue with showing A1 voltage in this example and we’re in process of fixing it.

So, at least it’s clear that the servo rail is supplied with power. Do you have an RC transmitter and receiver? You can connect the servo to one of the receiver channels and check if moving the transmitter sticks affects servo’s position. Just to check whether this servo works or not.

(Huy Vu) #12

I already tried my servo with a receiver and transmitter and it worked fine. When I use navio to control ESC and motor through mission planner, it works. May be I will try it with another kind of servo other than sg90 to see if it work.

(Tatiana Andreeva) #13


This servo should work too.
Haven’t you changed anything in the example code?
The servo is connected to the first PWM output, isn’t it?

(Huy Vu) #14

Yeah, the pin right next to ppm pin, and I did not change anything in example code

(Tatiana Andreeva) #15


Could you please try powering the servo rail from the UART port and test the servo example once more?

You can connect wires as shown on the picture in this comment:

(Huy Vu) #16

It does not work, the servo is not moving. When I try the servo with arduino uno, it works normally. I think maybe there is something wrong with the period or pulse width range.

(Huy Vu) #17

Oh yeah, the problem is not from my navio2 board, it is the servo. When I changed the example to
while (True):
# time.sleep(1)
# pwm.set_duty_cycle(SERVO_MAX)
# time.sleep(1)
The servo did work. I figured out that some sg90 servo have errors that it does not response to loop command, it can only move to a specify angle. Therefore, I will use other servos to try on.
Anyway, thanks for considering my questions again!