Easy Propeller I/O Expansion
T Chap
Posts: 4,223
Once in a while people are looking for more I/O, so I wanted to post this very easy solution that works great for many applcations. The device is the PCF8575 I2C 16 bit I/O expander. It can connect to the existing SDA and SCL lines(that are on the boot EEPROM), you can connect 8 IC's total on the bus, so you get 7*16 extra I/O if you are keeping the EEPROM on the bus as well, just give each IC their own address.
Using Mike's minimali2cdriver.spin, the example below shows how easy it is to set the pins to a desired state. Keep in mind the outputs are very low power and will not do any real work except for sinking, so pullups are required to source anything. The schematic shown allows connections for the I/O, plus I added the ULN2803 transistors for sinking larger devices like relays etc. The device can be used as inputs when the start byte includes the direction bit. If in input mode, the chip will output an Interrupt pulse back to the processor on any pin state change. I have used this in a few projects and it is a no-brainer, maybe somebody will get some use out of it.
Post Edited (originator) : 3/12/2007 5:15:34 AM GMT
Using Mike's minimali2cdriver.spin, the example below shows how easy it is to set the pins to a desired state. Keep in mind the outputs are very low power and will not do any real work except for sinking, so pullups are required to source anything. The schematic shown allows connections for the I/O, plus I added the ULN2803 transistors for sinking larger devices like relays etc. The device can be used as inputs when the start byte includes the direction bit. If in input mode, the chip will output an Interrupt pulse back to the processor on any pin state change. I have used this in a few projects and it is a no-brainer, maybe somebody will get some use out of it.
OBJ i2c : "minimali2cdriver" PUB SetSomePins i2cstart(25) 'start the transaction i2c.write(25, %0100_000_0 + 0) ' pin start(25), device type(0100), address(000), write mode(0) i2c.write(25, %10000000) 'first byte i2c.write(25, %10000000) 'second byte i2c.stop(25)
Post Edited (originator) : 3/12/2007 5:15:34 AM GMT
Comments
Also, by adding P82B715 buffer chips, you can extend the I2C lines up to 300 meters... which means you can have remote I/O at distant location!
and the article about them from the excellent Jon Williams - http://www.parallax.com/dl/docs/cols/nv/vol5/col/nv109.pdf
james
to use I2C or SPI IO-expanders. For the price of one expander chip,
you can get a complete microcontroller (with I2C, SPI and ADC).
Example:
PCF8574: 1,65
ATMeaga48: 1,50
(Prices in Euro, taken from a german catalog distributor)
Same situation for external ADC's. For the price of an external 10 bit ADC,
I can buy a microcontroller with 10 bit ADC.
Not that I'm too cheap to spend 2 dollars for a hobby project, but I'm
a professional developer and like it to have as much as possible in one
chip for a good price.
Not to mention the fact, that for a microcontroller, you need more components then just the microcontroller... and you need to arrange methods for inserting the firmware / and updates in case of bugs etc...
Post Edited (IWriteCode) : 3/9/2007 2:07:32 PM GMT
for the· PCF8574
Jim