adafruit_mcp4725 - MCP4725 digital to analog converter

CircuitPython module for the MCP4725 digital to analog converter. See examples/mcp4725_simpletest.py for a demo of the usage.

  • Author(s): Tony DiCola, Carter Nelson

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_mcp4725.MCP4725(i2c, *, address=98)[source]

MCP4725 12-bit digital to analog converter. This class has a similar interface as the CircuitPython AnalogOut class and can be used in place of that module.

Parameters:
  • i2c (I2C) – The I2C bus.
  • address (int) – The address of the device if set differently from the default.
normalized_value

The DAC value as a floating point number in the range 0.0 to 1.0.

raw_value

The DAC value as a 12-bit unsigned value. This is the the true resolution of the DAC and will never peform scaling or run into quantization error.

save_to_eeprom()[source]

Store the current DAC value in EEPROM.

value

The DAC value as a 16-bit unsigned value compatible with the AnalogOut class.

Note that the MCP4725 is still just a 12-bit device so quantization will occur. If you’d like to instead deal with the raw 12-bit value use the raw_value property, or the normalized_value property to deal with a 0…1 float value.