Welcome to Provide Your Own - analogWrite


Arduino’s AnalogWrite – Converting PWM to a Voltage

D-A_converter

When I first started working with the Arduino platform (it was also my first experience with microcontrollers), I was a little surprised that analogWrite didn’t actually output a voltage, but a PWM (pulse-width modulated) signal. After all, the ATmega had a A-D (analog to digital) converter along with Arduino’s analogRead. The complementary analogWrite function was there, but no D-A (digital to analog) converter on the AVR chip itself. Fortunately, there is an easy way to convert a PWM signal to an analog voltage. To do so you only need to implement a simple single-pole low pass filter. Does it sound complicated? It isn’t. There are some great online tools to help. Once you learn how to make one, you can quickly and easily output analog voltages from not only the Arduino, but PICs as well as any other microcontroller that has PWM output.

PWM Primer

Pulse width modulation (or PWM as it is most commonly known), is a way of encoding a voltage onto a fixed frequency carrier wave. Commonly used for radio controlled devices, it is similar to FM (frequency modulation) or AM (amplitude modulation) in what it accomplishes. Each type of modulation scheme has its own advantages … Read the rest

Posted in Tech | Also tagged , , | Section: | Comments closed