Pages

Monday, September 3, 2018

MCP4725 DAC AVR ATmega library


In this post I present an AVR implementation for the MCP4725 DAC.

The MCP4725 DAC is a pretty common and cheap single channel 12 bit buffered voltage DAC, it also has an onboard EEPROM.
To drive this chip we can use I2C interface.



The ATmega8 used for my implementation has an embedded I2C interface, so we just can use that interface.
The selected I2C library is the one proposed by Peter Fleury, you can find it here: http://homepage.hispeed.ch/peterfleury/avr-software.html

To library provides simple functions to set the output channel of the IC by using raw value or a voltage value.


The voltage output of this chip is limited by his voltage input, that is 2.7v to 5.5v, and the current allowed at the output pin is 25mA.
If you need more current, or more voltage, you can use a combination of opamp and power transistors.

Up to 8 MCP4725 can be driven using this library, the IC address has to be selected using the hardware pulldown selector.

This project has been developed and tested on an ATmega8 running at 8Mhz.

An example program is provided in order to help the library usage.



Code

Notes
  • read risk disclaimer
  • excuse my bad english