The Role of PWM in Signal Reconstruction

Pulse Width Modulation (PWM) Control / Visits:4

If you have ever built a robot arm, a pan-tilt camera mount, or a tiny walking robot, you have almost certainly used a micro servo motor. These little blue boxes—often an SG90 or an MG90S—are everywhere in hobbyist electronics. They are cheap, lightweight, and surprisingly strong for their size. But there is a hidden story inside every micro servo motor that most tutorials gloss over: the story of how pulse-width modulation (PWM) is not just a control signal, but a reconstruction mechanism. Understanding that story changes how you write firmware, how you wire your projects, and how you diagnose the dreaded servo jitter.

Why the Micro Servo Motor Is the Perfect Case Study

A micro servo motor is a closed-loop system packaged into a 20-gram plastic shell. Inside you will find a small DC motor, a gear train, a potentiometer, and a control board. The potentiometer reports the output shaft angle back to the control board, and the control board compares that feedback against the command it receives from your microcontroller. That command arrives as a PWM signal.

What makes the micro servo motor such a good lens for studying PWM and signal reconstruction is that the device itself performs a reconstruction. It does not receive a digital number like "45 degrees." It receives a train of pulses, and from the width of those pulses it reconstructs an analog target position. The servo's internal circuitry effectively acts as a decoder, turning timing information back into a physical quantity. In other words, the micro servo motor is a tiny, tangible demonstration of PWM-based signal reconstruction happening thousands of times per second on your workbench.

The Three-Wire Contract

Every micro servo motor honors the same three-wire contract: power, ground, and signal. The signal wire carries a PWM waveform, typically repeating at 50 Hz, which means a period of 20 milliseconds. Within each period, the high time of the pulse encodes the commanded angle. A 1.0 ms pulse might mean one extreme, a 1.5 ms pulse the center, and a 2.0 ms pulse the other extreme. The servo does not care about the voltage of the signal beyond logic thresholds, and it does not care about the shape of the edges. It cares about duration.

That duration-based encoding is the heart of the matter. The PWM signal is not the position itself; it is a representation of the position. Reconstruction is the process of turning that representation back into a physical reality, and the quality of that reconstruction depends on how faithfully the timing is preserved.

PWM as an Encoding Scheme, Not Just a Dimmer Trick

Most people first meet PWM through LED dimming. You blink an LED fast enough and your eye averages the brightness. That is a low-pass filtering effect, and it trains people to think of PWM as a way to fake an analog level. Servo control looks similar on an oscilloscope, but the semantics are completely different. With an LED, the duty cycle is the message. With a servo, the absolute pulse width is the message, and the duty cycle is almost incidental.

Duty Cycle Versus Pulse Width

This distinction matters enormously for signal reconstruction. If you generate servo PWM with a naive duty-cycle calculation, you can drift into trouble. Suppose your timer runs at a period that is not exactly 20 ms. A 7.5 percent duty cycle on a 20 ms period gives 1.5 ms, which commands center. But a 7.5 percent duty cycle on an 18 ms period gives 1.35 ms, which commands a noticeably off-center position. The servo reconstructs the angle from the pulse width, not from the percentage, so any error in the time base becomes an error in physical position.

This is why experienced firmware engineers configure servo timers in terms of microseconds, not percentages. On an STM32 or an ESP32, you set the prescaler and the auto-reload register so that one timer tick equals a known fraction of a microsecond, and then you compute compare values directly in ticks per microsecond of pulse width. The reconstruction accuracy of the micro servo motor is ultimately limited by the accuracy of your time base.

Resolution and the Quantization of Angle

A typical micro servo motor claims a resolution of roughly one degree, sometimes better. The potentiometer inside is a continuous analog device, but the control loop and the PWM decoder impose quantization. If your PWM generator can only produce pulse widths in 4-microsecond steps, then across a 1 ms control range you get about 250 discrete steps, which maps to a fraction of a degree for a 180-degree servo. That sounds fine, but cheap servos often have deadband—a range of pulse widths that all produce the same output position—of 5 to 10 microseconds. The deadband, not your timer resolution, frequently dominates the reconstruction error.

Understanding this lets you stop chasing phantom precision. There is no point in generating 1-microsecond PWM steps for a micro servo motor whose deadband is 8 microseconds. The reconstruction pipeline has a bottleneck, and it is usually mechanical and analog, not digital.

The Reconstruction Chain Inside the Servo

