Skip to content
RED SAGSkills
easyEmbedded Systems Engineer interview question

What is PWM, how is it generated on a microcontroller, and what is it used for?

What the interviewer wants to hear

  • A square wave with fixed frequency and variable duty cycle
  • Average voltage or power is proportional to duty cycle
  • Generated by a timer in compare mode with a period and compare value
  • Used for LED dimming, motor speed, servos and simple DACs
  • Frequency choice matters: flicker, audible noise, switching loss

Model answer

PWM, or pulse width modulation, is a square wave at a fixed frequency where we change how long it stays high in each period, the duty cycle. The average power delivered is proportional to the duty cycle, so 25 percent on gives about a quarter of full power. On an MCU a hardware timer generates it: the auto-reload value sets the period, and a compare register sets when the output toggles, so the CPU does no work per cycle. Common uses are LED dimming, motor speed control through an H-bridge, hobby servos, which read the pulse width, and simple DACs with an RC filter. Choosing the frequency matters: LEDs need it high enough to avoid visible flicker, motors usually above 20 kHz to avoid audible whine, but higher frequencies raise switching losses in the drivers.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Embedded Systems Engineer questions