
PCF8574 I/O Expander Library for Proteus Simulation

Hello friends, I hope you all are doing great. Today, I am going to share the new PCF8574 I/O Expander Library for Proteus Simulation. The PCF8574 is the simplest way to give an Arduino more pins: eight of them, over the same two I2C wires that already run your sensors. It has no registers and no configuration - one byte out sets the pins, one byte in reads them - and it is the chip on almost every "I2C LCD backpack". With this library you can run a full Proteus simulation of the PCF8574 board and see exactly what its unusual pins do.
PCF8574 I/O Expander Library for Proteus
Latest version: V1.0 (December 2026, this tutorial)
Helping Tools
- Serial Monitor Advance: a serial terminal window for the UART of your board
- Serial Monitor Expert: the serial monitor with extra debugging tools
- LCD Library for Proteus V3.0: 16x2, 20x4 and I2C LCDs to show your readings
The demo uses two boards on one bus: one drives four LEDs and reads a DIP switch, the other drives a 16x2 LCD in 4-bit mode - an I2C LCD backpack built by hand, so you can see how the ready-made ones work.
NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the LCD board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the PCF8574 I/O Expander Library for Proteus Simulation:
What Is the PCF8574 I/O Expander?
An 8-bit I/O port on I2C. The chip has eight pins, P0 to P7, and nothing else to set up: there is no direction register, no pull-up register, no mode. Write one byte and the eight pins take its eight bits. Read one byte and you get the eight pins as they are. Three address pins give it eight addresses, 0x20 to 0x27, and its twin the PCF8574A sits at 0x38 to 0x3F, so sixteen of them can share one bus - 128 extra pins on two wires.
| PCF8574 | |
|---|---|
| Pins | 8, quasi-bidirectional (P0 - P7) |
| Address | 0x20 - 0x27 (PCF8574A: 0x38 - 0x3F) |
| Write | one byte: 0 = strong low, 1 = weak pull-up |
| Read | one byte: the pins as they are |
| Interrupt | INT low on an input change |
| Supply | 2.5 - 6 V |
| Pins (module) | VCC GND SDA SCL INT, P0 - P7 |
Quasi-Bidirectional Pins
The trick that makes the PCF8574 so simple is its pin design. A pin written 0 is pulled hard to ground: it can sink about 25 mA, plenty for an LED. A pin written 1 is not driven high at all - it gets only a weak pull-up of about 100 microamps. That weak high is an output that anything can override, and at the same time an input: a button or a switch to ground pulls it low, and a read shows the 0. So there is no "input mode": every pin you want to read, you simply write 1 first - and after power-on every pin is already 1.
LEDs: Sink, Do Not Source
The weak pull-up has one practical consequence that catches beginners: a PCF8574 pin cannot light an LED from the pin to ground, because 100 microamps is far too little. Wire the LED the other way: from VCC through a resistor to the pin, and write 0 to light it. The demo does exactly that, so the LEDs are "active low" - a 0 bit means on.
INT: Knowing Without Polling
The INT pin goes low when a pin used as an input changes against the value of the last read or write. The microcontroller can wait for that instead of reading the port again and again; one read (or write) releases INT. It is open drain, so several PCF8574 boards can share one interrupt line with one pull-up.
Features of the PCF8574 I/O Expander Library for Proteus Simulation
- A real-looking board: the 46 x 21 mm board at its real size, with address jumpers that follow the ADDRESS property and the PWR LED.
- Real pins: strong low and weak high, changing at each byte's ACK; inputs pulled low by the circuit read 0.
- INT: on an input change, released by the next read or write.
- PCF8574 and PCF8574A: both address ranges with the VERSION property.
- A pop-up: the eight pins with what was written, the level and the role of each, the last transfers - graphs, an event log and a check page.
- A complete package: about 2.5 MB with the library, our LEDs, resistors, DIP switch and LCD, our Arduino UNO V4.0 and the demo, without the source code of the model.
The PCF8574 in Proteus
The device is IOEXPPCF8574TEP in TEPPCF8574.LIB, under Modules > Interface, with the prefix U and the model TEPPCF8574.DLL. Search PCF8574 or expander in Pick Devices. On the left are VCC, GND, SDA, SCL and INT; on the right P0 to P7. Two properties: ADDRESS (0 to 7) and VERSION (PCF8574 or PCF8574A).
Download PCF8574 I/O Expander Library for Proteus Simulation
Click the button below to download PCF8574-IO-Expander-Library-for-Proteus-v1.0.zip (about 2.5 MB, without the source code of the models):
PCF8574 I/O Expander Library for Proteus V1.0- README.txt: installation, the demo, the wiring, troubleshooting and the limits of the simulation.
- Proteus Library Files:
TEPPCF8574.LIB,TEPLED5MM.LIB,TEPRESISTOR.LIB,TEPDIP.LIB,TEPLCD16X2.LIBandArduinoV4TEP.LIB. - Proteus Model Files:
TEPPCF8574.DLL,TEPLED5MM.DLL,TEPRESISTOR.DLL,TEPDIP.DLL,TEPLCD.DLLandTEPARDUINO.DLL. - Arduino Code: the demo sketch (Wire only).
- Proteus Simulation: the demo project, its HEX file and copies of the DLLs.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install PCF8574 I/O Expander Library for Proteus Simulation
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Delete
TEPPCF8574.IDXfrom the LIBRARY folder if it is there. - Start Proteus, press P and search for PCF8574.
Proteus Simulation of Two PCF8574 Boards
The demo uses an A3 sheet with our Arduino UNO Library for Proteus V4.0 and two PCF8574 boards on A4 and A5. U1 at 0x20 sinks four red LEDs from our 5mm LED Library for Proteus on P0 to P3, each from +5V through 220 ohm, and reads a 4-way switch from our DIP Switch Library for Proteus on P4 to P7 - switches 1 and 3 are ON; its INT goes to D2. U2 at 0x27 - all three address jumpers set - is wired like an I2C LCD backpack to a 16x2 LCD from our LCD Library for Proteus V3.0: P0 to RS, P1 to RW, P2 to E and P4 to P7 to D4 to D7. The Arduino's monitor is built in, the same window as our TEP Serial Monitor Advance for Proteus. Open PCF8574-LEDs-Switches-LCD-ArduinoUnoV4.pdsprj.
The Sketch
The sketch needs only the Wire library, because the PCF8574 needs nothing more than one byte each way:
void pcfWrite(byte addr, byte v) { Wire.beginTransmission(addr); Wire.write(v); Wire.endTransmission(); }
byte pcfRead(byte addr) { Wire.requestFrom(addr, (byte)1); return Wire.available() ? Wire.read() : 0xFF; }
Every 250 ms it writes the count to U1 - the LED bits inverted, because a 0 lights an LED, and the switch bits left at 1 so they stay inputs - then reads U1 back for the switches:
pcfWrite(IO, 0xF0 | (~count & 0x0F)); // P0 - P3: a 0 lights the LED; P4 - P7 stay 1 (inputs)
const byte sw = (~pcfRead(IO) >> 4) & 0x0F; // P4 - P7: ON pulls the pin LOW
The LCD needs a little more. In 4-bit mode each character goes as two nibbles on D4 to D7, and each nibble is latched by a pulse on E. Through the PCF8574 that is three port writes per nibble - the data, the data with E high, the data again with E low:
const byte v = (nib << 4) | mode | BL;
pcfWrite(LCD, v);
pcfWrite(LCD, v | EN);
pcfWrite(LCD, v); // E falls: the LCD takes the nibble
PCF8574 Simulation Results
Open the project and press Run. The demo runs 3.0 simulated seconds and took about 1 minute 46 seconds on our PC with the pop-up open and the pictures being taken. Click U1 for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships.
Power-On and the LCD
Both boards answer from the very first transfer. The sketch writes 0xFF to U1 at 0x20, so every pin starts as a weak-high input, and then reads the port once to learn the switches. The second board, U2 at 0x27, goes through the LCD's 4-bit start-up: three 0x3 nibbles, one 0x2, then the function set, display on, clear and entry mode, every nibble clocked by the E pin that U2 raises and drops. The monitor prints "LCD ready (4-bit through U2)" a fraction of a second after power-on, and the two lines appear on the display: "PCF8574 x2 I2C" on top and the live values underneath.
The LEDs Count
The count shows on the four LEDs of P0 to P3. Each LED runs from +5V through its 220 ohm resistor into a pin, so a 0 in the written byte lights it: the PCF8574 can sink a lot more current than its weak pull-up can source. At 0.59 s the latch held 0xFD and only D2 was lit; at 1.38 s the byte was 0xFA and D1 and D3 glowed, at 2.19 s 0xF6, and at 2.99 s 0xF3. The pop-up shows the same thing pin by pin: P0 to P3 marked as outputs that sink, P4 to P7 as inputs, each with the level it really has on the pin.
Reading the Switches
The upper nibble is the switch side. The sketch always writes 1s to P4 to P7, so those pins only have the weak pull-up on them, and a DIP switch that is ON pulls its pin to ground. In the demo, switches 1 and 3 are ON, so the pins read 0xA_ in the upper nibble: P4 and P6 low, P5 and P7 high. The pop-up marks P4 and P6 as "pulled low" in orange, the monitor prints "Switches 1-4: 1010", and the LCD shows "SW 1010". Nobody touched a switch during the run, so INT never fell: the INT card stays at "high, 0 times". Flip a switch while the simulation runs and INT drops at once and the next read shows the new state.
The LCD Through the Second Board
U2 never reads anything; it is a pure output port. Over the 3 simulated seconds it took 1,357 one-byte writes: each character on the display costs six of them (two nibbles, each written with E low, E high and E low again). That is why an I2C LCD is slower than a parallel one, and why it does not matter for a 16x2 display that only changes a few characters at a time. The bottom line updates with the count: "LED 0101" is the count, 5, in binary - exactly the LEDs that are lit, because the sketch writes the inverse (0xFA) to U1 - and "SW 1010" is the switches.
The Graphs, the Event Log and the Check Page
The Graphs page plots the byte written to U1, the pins as they are, INT and the transfers on the bus. The Event log shows the power-on and the first writes with their bits. The Check page sums up the run: Supply green at 5.00 V with the PCF8574 at 0x20, the port at 0xF3 written and 0xA3 on the pins, the host line with 13 writes and 12 reads and 0 NACKs, and INT high with no falls over the run. No other address answered and there was no bus error.
The Arduino's built-in serial monitor tells the same story in words: the two addresses, "LCD ready", "Switches 1-4: 1010" and then a line for each count, from "Count 1" with 0xFE written to U1 up to "Count 12" with 0xF3, one line every quarter of a second.
Inside an I2C LCD Backpack
Turn over almost any I2C 16x2 LCD and you find a small board with a PCF8574 (address 0x27) or a PCF8574A (0x3F), a contrast trimmer and a transistor for the backlight. It is wired exactly like U2: P0 to RS, P1 to RW, P2 to E, P3 to the backlight transistor and P4 to P7 to D4 to D7. Libraries such as LiquidCrystal_I2C do precisely what the demo's three short functions do. Once you have seen it work in the simulation, a backpack that "does nothing" is easy to debug: check the address first (0x27 or 0x3F), then the contrast.
PCF8574 or MCP23017?
The PCF8574 is the right choice when you need a handful of pins and want the simplest code possible. When you need sixteen pins, real push-pull outputs that can source current, configurable pull-ups, or interrupts that tell you which pin changed, its big brother the MCP23017 is the next step - it is the next library in this series.
Try It Yourself
- Click the DIP switches while the simulation runs: INT on D2 tells the sketch at once, and the LCD follows.
- Wire an LED from P0 to GND instead of from VCC to P0: it stays dark, because the pin cannot source current.
- Write 0x00 to U1 and read it back: the switch inputs read 0 whatever the switches do - an input must be written 1.
- Set U2's VERSION to PCF8574A and change LCD to 0x3F in the sketch: the other common backpack address.
- Add a third board at 0x21 with eight more LEDs: the same two wires.
Ideas to Extend the Demo
- A 4x4 keypad on one PCF8574: four rows written, four columns read.
- A 20x4 LCD on the same backpack wiring.
- A relay board driven from a PCF8574 for eight loads.
Your Own Sketches
The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.
Things to Know Before Using a Real PCF8574
- Current: a pin sinks about 25 mA but sources only about 100 uA - wire loads from VCC to the pin.
- Inputs: write 1 to every pin you read; after power-on all pins are 1.
- Pull-ups: the board has them on SDA and SCL; INT needs one too (INPUT_PULLUP works).
- Addresses: PCF8574 0x20 - 0x27, PCF8574A 0x38 - 0x3F - check which chip your board carries.
- Speed: 100 kHz; every port change is a whole I2C transaction, so it is not for fast signals.
Troubleshooting
- An LED stays dark: it is wired from the pin to GND - turn it around (VCC to the pin) and write 0.
- A switch always reads 0: a 0 was written to that pin - write 1 first.
- INT stays low: the sketch never reads or writes the port after the change.
- No answer: the address does not match ADDRESS / VERSION, or VCC is not powered.
- The part is not simulated:
TEPPCF8574.DLLis missing from MODELS and from the project folder.
Limitations of the Simulation
- The pins, the write and read at each ACK, INT and the two address ranges follow the PCF8574 datasheet; the board is our own drawing.
- Our own figure: a written 1 is a plain weak high (the real chip adds a short strong-high pulse on a 0 to 1 change).
- Not modelled: that pulse, the pin current limits, the 400 kHz timing limits.
- Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the chip's maker.
- Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.
So, that was all about the PCF8574 I/O Expander Library for Proteus Simulation. I hope it gives your projects the pins they were missing - and takes the mystery out of the little board behind your LCD. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!























Comments
0