I’ve been working on a small pet project to control my garage doors through my Arduino. This is my first step in a home automation project which will eventually be web based. Because this is going to be a distributed system to control things throughout the house I decided to use i2c as the platform. The chip I decided on for the remote locations was a PCF8574A. It’s called an I/O extender because it gives you 8 digital pins that can be used for input or output and since it hooks into I2C it only takes up the 2 analog pins on the Arduino. I was pretty excited about this and my mind filled with possibilities… then I got the chip.
I ran into several problems using the chip for this project:
1. It is only capable of sourcing .3 mA per pin which isn’t really enough to even power an LED. It can however sink up to 25ma per pin. This means designing the whole circuit in reverse as this forum post pointed out: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1173047782/5
2. If you want to use any of the pins as inputs they need to be set to on (HIGH), if they are off(low) then they will not read anything.
3. This chip is not only made by TI, the same chip is also made by NXP (Philips). One thing to note about the TI chip as opposed to the NXP version is that the TI lacks pull up resistors on each of the pins. Depending on how you use the chip this may cause issues. For me, this resulted in days of inconsistent behavior until I found this post: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1233786313/2
4. To properly control each individual pins on the PCF8574A I ended up spending hours coding a serial based menu with the bitwise math to back it up.
5. The relays I purchased for this project may require too much current to switch because I could only switch 1 relay at a time.
6. Other people didn’t need transistors to switch relays with this chip but I decided to try it anyway and still no luck.
At this point I looked down at the circuit I had built and it hit me that I had wandered into the all too common mistake of over engineering a solution. In this case I was trying to shoehorn this chip into my project regardless that several of these factors above should have tipped me off that this was not the right chip for the job.
So I went back to the drawing board and started looking for other I2C options. I found the Arduino-Tiny project that provides everything you need to run a modified version of the Arduino platform on ATtiny family of chips. And they have a library to make it addressable over I2C! Not only does this fit the need of switching the 2 relays but also opens up a lot of options for imbedding ATtiny chips in projects instead of a whole Arduino!