Wednesday 1 March 2017

PLC Input Circuit for PSoC, Raspberry Pi, Beagle, OLinuXino, Cubieboard - High voltage tolerant

Summary
This blog features a PLC input circuit that can be adapted for microcontrollers such as PSoC, Amtel, PIC and mini-PC boards such as the Raspberry Pi, Beagle, OLinuXino and Cubieboard to name a few.

Typical PLC Input Circuits
In order to keep used Printed Circuit Board (PCB) area and productionisation costs at a minimum, some commercial PLC input circuits are understandably designed with minimal components and protection. With the addition of a few components, these input sections can be made more robust with respect to the input voltage.


Example PLC Input Circuit
Example PLC Input Circuit

PLC Input Circuit Improvement
The input circuit in the illustration below contains the requisite optocoupler 'opto' LED current limiting resistor R1, which also forms a voltage divider with R2. This divider prevents the maximum LED voltage of opto O1 being exceeded in normal operation. These parts also define the turn ON behaviour for the input, depending on some of opto characteristics. Added to the design were the dual Zener D1 and capacitor C1.


Improved PLC Input Circuit
Improved PLC Input Circuit
The Zener was added to protect the input and allow the input to take constant over-voltage up to 100VDC with brief exposure of voltages up to 150VDC. 

Under normal conditions, low voltages to 24VDC, D1b has little to no effect as the voltage at the divider of R1 and R2 is marginally lower than the Zener breakdown voltage. At higher voltages D1b conducts protecting the opto LED. However some of the components risk irreversible damage from over voltage or failure from overheating if the input is exposed to higher voltages for long periods. Higher rated components can be chosen to mitigate this issue.

The filter capacitor C1 was added to add some filtering to the input signal however it lowers the response of the input to the low kilohertz region. Lowering the value of C1, or removing C1 completely could be one solution to improving the input response, although noise can become an issue.

PLC Input Sensitivity
While the proposed PLC circuit in this blog was not designed to adhere to PLC standards such as EN61131-2, this design could be loosely considered a Type 3 low power design (2-15mA).

To update the design into a Type 2 design (6-30mA) the resistor R1 could be reduced to 2.7k 1W and R2 to 470R. These resistor values can be adjusted up and down depending on the practical application.

PLC Inputs: Practical Example
For example purposes a jellybean 4N28 opto in a practical setup, wired in saturated mode, was implemented. For differences between opto modes of operation such as linear and saturated mode, see Learn About Electronics.


4N28 Optocoupler
4N28 - Courtesy Vishay

Consider the implementation of the PLC circuit on breadboard.


Breadboard Improved PLC Input Circuit
Breadboard Input Circuit

In the image above the Yellow wire is the equivalent PLC input and the Green wire toward the bottom of the image is the 0V. The Red wire is a separate 3.3VDC supply with the Green wire at the upper right of the image being the 0V.

A benchtop triple output power supply was operated with two outputs in series to achieve a 0 - 70VDC range and the third output was fixed at 3.3VDC to supply a LED driven from the 4N28.


Power supply voltage settings showing 70VDC operation
Power Supply - Voltage Settings

Adjusting the input voltage between 0 to 8VDC yielded little change in the state of the LED. The minimum turn on voltage for the LED was 9V which allowed only a few micro amps flowing through the LED. The current flowing through the 220R dropper resistor was measured as a function of the PLC input voltage.



Forward LED Current vs Input Voltage (PLC Input)
Forward LED Current vs Input Voltage (PLC Input)
The data shown below is for the above graph.

Measurements of Forward LED Current and Input Voltage (PLC Input)
Measurements of Forward LED Current and Input Voltage (PLC Input)

Since the LED used for the example was a superbright RED, the LED turn ON was easily visible at approximately 14V DC in daylight. However under low light conditions the LED could be seen to turn ON at 10V DC.

Adding a Schmitt Gate
Next a Schmitt gate was added to the output of the opto. Two gates (inverting outputs) were connected in series, then the LED was driven from the output of the second gate. The opto remained configured in saturated mode however the input of the 74HC14 gate is driven by a pull-up on the collector of the opto output. The gate input is a high impedance CMOS input which has defined voltage thresholds for operation.

PLC input with buffer
PLC input with buffer
Part of the functionality of the HC14 gate is hysteresis. Adding the gate to the design results in the LED turning ON when the input voltage, IN+, is 10.8V DC and OFF at 10.5V DC. The defined LED behaviour follows the gate input voltage thresholds, unlike the output of the opto which is dependent on forward current through the LED and the current transfer ratio. If the 300mV hysteresis is not required, another gate/buffer or even a Darlington opto could be used in its place.

PLC Input with Buffer
PLC Input with Buffer

Furthermore, if input isolation is not required then the opto itself may be replaced with a suitable gate of choice, resulting in a further simplified PLC input design.

Other Alternatives
There are a few alternatives that come to mind to replace the humble opto. These include the magnetic, inductive and capacitive coupled Digital Isolators such as the devices from Silicon Labs, Texas Instruments and Analog Devices to name a few. At a slightly higher cost and more suited as output devices, are the ranges of Solid State Relays. SSR's are manufactured by companies such as Ixys, PanasonicToshiba and Vishay.

No comments:

Post a Comment