Rewiring problem

Hello,

I am building a little module for Arduino with RFID reader a button and a led. All these components require 9 wires to connect:

1 SPI SS
2 SPI SCK
3 SPI MOSI
4 SPI MISO
5 Reset
6 Button Digital Pin
7 Led Digital Pin
8 GND
9 V3.3

I was wondering if it is possible to reduce this by one wire somehow so i could use CAT5 cable and connectors. Also i will have 4 modules working in parallel and i am using GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522 library for connecting multiple RFID chips in parallel.

Use shielded cat 5 with shield for Gnd?

Weedpharma

Doe you really need the chip select? If it's the only device you can just pull it high.

And reset, reset of what?

And if you don't mind the led turning on when you push the button you can put them on one line. The led+ resistor between the pin and Vcc and the button between the pin and GND.
Led on => output low
Led off => input pullup
Read button => input pullup, read, back to led mode

If you do mind the button turning on the led you can add a resistor in series with the switch and output high when you turn off the led. Now you only turn on the led very briefly when you read the button and the button is pushed (but that can be shorter then you can notice).

Ow, and I don't know the length of the cable but that can really matter a lot. Long cables are prone to interference so fast clock and high impedances are not a good idea.

I would not expect to get SPI data more than a metre down a twisted pair cable. It's just completely the wrong kind of cable for that. Can you use an RS232 interface? TTL serial might work but probably not.

What is going on the remote end of this cable? Is it an Arduino-based module you programmed yourself? Then have it send all the data via serial and don't have separate wires for buttons and LEDs. Buy a bunch of Arduino Minis off eBay - they are really cheap.

Then use serial transcievers designed for twisted pair. RS485 modules can be used - get one with an output and and input and connect it to the normal TX and RX pins as if it was normal serial. One pair of wires in the long cable is TX, another RX, one pair carries power and you've got one pair left over.

If you terminal the twisted pair you'll get a lot further... The Arduino pins can drive +/- 25mA or so,
so using a termination network like this:

GND - 220ohm - SCLK - 220ohm - Vcc

At the receiving board, and you'll have 110 ohm terminated twisted pair (partner SCLK with GND), and good
for 10's/100's of metres at full bandwidth (The ATmega's can go to 8MHz which isn't exactly taxing CAT5)

Of course having done that for SPI you've taken up your entire CAT5 already, and you have to worry
about whether the board can drive MISO that hard (25mA) itself.

So back to the real problem: 10 way IDC ribbon?

I'd like to try your suggestion Mark. I'm not sure that it's going to work properly. Sending an unbalanced signal over twisted pair is going to have all sorts of undesirable coupling, both inductive and capacative.

Taking your example of SCLK paired with GND, what happens at the transition when SCLK goes from HIGH to LOW? It's tightly twinned with ground as a capacitor, so it's going to drive the far end of GND below true ground. It's not tightly coupled to Vcc, so that stays about the same. There's probably a big capacitor holding Vcc and GND so this feeds back to SCLK and stops it getting near ground until it's discharged the capacitor formed by the twisted pair. And then there's the current now flowing in the Vcc wire which is going to disturb the signal paired with it.

I could be wrong. I haven't worked out what the magnetic component will do. It may oppose the undesirable electric component and actually work properly.

Indeed, its not ideal, but its better than not having termination.