Pulse Width Modulation (PWM) or Pulse Duration Modulation is a type of modulation in which a technical quantity of electrical voltage changes between two values. At a constant frequency, the duty cycle of a square wave pulse is modulated, i.e. the duration of the pulses forming it. It is used to generate a pseudo-analog signal from a digital or analog environment to allow processing of this signal by switching components (behaving like open or closed switches).
A pure pulse duration modulated signal is generated by comparing a linearly ascending or descending signal with the analog input signal that is a short or a long time above it. At the intersections, the output signal is switched between two logic levels. Like a digital signal, it has the advantage that it can only assume – in this case: two – discrete values but its duty cycle can be infinitely variable, i.e. it is not discrete-time.
Suitable comparator circuits are used to generate a PWM signal from digitally available data (e.g. motor control). Many microcontrollers already contain PWM modules directly or support their implementation with suitable timer functions.
PWM is often used to transmit analog readings from sensors over long lines or radio. Since a voltage drop occurs on long lines, a distortion would occur if the information were transmitted in the form of a voltage level. In the case of transmission with PWM, it is sufficient if the receiver can still distinguish between levels 1 and 0.
In order to transmit analog signals over a digital link, the smoothing low-pass effect of a capacitance or inductor, e.g. a motor or a coil, is used to control them with the help of a pulse train. For example, digital circuits (e.g. microcontrollers) that can only generate switched signals can be used to control analogue devices (motors, heaters, etc.). The control unit does not necessarily have to be a digital device itself. For example, to control servos (transmission of the setpoint), an analogue value is modulated by a rotary potentiometer and demodulated again in the servo. In general, this is used when both advantages of analog signals (high resolution, simple, robust and more interference-free technology) and advantages of digital signals (constancy, simple, efficient amplification) are required.
Control via PWM is used for the purpose of changing the speed of newer case and CPU fans. Another application example is dimming by PDM control. This technology is used in particular for light-emitting diodes (LEDs), as they are often used as backlights on mobile phones or brake lights in newer motor vehicles. With a sufficiently short switch-on and switch-off time, the human eye only perceives the average luminosity, so that it can be controlled linearly with the duty cycle. Care must be taken to ensure that the clock frequency is set sufficiently high (e.g. 10 kHz) so that the eye cannot perceive any fluctuations in brightness (flickering), even when moving quickly.