maniac84
Full Member level 6
- Joined
- Mar 4, 2012
- Messages
- 337
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,298
- Activity points
- 3,661
What do u mean by Low voltage?If the LOW voltage for all the signals (with 5V, 12V and 24V) is less than 1V then simple resistor divider or a zener diode solution would work effectively. If the LOW voltages are more than that then PIC might indicate some faulty counts. So you may have to consider using comparators for 12V, 24V signals if required. The output of the comparator then can be converted to 5V Logic level and fed to microcontroller circuit.
What Ravindragudi means is the PLC produces two levels of voltage out, a high voltage (5V, 12V, 24V) and a low voltage which hopefully is close to zero. Scaling the high voltage down to your 5V limit is easy with the resistors as I mentioned earlier but if the low voltage is not zero but some voltage higher than zero, even after scaling it might be too high for the PIC to recognize as logic low.
Examples:
PLC produces 24V high and 0V low, scaling reduces that to 5V and 0V respectively and the PIC is happy.
PLC produces 24V high and 15V low, scaling reduces that to 5V and 3.12V respectively and the PIC sees both as being logic high. 3.12V is above the '0' threshold.
So if the low output really is zero or close to it there is no problem. If it isn't the solution is to use comparators to detect if the PLC output is above or below a voltage somewhere in the middle of it's high and low range. The comparator output would be a 5V logic signal the PIC would recognize.
Brian.
There should be a comparator that works with nominal uC voltage ( 5V ) for each PLC output.Comparators can be programmed in according with output levels-for instance- 20V for 24V output, 10V for 12V output so on..
Finally the comparator outputs will always be 0 or 5V when the signals levels' exceed the programmed value..
I talk about simple comparator.They have 2 inputs, one of them is reference input other one is simple input.If input level is higher than reference voltage comparator output rises to Vdd, otherwise is settled to zero.There are tons of comparators in the market, if your search a bit, you'll find many IC circuits...U mentioned comparator can be programmed? Programmed by what? The PLC or my pic? Can explain more?
How do we build a comparator? Is it by external components? Or we programmed it?
I talk about simple comparator.They have 2 inputs, one of them is reference input other one is simple input.If input level is higher than reference voltage comparator output rises to Vdd, otherwise is settled to zero.There are tons of comparators in the market, if your search a bit, you'll find many IC circuits...
Opto-isolators will always work in DC circuits and are the usual method used in industry because of the way they completely isolate the input and output sides. The input side on almost all types only works on about 1.8V maximum though. There is a real LED at the input side so you have to treat it as such and use a resistor to limit the current allowed to flow through it. The data sheet will tell you the LED voltage and optimum current to use, usually it is in the region of 5mA to 15mA. The resistor value is calculated with:
(supply voltage - LED voltage) / LED current.
On the output side you normally have a transistor working as a switch, it turns on (= closes if it was a mechanical switch) when the LED has current flowing through it so you can either wire it to ground with a pull-up resistor to get an inverted signal or to 5V supply with a pull-down resistor to get a non-inverted signal.
For AC the opto-isolator is more problematic, you have to convert the AC to DC to drive the LED side.
Brian.
We just have to adjust the R1 value if we want to use different input voltage Vin.
R1 = (Vin-Vf)/If where Vf=1.2V and If=10mA (values from datasheet of 4N37).
So, for my case, if I'm using 24V as Vin,
R1=(24-1.2)/10m=2280ohm
if 12V, R1=(12-1.2)/10m=1080ohm
if 5V, R1=(5-1.2)/10m=380ohm
Am I correct guys?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?