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.
Page last edited March 08, 2024
Text editor powered by tinymce.