Stufin
Home Quick Cart Profile

MCP4725 I2C DAC Breakout Module

Buy Now

Pin Configuration

  • MCP4725 I2C DAC Breakout Module Pinout
  • The MCP4725 I2C DAC Breakout Module is a digital-to-analog converter (DAC) that allows you to generate analog output voltages from digital signals. The module has a total of 6 pins, which are explained below:
  • Pin 1: VCC
  • Function: Power supply pin
  • Description: This pin is used to supply power to the module. It should be connected to a voltage source between 2.7V and 5.5V.
  • Connection: Connect to a suitable power source (e.g., an Arduino board's 5V pin or a battery).
  • Pin 2: GND
  • Function: Ground pin
  • Description: This pin is used to ground the module.
  • Connection: Connect to the ground pin of your microcontroller or a ground point in your circuit.
  • Pin 3: SCL (Serial Clock)
  • Function: I2C serial clock pin
  • Description: This pin is used for I2C communication and is responsible for generating the clock signal.
  • Connection: Connect to the SCL pin of your microcontroller (e.g., Arduino's SCL pin).
  • Pin 4: SDA (Serial Data)
  • Function: I2C serial data pin
  • Description: This pin is used for I2C communication and is responsible for transmitting data.
  • Connection: Connect to the SDA pin of your microcontroller (e.g., Arduino's SDA pin).
  • Pin 5: VOUT
  • Function: Analog output pin
  • Description: This pin outputs the analog voltage signal generated by the DAC.
  • Connection: Connect to an analog input pin of your microcontroller or an external device that requires an analog input signal.
  • Pin 6: A0 (Address Select)
  • Function: I2C address select pin
  • Description: This pin is used to select one of four possible I2C addresses for the module.
  • Connection: Connect to a digital output pin of your microcontroller or a voltage source to select the desired I2C address. The possible addresses are:
  • + A0 = 0 (GND): 0x60
  • + A0 = 1 (VCC): 0x61
  • + A0 = SCL: 0x62
  • + A0 = SDA: 0x63
  • I2C Address Selection
  • To select the I2C address, connect the A0 pin to:
  • GND (0V) for address 0x60
  • VCC (5V) for address 0x61
  • SCL pin for address 0x62
  • SDA pin for address 0x63
  • Important Notes
  • The module operates on a 3.3V or 5V power supply.
  • The I2C bus should be pulled up to the power supply voltage using pull-up resistors (typically 2k2 ohms).
  • The module can be used with 3.3V or 5V microcontrollers, but ensure the I2C bus voltage is compatible with the microcontroller's I2C pins.
  • By following these pin descriptions and connection guidelines, you can successfully integrate the MCP4725 I2C DAC Breakout Module into your IoT project.

Code Examples

MCP4725 I2C DAC Breakout Module Documentation
Overview
The MCP4725 I2C DAC Breakout Module is a digital-to-analog converter (DAC) that allows microcontrollers to generate analog voltage outputs. This module is based on the MCP4725 chip from Microchip, which features a 12-bit resolution and an I2C interface for communication.
Pinout
The module has the following pins:
VCC: Power supply (typical 3.3V or 5V)
 GND: Ground
 SCL: I2C clock pin
 SDA: I2C data pin
 VOUT: Analog output voltage pin
Operating Modes
The MCP4725 has two operating modes:
Normal Mode: In this mode, the DAC outputs a continuous analog voltage based on the 12-bit digital input.
 Shutdown Mode: In this mode, the DAC output is disconnected, and the module consumes minimal power.
I2C Communication
The module uses the I2C protocol for communication. The default I2C address is 0x60, but it can be changed using the A0, A1, and A2 pins.
Example Code
Here are three example code demonstrations for using the MCP4725 I2C DAC Breakout Module:
### Example 1: Basic Analog Output using Arduino
In this example, we will generate a 2.5V analog output voltage using an Arduino board.
```cpp
#include <Wire.h>
const int dacAddress = 0x60;
void setup() {
  Wire.begin();
}
void loop() {
  // Set the DAC output voltage to 2.5V (mid-scale)
  uint16_t outputValue = 2048; // 2.5V / 5V  4096
  Wire.beginTransmission(dacAddress);
  Wire.write((outputValue >> 4) & 0xFF); // high byte
  Wire.write(outputValue & 0x0F); // low byte
  Wire.endTransmission();
  delay(100);
}
```
### Example 2: Generating a Sine Wave using Raspberry Pi (Python)
In this example, we will generate a sine wave with a frequency of 1kHz using a Raspberry Pi.
```python
import time
import math
import smbus
bus = smbus.SMBus(1)  # Use I2C bus 1
dac_address = 0x60
def set_dac_voltage(voltage):
    output_value = int(voltage / 5.0  4096)
    bus.write_i2c_block_data(dac_address, 0x40, [(output_value >> 4) & 0xFF, output_value & 0x0F])
frequency = 1000  # Hz
amplitude = 3.0  # V
offset = 2.5  # V
while True:
    for i in range(360):
        voltage = amplitude  math.sin(math.radians(i)) + offset
        set_dac_voltage(voltage)
        time.sleep(1 / frequency)
```
### Example 3: Power-On Reset using ESP32 (C)
In this example, we will demonstrate the power-on reset feature of the MCP4725 using an ESP32 board.
```c
#include <I2C.h>
#define DAC_ADDRESS 0x60
void setup() {
  i2c_init();
  i2c_set_frequency(400000);
// Power-on reset: set DAC output to 0V
  uint16_t outputValue = 0;
  i2c_write_word(DAC_ADDRESS, 0x40, outputValue);
}
void loop() {
  // Do nothing
}
```
These examples demonstrate the basic usage of the MCP4725 I2C DAC Breakout Module in various contexts. You can modify and extend these examples to suit your specific application requirements.