PCA9685 board/How a servo listens/03. A pulse, not an angle
How a servo listens · 03 of 13

A pulse, not an angle

A servo reads the width of a pulse and turns that into a position. 1500 µs is the middle, and 1000 and 2000 µs are the two ends by convention, but no two servo models agree on how far past those ends they go. Commanding a width the servo cannot reach is what makes it buzz.

The width is the position

A servo has a motor, a gearbox and a sensor on its output shaft. Inside, a small circuit measures each incoming pulse and turns the motor until the shaft sensor agrees with it. Nothing in the pulse says "degrees": the width is the whole message.

The width of one pulse is the position
inside 1000 to 2000 µs
Pulse width1500 µs
Pulse
1500 µs
Duty
7.5 %
Zone
safe start
Inside 1000 to 2000 µs: a safe place to start. Every hobby servo moves somewhere sensible here, and 1500 µs is the middle. The pulse is only 5 to 10 % of the period; the rest of the 20 ms is the servo holding still.

The convention is 1000 µs for one end, 1500 µs for the middle and 2000 µs for the other end, with a pulse repeating every 20 ms. Change the width and the horn follows. Past the ends the drawing stops, and so does a real servo: its gears hit a stop and the motor keeps pushing.

Real servos go past the convention

1000 to 2000 µs is a safe middle, not a specification. Many servos turn further both ways; an SG90, for example, is often quoted at about 500 to 2400 µs for about 180°. Other units of the same model land a little differently.

So find the range of your own servo, once:

  1. Start at 1000 and 2000 µs.
  2. Widen one end by 50 µs and send it.
  3. Stop when the servo buzzes at that end, and step back 50 µs.
  4. Do the same at the other end.

A buzzing servo is a stalled motor. It draws far more current than one that has arrived, it heats up, and it wears the gears. Every servo in a project should have its own two limits in the sketch.

Why first projects buzz

Older PCA9685 tutorials set their ends as SERVOMIN 150 and SERVOMAX 600. Those are counts, not microseconds, and at 50 Hz with the chip's 25 MHz clock they are 732 µs and 2928 µs. That is wider than most hobby servos go, so the first sweep drives both ends into the stops.

The Adafruit library has writeMicroseconds(), which takes the width directly. This book uses it everywhere, so the numbers in a sketch are the numbers on this page.

Continuous rotation servos

A continuous rotation servo has no shaft sensor to compare against. It reads the same pulse as a speed: about 1500 µs is stop, wider turns one way, narrower the other, faster the further from 1500. The exact stop point differs between units.

The three wires

Brown or black is ground, red is power and always in the middle, and orange, yellow or white is the signal. That matches the board's servo field from bottom to top: GND, V+, PWM.

When it does not work

The servo buzzes and gets warm at one end of its travel.

It has been sent a pulse wider than its gears allow, so its motor keeps pushing against the end stop. Bring that end 50 µs back toward 1500 until the buzz stops, and use that as the limit for this servo.

My servo only turns about 90 degrees between 1000 and 2000 µs.

That is normal. The 1000 to 2000 µs convention covers roughly the middle of what many servos can do. Widen each end 50 µs at a time, listening for the buzz, to find the full range of your model.

A continuous rotation servo never stops turning.

A continuous rotation servo reads the pulse as a speed and a direction, and about 1500 µs is stop. Its exact stop point varies from unit to unit: step the pulse a few microseconds at a time around 1500 until it holds still.

Two servos of the same model stop at slightly different angles.

Each servo's electronics map width to position a little differently, and the horn sits on the spline wherever it was pressed on. Give each channel its own end values in the sketch rather than one pair for all.

Alongside this page
Where this goes next

How the chip turns a pulse width into a number, and the one setting nobody can know without measuring.

4096 counts →

Edit this page — content/books/pca9685/a-pulse-not-an-angle.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

PCA9685 16-Channel Servo Driver Board, USB-C Powered

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →