The PCF8574T IO Expansion Board by HiLetgo is an I2C-based I/O port expander that provides 8 additional digital input/output pins for microcontrollers. It is designed to simplify projects requiring more GPIO pins than are available on the main microcontroller. By utilizing the I2C communication protocol, the PCF8574T allows multiple devices to share the same bus, reducing wiring complexity.
The following are the key technical details of the PCF8574T IO Expansion Board:
Parameter | Value |
---|---|
Operating Voltage | 2.5V to 6V |
Communication Protocol | I2C (Inter-Integrated Circuit) |
I2C Address Range | 0x20 to 0x27 (configurable via address pins) |
Number of I/O Pins | 8 (P0 to P7) |
Maximum Sink Current | 25mA per pin |
Maximum Source Current | 300µA per pin |
Operating Temperature | -40°C to +85°C |
The PCF8574T has 16 pins, as described in the table below:
Pin | Name | Description |
---|---|---|
1 | A0 | I2C address selection bit 0 (connect to GND or VCC to set address) |
2 | A1 | I2C address selection bit 1 (connect to GND or VCC to set address) |
3 | A2 | I2C address selection bit 2 (connect to GND or VCC to set address) |
4 | GND | Ground (0V reference) |
5 | SDA | I2C data line (connect to microcontroller SDA pin) |
6 | SCL | I2C clock line (connect to microcontroller SCL pin) |
7 | INT | Interrupt output (active low, optional for detecting pin state changes) |
8 | VCC | Power supply (2.5V to 6V) |
9-16 | P0 to P7 | General-purpose I/O pins (can be configured as input or output) |
Connect Power and Ground:
VCC
pin to the power supply (e.g., 5V for Arduino).GND
pin to the ground of the microcontroller.Set the I2C Address:
A0
, A1
, and A2
pins to configure the I2C address.GND
(logic 0) or VCC
(logic 1), allowing up to 8 unique addresses (0x20 to 0x27).Connect I2C Lines:
SDA
pin to the microcontroller's SDA pin.SCL
pin to the microcontroller's SCL pin.Connect I/O Devices:
P0
to P7
pins.INT
pin if you need to detect changes on input pins without continuously polling.Below is an example of how to use the PCF8574T with an Arduino UNO to control LEDs and read button inputs:
#include <Wire.h> // Include the Wire library for I2C communication
#define PCF8574_ADDRESS 0x20 // Default I2C address of the PCF8574T
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Start serial communication for debugging
// Set all pins on the PCF8574T as outputs (write HIGH to turn off LEDs)
Wire.beginTransmission(PCF8574_ADDRESS);
Wire.write(0xFF); // All pins HIGH (default state for outputs)
Wire.endTransmission();
}
void loop() {
// Example: Toggle an LED connected to P0 every second
Wire.beginTransmission(PCF8574_ADDRESS);
Wire.write(0xFE); // Set P0 LOW (turn on LED), others HIGH
Wire.endTransmission();
delay(1000);
Wire.beginTransmission(PCF8574_ADDRESS);
Wire.write(0xFF); // Set all pins HIGH (turn off LED)
Wire.endTransmission();
delay(1000);
}
0x20
with the actual I2C address if you have modified the address pins.Wire.requestFrom()
and process the returned byte.I2C Communication Not Working:
A0
, A1
, and A2
pins.Pins Not Responding:
P0
to P7
pins.Interrupt Pin Not Triggering:
INT
pin is connected to a digital input pin on the microcontroller.Q: Can I connect multiple PCF8574T boards to the same I2C bus?
A: Yes, you can connect up to 8 boards by configuring unique I2C addresses using the A0
, A1
, and A2
pins.
Q: What is the maximum cable length for I2C communication?
A: The maximum length depends on the pull-up resistor values and the speed of communication, but typically it is recommended to keep the length under 1 meter for reliable operation.
Q: Can the PCF8574T handle analog signals?
A: No, the PCF8574T is designed for digital input/output only. Use an ADC (Analog-to-Digital Converter) for analog signals.
Q: How do I know if the PCF8574T is working?
A: Use an I2C scanner sketch to detect the device on the bus. If detected, the PCF8574T is functioning correctly.