Long Distance SPI

From Electriki
Revision as of 20:10, 23 May 2011 by Domen (talk | contribs) (temp save so firefox crash doesn't make me lose the data)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
File:Long spi schematic.jpg
Schematic for the project
TMP124 and RS422 transceiver
signals travelled through this cable
SCK when it comes back to 3.3V levels, perfect

The problem

I wanted to have a temperature sensor on 20m of cable (powered through the same cable too), and, well... that's around the limit for RS232. Ethernet could do it, but then you need a smart sensor. Or RS4xx could also do it, but uart sensors are not really common, and I wanted to avoid extra MCU on sensor side. Direct I2C or SPI was just out of the question. Those busses usually work in <1m range.

Philips makes I2C extenders, so that would be a possibility, except they're quite expensive.

As far as I read, the RS422/RS485 transceivers don't actually do anything else than to transform "normal" signals to differential, so the idea poped to mind, "why not just use RS422 transceivers to handle long distance SPI?".

Solution

I decided to test this idea. I picked TMP124 SPI temperature sensor, because I had it here, and it only needs SCK and MISO for communication.

The RS422 transceiver was sn65hvd30, from TI, because they sent free samples, fast. :-)

Slave select line didn't have any special handling, only a small capacitor against ground to make it nicer (it had <0.5V of noise before that, so it should work anyways).

I put a huge 100uF capacitor on power lines, since otherwise the chips sucked enough power for Vcc to drop below 2V for a bit, and tmp124 didn't really agree to those conditions.