Stufin
Home Quick Cart Profile

PCF8591 ADC-DAC Converter Module

Buy Now

Supply Voltage

2.5V to 6V

Operating Temperature

-40C to 85C

ADC Resolution

8-bit

ADC Channels

4

DAC Resolution

8-bit

DAC Channels

1

Communication Interface

I2C

Conversion Rate

Up to 200 kHz

Power Consumption

1.5 mA (typical)

Pinout

The PCF8591 ADC-DAC Converter Module has the following pinout

VCC

Supply voltage (2.5V to 6V)

GND

Ground

SCL

I2C clock signal

SDA

I2C data signal

AIN0-AIN3Analog input channels 0-3

VOUT

Analog output signal

Conclusion

The PCF8591 ADC-DAC Converter Module is a versatile and reliable component for various applications in IoT, robotics, and automation. Its compact design, low power consumption, and high accuracy make it an ideal choice for projects requiring analog-to-digital and digital-to-analog conversion.

Pin Configuration

  • PCF8591 ADC-DAC Converter Module Pinout Explanation
  • The PCF8591 ADC-DAC Converter Module is a versatile device that combines an analog-to-digital converter (ADC) and a digital-to-analog converter (DAC) in a single package. It features 8-bit resolution for both ADC and DAC conversions. Here's a detailed explanation of each pin:
  • 1. VCC (Pin 1)
  • Function: Power Supply Pin
  • Description: Connect the power supply voltage (typically 5V) to this pin.
  • Connection: Connect to a 5V power source or a battery.
  • 2. GND (Pin 2)
  • Function: Ground Pin
  • Description: Connect the ground reference point to this pin.
  • Connection: Connect to a common ground point or the negative terminal of a battery.
  • 3. SCL (Pin 3)
  • Function: I2C Clock Pin
  • Description: This pin is used for the I2C clock signal.
  • Connection: Connect to the I2C clock pin (SCL) of a microcontroller or another I2C device.
  • 4. SDA (Pin 4)
  • Function: I2C Data Pin
  • Description: This pin is used for the I2C data signal.
  • Connection: Connect to the I2C data pin (SDA) of a microcontroller or another I2C device.
  • 5. AIN0 (Pin 5)
  • Function: Analog Input 0 Pin
  • Description: This pin is one of the four analog input channels for the ADC.
  • Connection: Connect to an analog signal source, such as a sensor or a potentiometer.
  • 6. AIN1 (Pin 6)
  • Function: Analog Input 1 Pin
  • Description: This pin is another analog input channel for the ADC.
  • Connection: Connect to an analog signal source, such as a sensor or a potentiometer.
  • 7. AIN2 (Pin 7)
  • Function: Analog Input 2 Pin
  • Description: This pin is another analog input channel for the ADC.
  • Connection: Connect to an analog signal source, such as a sensor or a potentiometer.
  • 8. AIN3 (Pin 8)
  • Function: Analog Input 3 Pin
  • Description: This pin is another analog input channel for the ADC.
  • Connection: Connect to an analog signal source, such as a sensor or a potentiometer.
  • 9. VREF (Pin 9)
  • Function: Reference Voltage Pin
  • Description: This pin sets the reference voltage for the ADC and DAC conversions.
  • Connection: Connect to a stable voltage reference source, typically 2.5V or 5V.
  • 10. DAC_OUT (Pin 10)
  • Function: Digital-to-Analog Converter Output Pin
  • Description: This pin provides the analog output signal from the DAC.
  • Connection: Connect to an external circuit or device that requires an analog signal.
  • 11. ADDR (Pin 11)
  • Function: Address Pin
  • Description: This pin is used to set the I2C address of the module.
  • Connection: Connect to VCC or GND to set the I2C address. Typically, connect to GND for the default I2C address.
  • 12. OSC (Pin 12)
  • Function: Oscillator Pin
  • Description: This pin is used for the internal oscillator circuit.
  • Connection: Leave unconnected, as the oscillator is already integrated into the module.
  • When connecting the pins, follow these steps:
  • 1. Connect VCC to a 5V power source or a battery.
  • 2. Connect GND to a common ground point or the negative terminal of a battery.
  • 3. Connect SCL and SDA to the I2C pins of a microcontroller or another I2C device.
  • 4. Connect the analog input channels (AIN0 to AIN3) to the desired analog signal sources.
  • 5. Connect VREF to a stable voltage reference source.
  • 6. Connect DAC_OUT to an external circuit or device that requires an analog signal.
  • 7. Connect ADDR to GND or VCC to set the I2C address (optional).
  • 8. Leave OSC unconnected.
  • Remember to consult the datasheet and relevant documentation for specific connection requirements and programming details for your microcontroller or development board.

