Go Down

Topic: Reading PCF8575C Expander Inputs (Read 611 times) previous topic - next topic


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()



  • Diagram of how you have connected everything together.
  • Explanation of what you read when you manually connect the relevant expander pin to Vcc and then ground.

Geek Emeritus

Mar 16, 2019, 12:14 am Last Edit: Mar 16, 2019, 12:17 am by Geek Emeritus
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
All PMs will be deleted unopened due to arrogant argumentative pot stirring Malfoys.
 If you have not read "How to use this forum - please read", in particular: "7. If you are posting code or error messages, use "code" tags":  expect rude responses


Mar 16, 2019, 09:46 am Last Edit: Mar 16, 2019, 09:48 am by Grumpy_Mike
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.

Go Up