4.5K
This 16-bit I/O expander for the two-line bidirectional bus (I2C) is designed for 2.5-V to 5.5-V VCC operation.
The PCF8575 device provides general-purpose remote I/O expansion for most microcontroller families by way of the I2C interface [serial clock (SCL), serial data (SDA)].
The device features a 16-bit quasi-bidirectional input/output (I/O) port (P07–P00, P17–P10), including latched outputs with high-current drive capability for directly driving LEDs.
Each quasi-bidirectional I/O can be used as an input or output without the use of a data-direction control signal. At power on, the I/Os are high. In this mode, only a current source to VCC is active.
Features
- I2C to Parallel-Port Expander
- Open-Drain Interrupt Output
- Low Standby-Current Consumption of 10 µA Max
- Compatible With Most Microcontrollers
- 400-kHz Fast I2C Bus
- Address by Three Hardware Address Pins for Use of up to Eight Devices
- Latched Outputs With High-Current Drive Capability for Directly Driving LEDs
Connection
This example shows only one LED
Parts List
Name | Link | |
ESP32 | ||
PCF8575 | ||
Connecting cables |
Code example
Output – switch LED on and off
#include <Wire.h> // Set I2C address int address = 0x20; void setup() { Wire.begin(); // Set all ports as output pf575_write(word(B11111111,B11111111)); } void loop() { // Set port P0 on pf575_write(word(B00000000,B00000001)); delay(1000); // Set port P0 off pf575_write(word(B00000000,B00000000)); delay(1000); } // Function for writing two Bytes to the I2C expander device void pf575_write(uint16_t data) { Wire.beginTransmission(address); Wire.write(lowByte(data)); Wire.write(highByte(data)); Wire.endTransmission(); }