Sketch and connecting to 16 port PCF8575 expander

I'm about to shoot myself. Can anyone show me how to connect and communicate to a PCF8575 with a switch matrix. I've been trying to find an example of how to do this but so far with no success.

Thanks for any help anyone can provide.

Mark

Can anyone show me how to connect and communicate to a PCF8575 with a switch matrix.

You can't connect the two together directly, their has to be an Arduino in between.

The PCF8575 is connected to the Arduino through the I2C bus. Wire - Arduino Reference.

The matrix is connected to the Arduino through normal I/O pins.

You read the key matrix and when you see a specific number yo send the PCF8575 the commands to set what ever output pin you want to set when you press that key.

Let me clarify. Forgive the crude drawing.

The expander is connected via I2C to the Arduino. The columns and rows of the matrix are connected to the 0:7 and 10:17 on the expander. I can read directly from the expander but I don't know how read from the matrix.

If anyone can give me some example code I'd appreciate it.

Regards

Mark

The expander has rows as outputs and columns as inputs ( or the other way round ). So you write to the rows so only one row is high and the others are low. Then you read the columns from the expander and each bit is one switch state.
Next change the rows so again one is at a high and the others low and repeat. Do this until all rows have been scanned.

It is just like an LED matrix but with one side an input.
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html

Note. If you do not have the input side pulled down but pulled up, then make the output side a walking zero instead of a walking one. The exact code depends on how the matrix is wired and the diagram does not show this in enough detail to tell how you have done this.

Thanks for the reply. Unfortunately this board seems to have a problem. I cannot set any address on the board so its stuck at 0x20. Tried all the options on the back, soldering to ground, but the address does not change.

Ordered a new expander based on SX1509 then I'll try again.

Regards

Mark

What board did you have? A link might give us a hint on what is wrong. Have you measured the voltage on the address pins? Do they change as a result of soldering links?

I'm using this board from Sparkfun.

SparkFun I2C Expander Breakout - PCF8575

SparkFun I2C Expander Breakout - PCF8575 - BOB-08130 - SparkFun Electronics.

Mark

OK so how have you soldered the links. You should connect the center pin to either the left or right connection with a blob of solder, not both. Each of the three links must be soldered, so not let any go unconnected.