The Adafruit MCP4725 is a digital-to-analog converter (DAC) breakout board that provides a 12-bit resolution. This means it can convert a digital value into one of 4096 (2^12) different analog voltage levels. DACs are commonly used in applications where an accurate analog output is required, such as in audio equipment, signal generation, and fine control of actuators.
Common applications of the MCP4725 include:
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply (2.7V to 5.5V) |
2 | GND | Ground |
3 | SDA | I2C Data |
4 | SCL | I2C Clock |
5 | A0 | Address select pin |
#include <Wire.h>
#include <Adafruit_MCP4725.h>
Adafruit_MCP4725 dac;
void setup() {
Wire.begin(); // Initialize I2C
dac.begin(0x60); // Initialize MCP4725, default address 0x60
}
void loop() {
uint16_t outputValue = 2048; // Midpoint of 12-bit range (0-4095)
dac.setVoltage(outputValue, false); // Set DAC output to midpoint
delay(1000); // Wait for 1 second
// Repeat with different values as needed
}
dac.setVoltage(value, true);
function to update the output voltage with the internal EEPROM, which will retain the voltage output after power cycling.Q: Can I use the MCP4725 with a 3.3V system? A: Yes, the MCP4725 is compatible with 3.3V systems. Make sure to connect VDD to 3.3V.
Q: How do I change the I2C address of the MCP4725? A: The A0 pin can be connected to GND or VDD to change the address. The default address is 0x60, and connecting A0 to VDD changes it to 0x61.
Q: Can the MCP4725 output negative voltages? A: No, the MCP4725 can only output voltages from 0V to VCC. For negative voltages, additional circuitry is required.
Q: How many MCP4725 devices can I connect to a single I2C bus? A: You can connect up to two MCP4725 devices to a single I2C bus by using different addresses for each device.