# How can I interface with these 24 V signals?

I have a few 24V inputs to my micro controller from Limit switches. I have conditioned the signals as shown. Pulled down, de-bounced and level converted.

I have some signals that are again 24V but coming from a distance of 50meters and going to multiple such conditioning circuits on different boards in the system. Will this conditioning handle such signals? If I have to use high impedance I was about to use comparator ICs. What would you suggest guys?

-

Wealthy man, he? :-)

Seriously, you can do this with far less components. Simply use a resistive voltage divider.

For 24 V to 5 V you could use R1 = 39 k$\Omega$ and R2 = 10 k$\Omega$. If your 24 V signal can supply the current you can decrease the resistor values. Lower resistance means less sensitivity to noise. You could place a 100 nF cap parallel to R2 to filter the signal.

I would do the debouncing in software. I usually sample at a 32 ms timer, and filter out isolated 0 or 1 levels. So 000100111 becomes 000000111.

-
The ULN IC serves me as with an internal 9V zener. This will consider a signal below 13V to be Low and anything above is high. This one is good if your input signals are generated at a considerable distance. –  Aashish Thite Jun 13 '12 at 6:10
@Aashish - This cable gives you a 2.7 $\Omega$ resistance over 50 m. With the given resistor divider that gives you a 1 mV drop. Even with 390 $\Omega$ / 100 $\Omega$ resistors (if the source can deliver the current) that would be only a 130 mV loss. –  stevenvh Jun 13 '12 at 6:24

For compatibility with most of standard 24V parts you need an opto coupling. The connector to controller should include leads from external 24V supply. The current should be at least 20mA, but no more than 1A per input/output. The signal conversion should absolutely include schmidt triggers. In addition to this, consider rating your insulation to 500-1000V or more, separate grounding to chassis, protection/survival of outputs to shorted load over infinite time. You need to set input impedance to about 500-1500 Ohm. (~24V/20mA with some range of sensor source impedances). One important aspect is EMO (Emergency override, the red mushroom button), what the sensor network will do on EMO - break the power ? What controller will do ? What receivers of 24V commands will do ? How they recover from power loss, what disconnection/connection does ? E.tc.

Even if it is your personal property, the 50m line makes it more than 2 resistors problem.

Basically with 50 meters of wiring the look at the schematics as a single device applies no more. It is more like wiring design for buildings or heavy machinery. There possibly is a relevant book about appropriate design rules, code etc. Depending on what industry is it.

Consider use cases with separated grounds, different AC phases powering different ends, when mains have 3 phases of power.

You can think of the solution as somewhat overbuilt, but think of extremities when long lines involved. Long line is inductive. The fast interrupt of DC current will cause a voltage spike. Long line is also capacitive, sometimes as much as nanofarads. It is open capacitor and high impedance source of noise. You need low impedance receiver to defeat high impedance noise source. Another typical requirement for travel limit switches is detection of faults: loss of connection, loss of power, fault of sensor. To control limit switch completely, power it using controlled output (that what 1A output capability is for), programmatically check limit value, unpower and check again, power it back. Otherwise there is no certainty in reading.

One interesting problem with optical limit switches is that even if they have their own hysteresis, they are still not certain. When the opening is closed very slow the limit switch will pickup the optical noise from ambient light and will send a 120Hz signal caused by external light. There is no physical way to avoid it. So treat a single reading as a probabilistic and multiple readings as statistical.

-