Actuators & Control · Study deck

Servo Motors: Calibration and Applications

A servo turns to a target angle.

Motor Max is your guide for this deck.

servomotors
Motor Max, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: If a vent linkage needs 0.12 N-m, the ideal margin is only 0.294 / 0.12 = 2.45x before friction, off-axis loading, supply-voltage drop, and gear wear.
  • Explain: If the command corresponds to 90 degrees and the feedback reports 84 degrees, the loop sees a +6 degree error and drives the motor in the direction that shrinks the error.
  • Explain: They replace the hobby servo's potentiometer with an encoder or resolver, use a brushless motor plus a dedicated servo drive, and usually close nested torque-current, velocity, and position loops.
iotclass.org

Major section

Pan-Tilt Camera Mount

A common IoT application is a pan-tilt camera mount.

  • The software clamps protect the intended 0-180 and 0-90 degree ranges; commissioning must still verify that those limits stay clear of the mechanism's physical stops.
  • Limits: each 10-degree step is clamped; TILT_MAX 90 stops backward-looking; attach(pin, 500, 2400) bounds pulse width.
iotclass.org

Major section

Deep Dive: Calibration, Deadband, and Servo Control Loops

A hobby servo command is a position pulse, not a motor-power duty cycle.

  • The 20 ms frame repeats the command; the high-pulse width carries the angle.
  • Sending a 50% duty-cycle signal would hold the line high for 10 ms in each frame, far outside the normal command range.

Key terms

Calibration
Calibration is where a bench demo becomes a reliable mechanism.

Why it matters

A small deadband prevents constant buzzing: with a 5 microsecond deadband and a 0.18 degree-per-microsecond scale, the no-correction window is about 5 x 0.18 = 0.9 degrees.

Servo motor actuator package with PWM command, driver, motor, and potentiometer feedback
Servo motor actuator package with PWM command, driver, motor, and potentiometer feedback
iotclass.org

Major section

Deep Dive: Calibration, Deadband, and Servo Control Loops (continued)

A 1.0 ms pulse in a 20 ms frame is only 5% duty cycle, 1.5 ms is 7.5%, and 2.0 ms is 10%.

  • Calibration is where a bench demo becomes a reliable mechanism.
  • If one servo's safe travel is 1050 microseconds to 1950 microseconds, the usable span is 900 microseconds.
  • Torque and current need the same engineering treatment.
iotclass.org

Major section

Deep Dive: Calibration, Deadband, and Servo Control Loops (continued)

If it overshoots to 92 degrees, the sign changes and the driver corrects back.

  • Mapping that to 0-180 degrees gives 900 / 180 = 5 microseconds per degree, so a 45 degree command is approximately 1050 + 45 x 5 = 1275 microseconds.
  • A 3 kg-cm servo can ideally hold about 3 kg at 1 cm, or 1 kg at 3 cm, before losses.
  • Industrial servos use the same feedback idea at a tighter scale.
iotclass.org

Major section

Deep Dive: Calibration, Deadband, and Servo Control Loops (continued)

In SI units that is roughly 3 x 9.81 N x 0.01 m = 0.294 N-m.

  • If a vent linkage needs 0.12 N-m, the ideal margin is only 0.294 / 0.12 = 2.45x before friction, off-axis loading, supply-voltage drop, and gear wear.
  • Limits: 3 kg-cm is 0.294 N-m: only 2.45x over a 0.12 N-m linkage.
  • If the command corresponds to 90 degrees and the feedback reports 84 degrees, the loop sees a +6 degree error and drives the motor in the direction that shrinks the error.
iotclass.org

Major section

Deep Dive: Calibration, Deadband, and Servo Control Loops (continued)

Too wide a deadband feels sloppy; too narrow a deadband can hunt when the signal is noisy or the linkage is springy.

  • They replace the hobby servo's potentiometer with an encoder or resolver, use a brushless motor plus a dedicated servo drive, and usually close nested torque-current, velocity, and position loops.
  • The current loop controls torque, the velocity loop shapes shaft speed, and the position loop removes final error.
  • The hobby servo hides this behind a three-wire pulse interface; the industrial servo exposes tuning so machine axes can manage stiffness, following error, and response.
iotclass.org

Major section

Smart Vent Zone-Heat Design

Staggered movement also reduces noise.

  • The system should integrate with a smart thermostat via Wi-Fi and run on mains power (USB adapter at each vent).
  • A large metal-gear servo is overkill (11 kg-cm vs 3 kg-cm needed).
  • This keeps cable runs under 3 meters for PWM signal integrity and avoids putting 8 separate devices on Wi-Fi.
iotclass.org

Deck summary

Key takeaways

