Shop OBEX P1 Docs P2 Docs Learn Events
Wire length for synchronous serial? — Parallax Forums

Wire length for synchronous serial?

Professor ChaosProfessor Chaos Posts: 36
edited 2007-03-07 20:22 in BASIC Stamp
Does anyone know what a reasonable distance is for synchronous serial communication?

I am contemplating the following arrangement: a sensor module with several sensors feeds them into a 74HC165 shift register. The BS2 then reads the shift register. I am wondering how much distance can separate the BS2 board and the sensor module board before I run into problems.

Along the same line, is it a problem to supply the sensor module with +5 v using a power supply (like the BoE) some distance away?

Thanks

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-07 00:40
    For long distances, you can always use twisted-pair signalling, driven by RS422 transmitters. This would be good to hundreds of feet.

    For the power, regardless of the distance, I would recommend providing Vin over the cable and regulating it down to 5V at the module end. This will help, not only with I2R losses through the cable, but also with any noise that might be induced along the way.

    -Phil
  • Professor ChaosProfessor Chaos Posts: 36
    edited 2007-03-07 04:58
    The distances I am considering are not that great - perhaps 20 feet at the maximum.

    I'm not familiar with RS422 signaling, but isn't it quite a different beast than using serial, clock, and latch lines on a reigster?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-07 05:59
    RS422 is an electrical standard (voltages, rise and fall times, thresholds, etc.) You would use a twisted pair for each signal and a driver/receiver for each at the appropriate end of the connection. 20 feet is not that far. You would still need twisted pair. If the environment is electrically quiet, you should be fine. If it's noisy, consider using RS422 or RS232. The additional voltage helps with the noise. You won't be able to drive it as fast as if the distance were smaller. You might use Schmitt trigger buffers at the receiving end of each signal to also help with noise and to clean up the edges of the signals.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-07 06:07
    For only 20 feet, just use logic level signalling. On the transmit end, put a 220-ohm resistor in series with each output. This will help to protect the BASIC Stamp. At the receiving end, terminate each signal line with a 2.2K resistor to +5V and a 3.3K resistor to ground. This will guarantee that current flows in the cable for both logic states, thus reducing the chance for noise pickup. (This is very important, since one of the shift register inputs is edge-triggered.) It also biases the line slightly high, so it won't be sitting at the threshold point of the HC shift register inputs, should the Stamp outputs be floating.

    Coming back from the shift register is a little more complicated, since its output can't source or sink the kind of current the Stamp can. An open-collector transistor driver would work here, with a 3.3K pull-up resistor on the Stamp end. Just remember that your return signal will be inverted!

    While you may even get by with providing 5V over this distance, I'd still be more inclined to feed Vin instead and regulate it down at the other end to 5V. It requires nothing more than a cheap 79L05 78L05 regulator and a couple caps. If you choose to forgo even this, at least add a 22uF tantalum to the remote circuit between +5 and ground.

    Regarding the RS422 option: at the receiving end there would be receiver ICs that convert the differential (RS422) signals back to logic levels for your shift register chip. But this would be way overkill for a mere 20-foot run!

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 3/7/2007 6:24:32 PM GMT
  • Professor ChaosProfessor Chaos Posts: 36
    edited 2007-03-07 18:38
    Thanks for the suggestions! I'll put some together and see how they work.

    Clearly I am reaching the limits of my electronics understanding when we start talking about tying lines to both ground and power... I think I need to pick up a good book about such matters. Any recommendations?

    Thanks
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-07 19:48
    A very good one is The Art of Electronics, by Horowitz and Hill.

    -Phil
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-03-07 20:22
    You're not really "tying a line to ground and power". You're putting a resistor between the signal line and ground, and another resistor between the signal line and power. Yes, this does guarantee that some current will be flowing all the time -- but in this circumstance that's a good thing.

    Yes, if you tied to both power and ground with a wire, that would be a very bad thing. That's why you use a 2.2 K and 3.3 Kohm resistor.
Sign In or Register to comment.