PCF8591 I²C ADC + DAC Lab

Add four analog inputs and one analog output to any MCU over a two-wire bus with one tiny NXP chip.

Difficulty: Through-hole. Estimated build time: about 35 minutes. Estimated parts cost: about US$4.00. 5-line bill of materials. Compare supplier offers when available. An I²C analog-conversion peripheral built from the NXP PCF8591, an 8-bit chip that gives any MCU four single-ended ADC inputs and one DAC output in a single SOIC-16 package.

Wire I²C and tie the address pins

V_DD = 5 V (or 3.3 V — the chip is happy from 2.5 V to 6 V). GND to GND. SDA to A4, SCL to A5, both with 10 kΩ pull-ups. Tie A0, A1, A2 (pins 5, 6, 7) all to GND so the chip sits at I²C address 0x48 (the default). Vref (pin 14) goes to V_DD for a 0–5 V conversion range. Agnd (pin 13) goes to GND.

Connect four analog inputs

Pin 1 (AIN0) → wiper of a 10 kΩ potentiometer wired across V_DD/GND. Pin 2 (AIN1) → the junction of an LDR and a 10 kΩ resistor between V_DD and GND. Pin 3 (AIN2) → an NTC thermistor in a similar divider. Pin 4 (AIN3) → floating for now.

Read all four channels

I²C transaction: write address byte 0x48, then control byte 0x04 (auto-increment, channel 0). Then a read of 5 bytes (the first is dummy, the next four are AIN0..AIN3). Print all four to the serial monitor. Rotate the pot — channel 0 swings. Cover the LDR — channel 1 climbs.

Generate a DAC sine wave

Write control byte 0x40 (DAC output enable). Send a single byte 0–255 in a loop, stepping through a sine lookup table. Output appears on pin 15 (AOUT) as a stepped staircase — add an RC low-pass (10 kΩ + 100 nF) and a small audio amp and you have a 100 Hz sine wave generator. Useful for testing op-amps and filters without a function generator.