SG90 Servos not moving at the same time

I plan to have two servos for ailerons of my aircraft.
The issue is that the 2 servos do not move in sync. They should move opposite to each other at the same time, but sometimes they do, sometimes they don't. They are both powered by the 5v ouput, if I remember correctly, from the arduino uno board.

void loop(){
// Joystick
  xPosition = analogRead(VRx);
  yPosition = analogRead(VRy);
  SW_state = digitalRead(SW);
  mapX = map(xPosition, 0, 1023, 0, 180);
  mapY_L = map(yPosition, 0, 1023, 0, 180);
  mapY_R = map(yPosition, 0, 1023, 180, 0);
  aileronLServo.write(mapY_L);
  aileronRServo.write(mapY_R);
}

That's probably the problem. The Uno 5v pin is not intended to power high current devices like motors and servos. If you power the servos with a separate supply does the problem exist?

3 Likes

But by what pin powered arduino itself? by VIN?

1 Like

I'm a hobby microcontroller-user and a hobby RC-pilot.
As an airplane can crash down out of the air I recommend that you use a
ready to use transmitter / receiver you can buy off the shelf instead of trying to develop your own remote-control based on a microcontroller.

At hobbyking a complete set with transmitter and receiver start at $30

Of course it is fun to create things from scratch.
If you insist on using a microcontroller I recommend that you start with a car instead of a plane. Because a car just might bump into some obstacle maybe flip on the back and that's it without getting damaged or destroid. Or it might just stop driving which is no problem.

An airplane that looses control through a software-bug will 100% crash down.
How many material can you buy for $30 to build up a new plane?

If you have achieved a high reliable code you can move on from the car to the airplane.

If you are a beginner about RC-flying that adds another layer of learning
You should start with an airplane that is easy to fly and self-stabilising.

best regards Stefan

1 Like

4xAA batteries will power two SG90 servos. Don't forget to connect all the grounds.

You will damage the Arduino if you try to use the 5V output for motors and servos. Avoid tutorials that suggest this is OK!

1 Like

I agree with red_car : it is the problem.
You can use lithium battery. Take care about the voltage of your servos.
Here an example : https://www.tinkercad.com/things/2W13kjSBVSl

You can see that only 1 "little" servo like SG90 work with a current up to 100mA so you need at least 200mA for your project, only for the servos.

I guess you servo are a bit bigger than the SG90 ?

And according to the datasheet of arduino UNO
https://docs.arduino.cc/resources/datasheets/A000066-datasheet.pdf

the board can use a max current about 700mA.

You can see also this pdf

for further informations

Have fun ! :slight_smile:

1 Like

A typical SG90
Specs from that page:

  • Electrical Specification (Function of the Performance): Operating speed (at no load): 0.09±0.01 sec/60°(4.8V ) 0.08±0.01 sec/60°(6V)
  • Running current (at no load): 400±30mA (4.8V ) 500±30mA(6V)
  • Stall torque (at locked): 2.0±0.20kg·cm (4.8V ) 2.2±0.20kg·cm(6V)
  • Stall current (at locked): 1300±40mA (4.8V ) 1600±50mA(6v)
  • Idle current (at stopped): 6±1mA (4.8V ) 6±1mA(6v)
  • Running life(at no load): >350000 Turns(4.8V ) >320000 Turns(4.8V )
    Consider the implications of the Running current and Stall current; conservatively, remember that the Starting current approximates the Stall current, until the arm begins to move. Finally, look carefully at your application, to ensure that at the ends of motion, you're not going into stall by demanding a position the servo doesn't quite get to.

Moral of the story? Find the specs for the servo you're actually using.
C

1 Like

Not true. The SG90 briefly draws the start/stall current every time it starts moving. That is around 1 Ampere, depending on the manufacturer.

A good rule of thumb is to have a separate servo power supply capable of providing 4.8 to 6V at 1 Ampere per servo (for small servos like the SG90) or 2.5 Amperes per servo for larger servos (MG996R).

2 Likes

@jremington Well, that might be a tad conservative, if you can guarantee not moving more than one at a time, AND turn off the servo between every move, and guarantee you don't stall due to end-of-travel. etc. etc.
But then again, you pretty much restated what I had already posted, so I guess that's a :+1: for my post.
:wink:
C

1 Like

I was reacting to the misinformation posted by @pascal_ing, and added the information about MG996R, which is also very popular on this forum.

1 Like

As was I. The constant mythmaking that an SG90 servo only needs 100 mA can only be countered by providing links to SG90 Servos that draw one heck of a lot more. Additionally, the application the servo is used for is very important. If the servo is driven against hard stops and not tuned, then the stall current can become the 'at rest' current, for a little while anyways.

C

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.