A common IoT application is a pan-tilt camera mount.

  • A hobby servo command is a position pulse, not a motor-power duty cycle.
  • A 1.0 ms pulse in a 20 ms frame is only 5% duty cycle, 1.5 ms is 7.5%, and 2.0 ms is 10%.
  • If it overshoots to 92 degrees, the sign changes and the driver corrects back.
  • In SI units that is roughly 3 x 9.81 N x 0.01 m = 0.294 N-m.
iotclass.org

Retrieval practice

Recall check 1 of 5

Motor Max says: answer from memory, then check your reasoning.

Q1A standard hobby servo receives a 1.5ms pulse at 50 Hz. What position will the servo move to?

AThe 0-degree minimum position for a valid 1.5 ms servo pulse.
BThe 90-degree centre position for a valid 1.5 ms servo pulse.
CThe 180-degree maximum position for a valid 1.5 ms servo pulse.
DThe servo's unmoved position because 1.5 ms is outside its valid range.
Show answer

Answer: B Answer: B) 90 degrees (center position).

iotclass.org

Retrieval practice

Recall check 2 of 5

Motor Max says: answer from memory, then check your reasoning.

Q2A high-torque servo has a stall current of 2.5A. If you are building a 3-servo robotic arm, what minimum power supply current rating do you need?

A2.5 A, counting just one stalled servo instead of all three together.
B5 A, counting only two of the three servos at their stall current.
C7.5 A, adding the 2.5 A stall draw of all three servos together.
DBudget 1 A, because each servo draws less than its stated stall current during the movement.
Show answer

Answer: C see answers page

iotclass.org

Retrieval practice

Recall check 3 of 5

Motor Max says: answer from memory, then check your reasoning.

Q3A maker sends a hobby servo a steady 1.5 ms pulse every 20 ms and it holds mid-position, resisting a gentle push. What control mechanism holds its position?

AFeedback cancels position error
BDuty cycle holds mid-speed
CUnpowered detent torque locks center
DThe 20 ms period is the angle
Show answer

Answer: A A hobby servo encodes target angle in the high-pulse width, compares it with internal position feedback, and drives the motor to reduce error.

iotclass.org

Retrieval practice

Recall check 4 of 5

Motor Max says: answer from memory, then check your reasoning.

Q4A smart vent system uses a standard hobby servo (0-180 degrees) to adjust airflow. The design requires 270 degrees of rotation to fully open and close the damper. What is the best solution?

ASend PWM values outside the normal 1-2ms range to force the servo beyond its limits
BMechanically modify the servo by removing the internal position stop
CUse a 1.5:1 angle-increasing linkage or gear-up mechanism
DUse two 180-degree servos connected in series to achieve 360 degrees total
Show answer

Answer: C see answers page

iotclass.org

Retrieval practice

Recall check 5 of 5

Motor Max says: answer from memory, then check your reasoning.

Q5Three servos rated for 5 V (2.5 A stall each) share an ESP32 board's 5 V pin, specified here for only 500 mA. They jitter and the ESP32 resets when they start moving. Which design mismatch best explains this?

AThe servos need 6V, not 5V
BThe PWM frequency is incorrect
CServo current causes brownouts
DServo signal wires are too long
Show answer

Answer: C This is a classic beginner mistake.

iotclass.org

Retrieval practice

Recall check 5 of 5

Motor Max says: answer from memory, then check your reasoning.

Q6Complete the code to control a servo motor position:

Aservo = PWM(Pin(18), freq=50)
Bservo = PWM(Pin(18), freq=5000)
Cservo = Pin(18, Pin.OUT)
Dservo = PWM(Pin(18), freq=1000)
Show answer

Answer: A Servos use 50 Hz PWM.

iotclass.org

Print reference

Answers 1 of 3

Answer key.

  1. B · Answer: 90 degrees (center position).
  2. C · Answer: 7.5A. In the worst case, all three servos could stall simultaneously (e.g., when holding a heavy load or reaching mechanical limits). Each draws 2.5A at stall, so 3 x 2.5A = 7.5A total. In practice, you might use a slightly larger supply (8-10A) for safety margin. Never power multiple servos from the ESP32's 5V pin, which provides only about 500mA.
iotclass.org

Print reference

Answers 2 of 3

Answer key.

  1. A · A hobby servo encodes target angle in the high-pulse width, compares it with internal position feedback, and drives the motor to reduce error.
  2. C · A 1.5:1 angle-increasing linkage can turn 180 degrees of servo motion into 270 degrees at the damper, with output torque reduced to at most two-thirds before losses. Verify travel, load torque, and stops. Driving beyond the rated range or removing a stop alone does not establish safe 270-degree positional control.
iotclass.org

Print reference

Answers 3 of 3

Answer key.

  1. C · This is a classic beginner mistake.
  2. A · Servos use 50 Hz PWM.
iotclass.org