Where I take the next step in developing code in C for the ATmega328. This time, I review the PWM functionality of the ATmega328.
Sources#
- Microchip AVR ATmega328 Go to this page for the datasheet, you will need it.
- Definitive UNO pinout, see below
- avr-libc Standard AVR C Library
- Secrets of Arduino PWM Great tutorial as to how to write code for PWM on the ATmega328
- DIYODE: PWM Classroom Great educational article on PWM and DC Motors

Arduino Uno Pinout
Introduction#
Pulse-width modulation (PWM) is a useful technique for controlling DC motor speeds, LED intensity and creating analog waveforms. The idea is to modulate (or change) the width of a digital signal (a pulse) to deliver a varying amount of voltage. The change is called the “duty cycle”, it will range from 0-100%, and the high the number, the greater the voltage delivered. PWM is valuable as it allows you to use less power to keep motors running or make LEDs bright. If the concept remains foreign to you, I recommend you read the noted sources above before going forward.