Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: emil151997 on Mar 15, 2019, 03:52 pm

Title: Reading PCF8575C Expander Inputs
Post by: emil151997 on Mar 15, 2019, 03:52 pm
Hello, dear Arduino community. I have bought the pcf8575c to expand arduino uno pins. The pins works great, when i use them in output mode. But when i'am trying to read inputs, i always get '0' value. Can you please help me ? I tried so many libraries from github, but without results.

In attacment:
A photo of expander
Values, reading by pcf8575c from Sr-501 motion sensor
Values, reading by arduino UNO from Sr-501 motion sensor
A code of simple project, where i am trying to read inputs from SR501 motion sensor. (The library in project is PCF8575 by phisman from github)




Code: [Select]

#include <Wire.h>
#include <PCF8575.h>
PCF8575 expander;
void setup()
void loop()

Title: Re: Reading PCF8575C Expander Inputs
Post by: Paul__B on Mar 15, 2019, 11:21 pm
Title: Re: Reading PCF8575C Expander Inputs
Post by: Geek Emeritus on Mar 16, 2019, 12:14 am
from the datasheet:
It also possesses an interrupt line (INT) which can be connected to the interrupt logic of the microcontroller. By sending an interrupt signal on this line, the remote I/O can inform the microcontroller if there is incoming data on its ports without having to communicate via the I2C-bus.
see this: Using-The-PCF8575-i2c-io-Expander-To-Read-Inputs (
Title: Re: Reading PCF8575C Expander Inputs
Post by: Grumpy_Mike on Mar 16, 2019, 09:46 am
It is important to remember that the pins are only quasi-bidirectional I/O, not actually bidirectional I/O.

To use any pin as an input you first have to write a logic HIGH to it, and then read the pin. The pin will only read something different from a logic HIGH if you connect it to ground through a switch, or other logic level signal.

So it matters how you have connected your switches, it needs to be from input to ground.

I have never used a libiary to control something as simple as this chip so I can't comment on how to get your libiary to do this.