top of page

Pulse Width Modulation (PWM) and Robotics

In the world of robotics, control and efficiency are paramount. Pulse Width Modulation (PWM) plays a crucial role in achieving these goals. PWM is a technique used to encode information in a pulsing signal, where the relative width of the pulse is modulated to carry information.


PWM is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of "on time" is called the pulse width.



PWM Cycle


To get varying analog values, we change, or modulate, that pulse width. If we repeat this on-off pattern fast enough with an LED, the result is as if the signal is a steady voltage between 0 and 5v controlling the brightness of the LED !!


In the graphic above, the green lines represent a regular time period. This duration or period is the inverse of the PWM frequency. In other words, with PWM frequency at about 500 Hz, the green lines would measure 2 milliseconds each.


In other terms, Pulse-width modulation of a signal or power source involves the modulation of its duty cycle to either convey information over a communications channel or control the amount of power sent to a load.


DC Motor


A DC motor is an electrical motor that uses direct current (DC) to produce mechanical force. 


The outside of a DC motor is the stator: a permanent magnet that does not move. The inside part is the rotor, which does move. When DC power is sent through the rotor, it creates a temporary electromagnetic field that interacts with the permanent magnetic field of the stator. 

How DC Motor works?

The diagram shows how the commutator (in green) and brushes (in red) work together to let current flow to the electromagnet, and also to flip the direction that the electrons are flowing at just the right moment. 


The commutator's job is to keep the polarity of the field flipping, which creates  attracting and repelling forces and keeps the rotor rotating. This creates the torque needed to produce mechanical power. 


Controlling DC Motor Speed


One of the most common applications of PWM in robotics is controlling the speed of DC motors. By varying the duty cycle of the PWM signal, the average voltage applied to the motor can be controlled. This, in turn, controls the speed of the motor.


For example, if we want a robot to move slowly, we can send a PWM signal with a low duty cycle to the motor. Conversely, if we want it to move quickly, we can send a PWM signal with a high duty cycle.


PWM also helps in achieving efficient power usage. Instead of using variable resistors or voltage regulators to control the speed of motors, which would dissipate excess energy as heat, PWM switches the power supply to the motor on and off rapidly. This switching is so fast that the motor's inertia smooths out the on-off nature of the signal, resulting in varying speeds without wasting energy as heat.


In the next post, we will talk about Servo Motor and how PWM is used to control its position.

52 views0 comments

Recent Posts

See All

Comments


Subscribe

Subscribe to our mailing list for regular updates on news, events, insightful blogs, and free code!

Thanks for subscribing!

bottom of page