How long a cable can one have between the uC and a sensor?


  • Hero Member

    I've begun thinking about a garage node which implements local logic to control the lights, while also acting as a sensor/actuator node. (By garage I mean my attached storage unit which would normally house cars if it weren't full of storage 🙂 )

    It would have one or two relays to control the AC lighting, multiple PIR motion sensors, magnetic reed switches for open and closed positions of the big garage door, maybe a magnetic reed switch at the door into the house, a general light level sensor, a button near the door, and possibly a light sensor at the garage door opener's automatic light (also temp and humidity while I'm at it, but those are simple). The reason for multiple PIR motion sensors is the tall shelving unit in the middle which divides the space into two aisles, so no one sensor can view the entire garage. I want the lights to operate with motion detection, but the off the shelf AC motion detector switches cannot see the various areas of the garage at once. And of course it would be a MySensors node.

    Since the node will need to control relays, assume it will be powered from AC, not battery operated.

    OK, the question is about connecting the distributed physical sensors to the node's uC through cabling. I have a spool of 6 conductor telephone wire, and I could always cut up an ethernet cable if I need twisted pairs. Consider the cables to need to be as much as 20' or so (to go up to the top of the roof, across, and back down - I hoist Christmas display stuff between the roof trusses).

    How far away can I place a PIR sensor, supplying power and receiving motion indication?

    How about the magnetic reed switches and the pushbutton?

    How about an analog light sensor, like a LDR?

    I know it's no simple answer besides "it depends"; I'm looking to understand what techniques I need to use and how far they are likely to work.

    The issues I would anticipate are resistance in power leads (PIR), inductance in the line, reflections in uncontrolled impedance digital signal lines, and antenna effects (RF or 60 Hz) in the cables. This would be a uC connected to a bunch of antennas, as well as being sensors operating from remote power, The goals would be reliable digital and analog signal conveyance from remote sensors to the uC, sufficient quality power to power sensors.

    For the switches (reed or pushbutton) I'm thinking that there's not much problem if I'm debouncing them anyway (ie: reading slowly), but that an external pullup (or pulldown?) resistor may be wise, perhaps with lower resistance than I normally use. Right? Or do I need some kind of cap(s) too?

    For the PIR sensors - I'm thinking the resistance won't be a problem given how little power they take, but it's a long distance for cmos logic to drive the detect signal. Still I'm thinking that given I don't need fast response, it might be OK (time to settle). Should I add caps at the uC or PIR end? Put a low-value resistor in-line with the signal wire to reduce reflections? Put a higher-value resistor between the signal line and ground, to reduce the impedance?

    For the analog LDR sensor in a voltage divider circuit with a resistor - maybe just a cap?

    For cable - with the phone cable be OK? Or do I need to cut up a UTP ethernet cable and use twisted pairs? (for the PIR: one or more pairs for power, one pair for the detection signal). Or buy some STP and connect the shield to ground at the uC end as well?

    I'm not sure which of the speculative techniques above would be appropriate, or how much distance they are likely to gain me. If I should be using caps or resistors to improve the situation, roughly what values (and what type of caps)?

    Does anyone here have practical experience with this to offer (or a better theoretic background in EE than I have)?


  • Admin

    I would probably make 2 or more nodes instead of running long cables arround the garrage.

    You will, as you mention, get long antennas, picking up noise. So inputs on the node should be propperly decoupled, and protected from surge spikes. This will probably make things more complicated, than to make 2 nodes extra.

    I am thinking about modifiying off the shelf PIR sensors for mains switcing, to use with mysensors, Have one or two of them in a pile somewhere (New units, that I haven't, set up yet).


  • Hero Member

    If you are really worried about things as inductance, reflections, capacitance and impedance why not provide the sensors a somewhat higher voltage and have the sensor a "big" capacitor and a voltage regulator bringing the voltage back to 5/3.3 Volts.


  • Hero Member

    I'm thinking of 4 PIR sensors (at each end of the two aisles). And I was thinking of a reed switch at the top of the garage door opening, and one at the door into the house. And the most convenient location for the relays controlling the lights is still a 7th location. I could put 7 wireless nodes into the garage, but then I have to run power to all of them - if 5v we still have the same long wire issues, if 120VAC then I need 7 power supplies. And the local control now involves passing messages between nodes rather than just sensing input pins and controlling output pins on the same uC.

    The cables supply power to the RF enabled nodes will have the same length (whether DC or AC power) as the cables going to a simple sensor, and follow the same routes.

    So it would be possible to do that, but at considerable cost in money and time and complexity - compared to just running a three or 4 wire cable from the main node to a $2 PIR located 1o-20 feet away, if that can easily be made to work (perhaps with the addition of a couple of small, cheap passive components.

    I don't know if I do need to worry about inductance, capacitance, reflections etc - that's why I'm asking. These things aren't usually specified one way or the other - you kind of need some practical experience. If those are indeed killers that cannot be fixed with a couple of passives, then I may go to the "make every sensor a full node with AC power supply and distribute AC to them instead" route. But wouldn't it be nice if I can do a $2 easy fix instead?

    One data point - in the Do It Yourself Christamas lighting control community, they routinely get away with sending TTL or CMOS signals quite a ways from a control unit to an optoisolator input (which controls a Triac to form a SSR which does PWM dimming of an AC circuit). The signals are just a 120 Hz PWM signal but the edge timing is at 120Hz * 256 PWM divisions. You won't find much about driving a 50' cable from a TTL or CMOS output in the datasheets, but it works in this application! It would not work if you were sending a 1 Mbps signal tho.

    So I have some hope that a PIR 20 feet down a cable may be able to pass back a quite usable logic signal, since it changes rather rarely. But I was hoping for some advice about the gotchas.

    Remember the sensors I've mentioned are magnetic reed switches, LDRs, and PIR sensors - only the latter needs power per se separate from the signal.


Log in to reply
 

Suggested Topics

16
Online

11.2k
Users

11.1k
Topics

112.5k
Posts