# 0 to 24vdc to drive a discreet input to a plc.

#### Jeff.M

Joined Dec 6, 2022
26
I need a circuit to convert 0vdc to 24vdc and vice versa. The output needs to drive a discreet input to a PLC.
Thanks in advance for any assistance.
JM

#### Papabravo

Joined Feb 24, 2006
20,992
I need a circuit to convert 0vdc to 24vdc and vice versa. The output needs to drive a discreet input to a PLC.
Thanks in advance for any assistance.
JM
LM393 should do the trick nicely. You can even throw in some hysteresis for good measure.

#### WBahn

Joined Mar 31, 2012
29,851
How fast do you need the transitions to be?

#### Jeff.M

Joined Dec 6, 2022
26
LM393 should do the trick nicely. You can even throw in some hysteresis for good measure.
How fast do you need the transitions to be?
Fast, It would be nice if I could use a relay.
Thanks

#### Jeff.M

Joined Dec 6, 2022
26
Fast, It would be nice if I could use a relay.
Thanks
I forgot to mention I need to use a solid state device.

#### WBahn

Joined Mar 31, 2012
29,851
Fast, It would be nice if I could use a relay.
Thanks
"Fast" is not a suitable specification.

Is 1 ms fast enough?

Is 1 µs too slow?

How fast is "fast"?

It matters because the LM339 is open-collector and so it has to be pulled up externally. The speed with which that happens is going to depend on what is connected to that node, particularly any capacitance on it.

#### Papabravo

Joined Feb 24, 2006
20,992
"Fast" is not a suitable specification.

Is 1 ms fast enough?

Is 1 µs too slow?

How fast is "fast"?

It matters because the LM339 is open-collector and so it has to be pulled up externally. The speed with which that happens is going to depend on what is connected to that node, particularly any capacitance on it.
In a PLC system the inputs are scanned periodically. 5 msec would be a typical scan interval. Events which happen faster than that are invisible to a PLC.

Joined Jul 18, 2013
28,510
The method often used by PLC's Was to scan the whole programmed logic, and then to update an output table containing the result of said logic.
The scan & update time is dependent on the size of the programmed logic .

#### Jeff.M

Joined Dec 6, 2022
26
In a PLC system the inputs are scanned periodically. 5 msec would be a typical scan interval. Events which happen faster than that are invisible to a PLC.
The switching time for the circuit doesn't matter because this isn't the source. The signal
source is a ultrasonic sensor which is suppose to output 24vdc when it detects a sheet of paper. But the sensor
that my client has outputs 0 volts dc when it detects a sheet of paper. he tried to use a relay but the relay
switching time is to slow. I'm trying to help him remotely.
Thanks again.

JM

#### WBahn

Joined Mar 31, 2012
29,851
The switching time for the circuit doesn't matter because this isn't the source. The signal
source is a ultrasonic sensor which is suppose to output 24vdc when it detects a sheet of paper. But the sensor
that my client has outputs 0 volts dc when it detects a sheet of paper. he tried to use a relay but the relay
switching time is to slow. I'm trying to help him remotely.
Thanks again.

JM
After saying that the switching time for the circuit doesn't matter, you then say that the prior solution wasn't acceptable because the switching time was too slow. So it would seem that switching time does matter.

How slow is too slow?

How fast is fast enough?

#### Jeff.M

Joined Dec 6, 2022
26
After saying that the switching time for the circuit doesn't matter, you then say that the prior solution wasn't acceptable because the switching time was too slow. So it would seem that switching time does matter.

How slow is too slow?

How fast is fast enough?
1ms will work.
Thanks

#### sghioto

Joined Dec 31, 2017
5,368
If the sensor and PLC share a common ground seems like a simple transistor inverter should work.

#### vu2nan

Joined Sep 11, 2014
341
A sensor, with its open collector output and pull-up resistor connected to a PLC input, will make the input go low when it's sensing and high when it isn't.

Nandu.

#### ronsimpson

Joined Oct 7, 2019
2,890
What is the maximum voltage on an input of the PLC? 5V or 24V?
If 5V then the pullup resistor should go to 5V not 24V.
See post #13

#### vu2nan

Joined Sep 11, 2014
341
What is the maximum voltage on an input of the PLC? 5V or 24V?
If 5V then the pullup resistor should go to 5V not 24V.
See post #13
The industry standard is 24 V.

#### sghioto

Joined Dec 31, 2017
5,368
The industry standard is 24 V.
Would the PLC need a pullup, meaning could it be programmed into the PLC?

#### WBahn

Joined Mar 31, 2012
29,851
If the sensor and PLC share a common ground seems like a simple transistor inverter should work.
View attachment 282465
This assumes that the PLC has internal pullups. Is that typically the case?

Joined Jul 18, 2013
28,510
Most of the common manuf. PLC products do not require any pull-ups of any kind on the inputs.

#### MisterBill2

Joined Jan 23, 2018
17,783
What is the source of the "0"? And what voltage does it have when it is not zero?? Are you able to edit the program on the PLC? Is there a 24 volt source available?
There are quite a few simple ways to achieve what is asked, but just asking that without any of the surrounding information is quite useless, really it is.
If that zero is an open switch to common, then the very simple thing will be to add a pull-up to 24 volts resistor.

That is all the advice you get until the questions are answered.

#### sghioto

Joined Dec 31, 2017
5,368
Is an inverter actually needed, could the PLC be programmed to accept 0 volts as a valid input?