O'Reilly logo

Internet of Things with Python by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using PWM to generate analog values

Pulse width modulation, known as PWM, is a technique that makes it possible to generate an analog result with digital means through the usage of a digital on-off pattern. The pins that provide PWM capabilities use a digital control to create a square wave and it can simulate voltages between the configured IOREF voltage (5V in the default board configuration) and 0V by controlling the amount of time that the signal spends in the ON status (IOREF voltage) and the time the signal spends in the OFF status (0V). The pulse width is the duration of the signal in the ON status (IOREF voltage), and therefore, pulse width modulation means changing the pulse width to get perceived analog values.

When you repeat the signal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required