It helps to trace the signal path explicitly. Your microcontroller emits a PWM edge. The servo's signal input pin feeds a comparator or a microcontroller inside the servo that measures the high time. That measured width is converted into a target setpoint for the internal control loop. The loop compares the setpoint against the potentiometer voltage, which is itself an analog reconstruction of the output shaft angle. The error drives the motor through an H-bridge until the feedback matches the command.

From Pulse Width to Setpoint Voltage

Inside many analog servos, the pulse width is converted into a voltage by an integrator or a sample-and-hold circuit. The pulse charges a capacitor for its duration, and the resulting voltage becomes the reference for the position comparator. This is literal signal reconstruction: a time-domain quantity is transformed into a voltage-domain quantity. The RC time constant of that integrator determines how faithfully the pulse width maps to voltage, and it also explains why very short or very long pulses can behave nonlinearly at the extremes of travel.

Why Refresh Rate Matters for Reconstruction

The 50 Hz refresh rate is not arbitrary. It is fast enough that the servo's internal loop sees a fresh command before the output drifts far, but slow enough that analog circuitry from the 1960s could decode it cheaply. When you increase the refresh rate—some modern digital servos accept 300 Hz or more—you are increasing the sampling rate of the command signal. From a reconstruction standpoint, a higher refresh rate reduces the latency between your intended trajectory and the servo's knowledge of it, which is why high-performance digital micro servo motors feel crisper and hold position better under load.

However, there is a trap. Many analog micro servo motors will twitch or buzz if you drive them much above 50 Hz, because their internal decoder was never designed for it. The reconstruction filter inside expects a 20 ms period, and feeding it 3 ms periods causes the integrator to behave unpredictably. Always check the datasheet before increasing refresh rate.

Jitter, Noise, and the Enemies of Clean Reconstruction

Anyone who has commanded a micro servo motor from a software-timed loop on a Raspberry Pi knows the pain of jitter. The servo buzzes, twitches, and sometimes sweeps randomly. The root cause is almost always reconstruction failure at the timing level: the pulse widths are not stable from period to period.

Software PWM and Timing Uncertainty

Bit-banging a servo signal in a language with a garbage collector or a non-real-time operating system produces pulse widths that vary by tens of microseconds. The servo faithfully reconstructs whatever it receives, so an unstable command becomes an unstable position. The fix is hardware PWM or a dedicated servo driver such as a PCA9685, which generates 12-bit resolution pulses on 16 channels over I2C. With a stable time base, the reconstruction becomes clean and the buzzing disappears.

Power Supply Coupling

There is a second, sneakier enemy: power supply droop. A micro servo motor under load can draw several hundred milliamps in bursts. If it shares a supply with your logic, those current spikes can modulate the logic rail, which shifts the comparator thresholds inside the servo and corrupts the pulse-width measurement. The result is a position error that correlates with mechanical load—exactly the kind of ghost that drives builders crazy. Separate power rails and a fat bulk capacitor near the servo are not optional; they are part of the reconstruction signal chain whether you think of them that way or not.

Practical Design Rules for Faithful Reconstruction

Pull the lessons together into concrete habits. First, generate servo PWM from hardware timers configured in microseconds, never from delay loops. Second, keep the signal ground and the power ground tied at a single point near the supply to avoid ground bounce corrupting the pulse measurement. Third, respect the refresh rate spec of your specific micro servo motor; 50 Hz is safe, 333 Hz is for digital servos only. Fourth, budget your resolution against the servo's deadband so you do not over-engineer the firmware. Fifth, when a servo misbehaves, reach for the oscilloscope before the code editor—verify the pulse width and period at the signal pin, because the reconstruction inside the servo can only be as good as the waveform you feed it.

The micro servo motor is a small, cheap, and endlessly useful device, but it is also a compact lesson in signal reconstruction. Every time you command one, you are encoding a physical intention into timing and trusting a tiny analog computer to decode it back into motion. Treat PWM as a reconstruction problem rather than a magic number, and your robots will move smoothly, hold position firmly, and stop buzzing at you in confusion.

Copyright Statement:

Author: Micro Servo Motor

Link: https://microservomotor.com/pulse-width-modulation-pwm-control/pwm-signal-reconstruction.htm

Source: Micro Servo Motor

The copyright of this article belongs to the author. Reproduction is not allowed without permission.

About Us

Lucas Bennett avatar
Lucas Bennett
Welcome to my blog!

Tags