The examples in this guide are no longer supported. Please check out the MCP4725 12-Bit DAC Tutorial guide for CircuitPython and Python usage: https://learn.adafruit.com/mcp4725-12-bit-dac-tutorial
Already mastered Analog Inputs with the Pi, and looking for a new challenge?  How about: How can I generate an analog output on the Pi?!

There are several ways you can accomplish this, but one of the easiest and most flexible is to use a dedicated IC called a Digital to Analog Convertor (or DAC).  A DAC allows you to specify a numeric value (0..255 for an 8-bit DAC, 0..4095 for a 12-bit DAC, etc.), and the IC will output a voltage based on the supply voltage, and relative to that numeric value.  For example, using a 12-bit DAC like the MCP4725 we'll be using here, setting the value to 2048 on a 3.3V system will results in ~1.65V output on the DAC.

This guide will show you everything you need to know to be able to generate precise analog outputs using your Pi and the MCP4725 12-Bit I2C DAC, from connecting everything up, to how to use our easy Python library.

What You'll Need

The following products are used in this tutorial:

This guide was first published on Aug 17, 2012. It was last updated on Mar 08, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.