The PCF8574 IO Expansion Board is a versatile module that utilizes the PCF8574T I²C I/O expander chip to increase the number of digital input/output (I/O) pins available to a microcontroller, such as an Arduino or Raspberry Pi. This expansion is particularly useful when the number of built-in I/O pins is insufficient for a given project. The board operates over the I²C bus, allowing multiple devices to be connected to the same bus with only two wires, thus saving valuable pin resources.
Pin Number | Pin Name | Description |
---|---|---|
1 | P0 | I/O pin 0 |
2 | P1 | I/O pin 1 |
3 | P2 | I/O pin 2 |
4 | P3 | I/O pin 3 |
5 | P4 | I/O pin 4 |
6 | P5 | I/O pin 5 |
7 | P6 | I/O pin 6 |
8 | P7 | I/O pin 7 |
9 | VSS | Ground |
10 | VDD | Power supply (2.5V to 6V) |
11 | SDA | I²C Data line |
12 | SCL | I²C Clock line |
13-16 | A0-A2 | Address pins to set I²C address |
#include <Wire.h>
// Define the I2C address for the PCF8574 board
#define PCF8574_ADDRESS 0x20
void setup() {
Wire.begin(); // Initialize I2C protocol
pinMode(PCF8574_ADDRESS, OUTPUT); // Set all pins of PCF8574 as output
}
void loop() {
// Turn on all the outputs
Wire.beginTransmission(PCF8574_ADDRESS);
Wire.write(0xFF); // Write 0xFF to turn on all pins
Wire.endTransmission();
delay(1000);
// Turn off all the outputs
Wire.beginTransmission(PCF8574_ADDRESS);
Wire.write(0x00); // Write 0x00 to turn off all pins
Wire.endTransmission();
delay(1000);
}
Q: Can I use this board with a 3.3V system? A: Yes, the PCF8574 is 5V tolerant on the I²C bus, but ensure that VDD is within the 2.5V to 6V range.
Q: How many PCF8574 boards can I connect to a single I²C bus? A: You can connect up to 8 PCF8574 boards to a single I²C bus by setting unique addresses using the A0-A2 pins.
Q: Can I use this board for analog signals? A: No, the PCF8574 provides digital I/O expansion only. It cannot be used for analog signals.