# How does the magnetic field in a servo motor acts according to the PWM signal?

I have read about servo motors but have problem grasping the main idea of obtaining fixed position by the magnetic field. The servo motor position is said to be controlled by PWM signal. And a toy DC motor speed can be controlled by PWM. I'm mostly wondering the electro-mechanical part rather than the feedback.

So in toy DC motor case the PWM controls the speed which I can make sense. But in servo motor case how come the PWM signal causes a non moving magnetic field? I guess servo motor works like a compass where the magnetic field is fixed(non-moving), is that correct? If so, is there a way to grasp the how the PWM causes such a magnetic field?

• If servo motor uses 1T-2T to represent +90 deg / -90 deg then the PW is converted to voltage error with servo angle sensor voltage to drive motor in direction to reduce error until null. thus current declines until null and stiffness is determined by error current (torque) applied to do work. Servo may use gears to increase torque Commented Jan 13, 2020 at 11:48
• Calling something a servo motor does not define what actual motor it uses. A lot use DC motors that might as well be grouped into your "toy" DC motor category. Additionally, you can use PWM or analogue DC voltages for controlling the speed of brushed DC motors. In other words PWM is a means to an end and not something fundamental about servos. Commented Jan 13, 2020 at 12:22

Most small servos don't use magnetic fields for position sensing, they use potentiometers. Here's a good beginner's level explanation in text with a video link.

They all seem to have the same basic components – a potentiometer hooked to a voltage regulator and one shot generator, which converts position of the armature to a PWM pulse. This PWM pulse is compared to the original one sent by the microcontroller. This logic board finds the difference between the pulses, which is called the error.

The magnitude of the error is sent to a pulse stretcher and the direction of the error is send to a flip flop to be stored as a high or low. The magnitude of the error is stretched out by the pulse stretcher. Then both parts of the error are sent to the output driver, which is probably an h-bridge. Most servos are 50HZ, which means this control loop is happening 50 times every second until the error is “zero”. The dead band for the pulse stretcher sets a minimum pulse length that it will stretch. Anything below this limit is considered zero error.

The PWM signal is not aimed at the motor: it's aimed at the control circuit inside the servo, which then chooses whether to turn the motor clockwise or anticlockwise if the PWM signal differs from the position measured by the potentiometer.

(Not to be confused with: stepper motors, or the use of EMF to sense position in BLDC motors, or situations where Hall sensors are used to measure shaft position. All of those are not usually called "servo" motors.)

• Im mostly wondering how does the magnetic field act. Is it rotating or stationary? And how does the PWM keeps it rotating to a specified position. That is a black box and no resource explains it. Commented Jan 13, 2020 at 11:56
• The magnetic field has nothing to do with it. Theoretical the servo motor can be any type: DC, stepper, BLDC even 3-phase. It is the control mechanism with the feedback which makes it work. Commented Jan 13, 2020 at 12:13
• That's a fairly clever way to control it. These days you'd just use a small microcontroller in the servo. I expect that old stuff has a lot more clever designs like that one. Commented Jan 13, 2020 at 15:01

You might need to make a distinction between 'power' PWM, and 'signal' PWM.

To command a typical servo, we use a PWM signal which has a high pulse of 1mS full left, 1.5mS centre, 2mS full right, which most servoes will handle being repeated at somewhere between 20Hz and 100Hz. These times are interpretted by the control electronics as a position, and the motor is driven to the commanded position.

To control the effective voltage, and therefore speed, of a DC motor, we might use power PWM, which chops the input voltage between supply and 0, to give an effective voltage at the motor of the time weighted mean.

• Im asking how the servo motor windings cause the shaft to rotate and how is PWM is interpreted. When I read about induction motors it is clear that a rotating magnetic field causes rotor to rotate by inducing voltage and hence currents so a force pair is created. But how does the servo rotates is not clear to me. Is it the magnetic field again? Is the principle like a compass alignment in a magnetic field? Commented Jan 13, 2020 at 13:50
• The servo rotates according to what motor is powering it. It could be a hydraulic or air motor, or if electrical a 3 phase BLDC, or stepper, or brushed permanent magnet. The point is that the PWM that controls it, and the motor that moves it, are totally decoupled by the control system. You might as well ask whether the font used to print your bus ticket affects the fuel the bus uses. If you want to ask a question about the brushed DC motor that's typically used to power cheap servoes, then do, but don't relate it to the PWM control signal. Commented Jan 13, 2020 at 15:04
• Servos are also often geared, so the "output" shaft position is not the same as the position of the motor shaft, and many shaft rotations correspond to a small shift in position. Commented Jan 13, 2020 at 15:23

The PWM you send the servo motor isn't the same as the PWM you send the motor itself. The one you send is just a command signal. It could just as easily be an analog signal voltage or serial message.

The actual drive signal containing power which is sent to the internal motor can do whatever it wants. Electronics in between can change it to reverse direction as required.

The motor in most servos is also brushed so the magnetic field rotates, but in discrete steps, not continuously. So the motor could easily be in a situation where the winding is energized but between commutation points, so the magnetic field isn't rotating and is just applying a force to the shaft and the shaft is static because it is being opposed by an equal load torque.

Conversely, if it is near a commutation point, combined with gearing, the servo motor output shaft could remain relatively still while the inner motor shaft dances around a position (being commanded by the electronics internal to constantly reverse direction to do so) to hold that position.