Code Examples

PCF8591 ADC-DAC Converter Module Documentation
Overview
The PCF8591 ADC-DAC Converter Module is a compact, low-power module that integrates an 8-bit analog-to-digital converter (ADC) and an 8-bit digital-to-analog converter (DAC) on a single chip. This module is ideal for applications requiring analog-to-digital and digital-to-analog conversions, such as in IoT projects, robotics, and industrial automation.
Features
8-bit ADC with 256 levels of resolution
 8-bit DAC with 256 levels of resolution
 Four analog input channels for ADC
 One analog output channel for DAC
 I2C interface for communication with microcontrollers
 Operating voltage: 2.5V to 6V
 Low power consumption
Technical Specifications
ADC Conversion Time: 100 s
 DAC Settling Time: 20 s
 I2C Clock Frequency: 100 kHz to 400 kHz
Code Examples
### Example 1: Reading Analog Values using ADC (Arduino)
In this example, we will use the PCF8591 module to read analog values from a potentiometer connected to one of the ADC channels.
```c++
#include <Wire.h>
#define PCF8591_ADDRESS 0x48 // Default I2C address of PCF8591
void setup() {
  Wire.begin(); // Initialize I2C interface
  Serial.begin(9600); // Initialize serial communication
}
void loop() {
  int adcValue = readADC(0); // Read analog value from channel 0
  Serial.print("Analog Value: ");
  Serial.println(adcValue);
  delay(100);
}
int readADC(int channel) {
  Wire.beginTransmission(PCF8591_ADDRESS);
  Wire.write(0x04 | (channel << 2)); // Select ADC channel
  Wire.endTransmission();
  Wire.requestFrom(PCF8591_ADDRESS, 1);
  int adcValue = Wire.read();
  return adcValue;
}
```
### Example 2: Generating Analog Signal using DAC (Raspberry Pi with Python)
In this example, we will use the PCF8591 module to generate an analog signal using the DAC output channel.
```python
import smbus
import time
bus = smbus.SMBus(1) # Initialize I2C bus on Raspberry Pi
pcf8591_address = 0x48 # Default I2C address of PCF8591
def writeDAC(value):
  bus.write_byte(pcf8591_address, 0x40 | (value & 0x0F)) # Set DAC output value
while True:
  for i in range(0, 256): # Generate analog signal from 0 to 5V
    writeDAC(i)
    time.sleep(0.01)
```
### Example 3: Analog-to-Digital and Digital-to-Analog Conversion (ESP32 with MicroPython)
In this example, we will use the PCF8591 module to perform analog-to-digital and digital-to-analog conversions.
```python
import i2c
pcf8591_address = 0x48 # Default I2C address of PCF8591
i2c.init(I2CNum.I2C_NUM_0, freq=400000) # Initialize I2C interface on ESP32
def readADC(channel):
  i2c.start()
  i2c.writeto(pcf8591_address, bytearray([0x04 | (channel << 2)]))
  i2c.stop()
  i2c.start()
  i2c.writeto(pcf8591_address, bytearray([0x00]))
  adc_value = i2c.readfrom(pcf8591_address, 1)[0]
  i2c.stop()
  return adc_value
def writeDAC(value):
  i2c.start()
  i2c.writeto(pcf8591_address, bytearray([0x40 | (value & 0x0F)]))
  i2c.stop()
while True:
  adc_value = readADC(0) # Read analog value from channel 0
  print("Analog Value:", adc_value)
  writeDAC(adc_value) # Output analog signal using DAC
  time.sleep(0.1)
```
These code examples demonstrate how to use the PCF8591 ADC-DAC Converter Module in various contexts, including reading analog values, generating analog signals, and performing analog-to-digital and digital-to-analog conversions.