If you are having issues with the exercises, please create a ticket on DevZone:
Click or drag files to this area to upload. You can upload up to 2 files.

Lesson 4 – Pulse Width Modulation (PWM)


Pulse Width Modulation (PWM) is a technique commonly used for controlling analog devices using a digital control signal. With this analog-like digital signal, we can control a range of devices, from motors, lighting, power control and conversion. In this lesson, we will go through the basics of PWM control and take a closer look at how we can configure the PWM API for different things by changing the active duty cycle of the signal and by adding different compatible nodes to the overlay file in nRF Connect SDK.

In the exercise section of this lesson, we will practice controlling an LED on the DK using the PWM API. Then we will modify the devicetree to control an external servo motor device, and how to add a second PWM instance to be able to control both the servo and an LED on the board.


  • Understanding what the PWM Duty Cycle is and how to use this to control an LED with a varying degree of light intensity
  • Learn about the Zephyr PWM API
  • Learn more about how to use an overlay file
  • Understand the role of a custom node compatible in the device tree, how to use one and how to create one.

Special hardware requirements

  • For exercise 2: Tower Pro Micro Servo SG90 (Or other PWM-compatible servo motor device. Ex: TowerPro SG92R).
Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.