I am looking for the best way to expand the digital I/O pins of an Arduino Uno so that I can read data from a few digital sensors (2x TCS3200 color sensor, 1x HC-SR04 ultrasonic sensor). It seems like one of the easiest ways to do this is through an I2C port expander such as the PCF8575. However, the TCS3200 doesn't seem to be I2C compatible.
Can I use an I2C port expander for regular, non-I2C digital sensors, or do all the devices attached to the chip need to be I2C as well? I haven't been able to find any specific documentation on this.
If any of the devices had an I2C interface, you would connect it to the I2C bus and not need to connect it to the port expander.
If they all had an I2C interface, you would clearly not even need the PCF8575.
You see, I2C is a bus - term derived from "busbar" - one set of connections to which many devices all connect in parallel and share access (equitably).
The purpose of the port expander on the other hand, is to provide separate connections for each individual device.
You don't need the devices you hang off an I2C expansion port to be themselves I2C devices.
You do however you need to make sure that they are a digital devices.
The However, the TCS3200 doesn't seem to be I2C compatible.
The TCS3200 is a digital device but it's output is a square wave of a specific frequency. And you can't measure frequency with a port expander due to the delay in reading the signal.
From the datasheet..
"Output enable (OE) places the output in the high-impedance state
for multiple-unit sharing of a microcontroller input line".
Leo..
Grumpy_Mike:
You don't need the devices you hang off an I2C expansion port to be themselves I2C devices.
You do however you need to make sure that they are a digital devices. The TCS3200 is a digital device but it's output is a square wave of a specific frequency. And you can't measure frequency with a port expander due to the delay in reading the signal.
Exactly the answer I was looking for, thanks! Will definitely have to take this into consideration.