0
\$\begingroup\$

I want to derive the signal from a programmable I/O to turn a signal LED on/off for visual state indication. If the Output is programmed as "Output" it will produce a sink connection to the IC and produce a HIGH at the output. If it is configured as "Input" I need that it produces a HIGH signal regardless if the input has been wired to read in sink or source mode. For example, a LOW on the input should produce a HIGH on the output (the wiring is sourcing). A HIGH on the input should also produce a HIGH on the output (the wiring is sinking). I may have to use a selector for the input read state because basically it depends on the type of wiring of the connected sensor, so I may need to select if it is sink/source so the IC can deisplay appropriately.

Does anyone know how a PLC produces the indicator LED signal regardless of its wiring? It's pretty much the same operation here. Let me know if the PLC manufacturers use a different way to produce the indicator lights (hardware) or if they use microcontroller signals to produce the status indication (sfw).

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Would you mind to clarify your issue and edit your question, please? For example, add a table showing all input combinations and the requested outputs. And an example of the schematic, you can use a "black box" for the IC. \$\endgroup\$ Jun 27, 2022 at 5:47
  • \$\begingroup\$ How much 'source' and 'sink' current is involved, and what are the logic thresholds? \$\endgroup\$ Jun 28, 2022 at 4:20

3 Answers 3

0
\$\begingroup\$

Industrial I/O is quite a strange beast. In fact, as far as I know, an universal NPN/PNP input (they are called that way even if they are not done using BJT) is not even provided for in the IEC 61131-2 standard.

However the Siemens LOGO for example handle it in some way. In fact the LOGO inputs even happily handle AC inputs.

If I got correctly your question you want to handle both these circuits:

schematic

simulate this circuit – Schematic created using CircuitLab

(this is the input side, for the output just use some kind of half bridge)

There could be many way to implement this (also the standard calls for the diagnostic led to be in the signal path, by the way). Probably there are dedicated ICs to do that but I would do it in this way:

schematic

simulate this circuit

This is extremely simplified but should give an idea. R1/R2 give you a midpoint reference. If you need to detect both a switch to the supply and to the ground you need something at the middle. Depending on the requirements it can be made stiffer as needed (maybe even a dedicated midsupply rail).

D5 (in europe the zener symbol is different but whatever) represent you filter/protection network (usually at least a TVS and maybe some capacitor depending on the requirement).

R3 can be a simple resistor if the voltage is more or less fixed or some more complicated current limiting network (like source to gate bound JFET).

The idea is that when there is no signal the sense line is approximately at the same potential of VREF. When you apply a switch or input with an adequate current sink/source (depending on the input type 1/2/3) it unbalances due to the drop on the current limiter.

Use a window comparator on the sense line and process as needed.

This would be completely nonconformant but should do the trick.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the answer Lorenzo. Yes indeed, I want to handle sink/source connections to the I/O pin and be able to signal with an ON LED in each case. I need more than 60+ signals to be handled and I need a small factor, robust solution. Do you know of an IC that can do that? \$\endgroup\$
    – Ed Zamper
    Jun 27, 2022 at 18:00
  • \$\begingroup\$ Look for 'industrial input shift register' but I've never seen one handling the dual polarity case; everyone does the IEC standard (usually the positive input, for safety) for the obvious reasons \$\endgroup\$ Jun 28, 2022 at 6:26
0
\$\begingroup\$

If the Output is programmed as "Output" ...

This is going to be your problem. There is no way for the I/O level converter to know whether the its driving signal is an OUT from the microcontroller or coming from the input and feeding back out.

Let's say you've configured as an input. You get a high on the input that gets translated to 5 V logic high on the PLC side but that feeds back to the IC which puts a high on the OUT direction which then keeps the input high even if the input is disconnected. The IC needs a jumper or DIL switch to set its mode of operation.

Does anyone know how a PLC produces the indicator LED signal regardless of its wiring?

Most use an opto-isolator on the input and wire the LED on the 5 V logic side so that it indicates what the input is actually seeing.

I think you should revise your question in the light of this and the comments below it.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. A typical PLC input. The configuration shown on the opto LED is a current "sinking" input. By connecting R1 to +24V and the input to D1's cathode it can be converted to current "sourcing" input.

  • R1 is sized for the external logic voltage.
  • D2 will light when Q1 is turned on.
  • R3 ensures that the buffer input is pulled high when the input is off.

When the input is powered the indicator LED D2 turns on. This design has the disadvantage that a low input voltage will turn on Q1 partially and not give a definite low or high to BUF1.

schematic

simulate this circuit

Figure 2. By replacing BUF1 with a Schmitt trigger we can be confident that D2 on indicates a low signal is being applied to CPU IN and when D2 is off CPU IN is high.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks transistor. When you say "Most use an opto-isolator on the input and wire the LED on the 5 V logic side so that it indicates what the input is actually seeing." do you mean there are opto-isolators that can turn on its output either with low or high at its input (a tri-state element)? \$\endgroup\$
    – Ed Zamper
    Jun 27, 2022 at 18:15
  • \$\begingroup\$ See the update. \$\endgroup\$
    – Transistor
    Jun 27, 2022 at 18:48
0
\$\begingroup\$

This input stage accepts industrial NPN and PNP sensors or switches, the output is active low.

schematic

simulate this circuit – Schematic created using CircuitLab

  1. The unconnected input provides 4.4 V via R4 and Q1 used as diode. This voltage is not sufficient to turn on Q2 via R3 and R1. U_OUT is close to 5 V.
  2. During an active low input signal from an NPN sensor or a switch to GND U_OUT drops down to 0.6 V above U_IN.
  3. At voltages above 12 V at U_IN, e.g. from an PNP sensor, diode Q1 does not conduct but the voltage divider at the base of Q2 is sufficient to turn it on. This time U_OUT drops down to around 0.2 V. The threshold voltage is defined by R3.
  4. Transistor part numbers are just chosen for the simulator.
  5. The circuit also works with V2 = 3.3 V. In this case, with proper chosen R3, it is possible to read 0 V and 5 V at U_IN as active.

This circuit is cheap and very space saving. It benefits from a Schmitt-Trigger behind U_OUT and an ESD protection RC combination at the input side. I used 100 ohm in series and 100 nF to GND.

This is not intended to be used in an industrial environment. The input impedance is too high.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.