The examples in this guide are no longer supported and may not work. We are only supporting CircuitPython on our boards. For more information about using analog I/O with CircuitPython, check out the CircuitPython Essentials: https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-in and https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-out

A digital to analog converter (DAC) can take a digital or numeric value and convert it into a voltage.  Think of a DAC as the opposite or compliment to an analog to digital converter.  Instead of reading analog voltage values the DAC will generate voltage values based on a digital or numeric input.

Digital to analog converters are useful when interfacing with some analog components, for example a speaker which plays sound and music.  Sound files on your computer are stored as numbers in a digital format but speakers can't 'play' these numbers and instead need a special analog signal of varying voltages to make sound.  A digital to analog converter can take digital values like music samples and converts them into voltages and analog signals that can drive a speaker.

MicroPython boards with a built-in DAC are somewhat uncommon.  Currently the pyboard is the only board with a built-in DAC, other boards like the ESP8266 do not support a DAC.  However you will see on the next page for pulse-width modulation that for boards without a DAC you can sometimes get similar 'digital to analog' capabilities.

Since most MicroPython boards don't have a built-in DAC its usage won't be covered in detail in this guide.  For the pyboard consult its DAC documentation for examples of its use.

This guide was first published on Sep 06, 2016. It was last updated on Sep 06, 2016.

This page (Digital to Analog Converter) was last updated on Jan 25, 2021.