I2C or SPI ?

Hello,

For a project with a resistive touch screen, I am thinking about using an IC to be used as a controller between the touch panel and the Arduino (Uno).

There are similar ICs, some with I2C output and others with SPI (from TI for instance). Which protocol would you recommand ?

Thank you in advance.

I2C as it uses only 2 pins where SPI uses 3 and I2C allows you to connect up to 127 devices (in theory).

But more important , what dataspeed do you need / expect between the two?

robtillaart:
But more important , what dataspeed do you need / expect between the two?

The highest the Uno (and the serial transmission to the computer) could stand the better. I want to get 3 12-bits data from the controller (X position, Y position, pressure).

I have some timings here:

SPI is faster, but needs an extra wire or two.

Note that the Wii nunchuk uses I2C, so presumably it is fast enough for gaming.

There are cable run limits for I2C (and also SPI). However there was a post recently from someone that was able to get SPI to work over quite a long distance (60 meters?) using RS485 transmitter/receiver chips. Also there are I2C extender chips.

If you are writing to the screen (ie. updating the LCD) then the extra speed you get from SPI might give you faster updating. If you are just reading touches I doubt it will make a heap of difference.

I've used both with different chips and both bus methods can be made to work well. If a given chip is avalible in both I2C and SPI versions I would probably pick the SPI version, I just seem to get SPI devices working sooner then I2C, but that is mostly from my weaker software skills Vs hardware skills.

Lefty

I think I prefer SPI, but not sure why (perhaps because its a simpler interface?) - but you do need more wires. Its also faster and supports duplex which means nice and faster (useful for external RAM/ROM?)

Thanks a lot everyone !