Get the optocoupler's datasheet. Find the current needed to light up the led.
Get a resistor that will generate that current under 60v. You can size that resistor a little bit higher if you want to make sure that there is sufficient threshold.
If you want to protect the opto-coupler for reverse polarity, put a diode on it, or another opto-coupler but reverse the polarity - in that case, you can detect ac as well as dc.
Any general-purpose optocoupler such as 4N25 or 4N35 will do for that job. Most optocouplers work well with around 10mA forward current, which is why I suggested a 6.8K resistor.
Get the optocoupler's datasheet. Find the current needed to light up the led.
Get a resistor that will generate that current under 60v. You can size that resistor a little bit higher if you want to make sure that there is sufficient threshold.
If you want to protect the opto-coupler for reverse polarity, put a diode on it, or another opto-coupler but reverse the polarity - in that case, you can detect ac as well as dc.
Done.
Great thanks !
I want isolation for two reasons, to learn my first optocoupler circuit and to make things saver.
Asuming a 4N35 optocoupler which seems quite famous
Sergegsx:
just saw your message dc42.
let me see if I understand the calculations.
V=IR
80 =0,01 * R
R = 8000ohms
so similar to yours.
about watts of resistor, i think i got it wrong, i guess i need small 1/4W resistors
Yes, that's right. You don't need to run the optoisolator anywhere near its maximum current rating. For the 4N35, even 1mA forward current should be enough to pull the digital input pin low, if you are using the internal pullup resistor.
If of 60ma is the max (continuous) current through the diode. You probably want your opto-coupler to work a little below that. Let's say 10ma.
That means a series resistor of about 90v/10ma = 10k.
You will then find the Ic corresponding to 10ma of If. Figure 6 shows a 1:1 current transfer ratio (but at 10v Vce). So assume that's true for 5v Vce as well. Your Ic is 10ma. You want this kind of current to generate a logic '0' on your avr's input. Check the AVR's datasheet and I think anything less than 1v is a logic low (for a ST pin). That means Rc = 4v / 10ma = 400ohm. Pick 330 or 390ohm.
You will then need to calculate at what threshold input voltage that your opto-coupler will product a high -> make sure that it is over the AVR's input threshold for logic '1'.
As you can see, there is a lot of assumptions / guesswork here so you will experiment a little bit.
What you will find is that using a zener will greatly help producing a sharper turn-on.
Sergegsx:
I might get some voltage surges and would not like to fry my arduino, also its a good oportunity to use them for the first time. Can you help me out on how to choose the appropiate one?
You could put in a protection diode for that. Get a 5V Zener diode and connect it in parallel with the lower resistor. If a voltage higher than 5V appears at the resistor junction the diode will short it to ground.
If the resistors have large values (75k, 5k) then there'll hardly be any amps, it should be enough protection.
D4 is redundant in this circuit, unless you accidentally short the input of the opto isolator to the output. It might be a useful protection device if you were not using optical isolation. It is also connected the wrong way round.
dc42:
D4 is redundant in this circuit, unless you accidentally short the input of the opto isolator to the output. It might be a useful protection device if you were not using optical isolation. It is also connected the wrong way round.
thanks, i thought this is what fungus ment to be able to give aditional protection in case there is a surge in the 80Vdc.
dont understand what he ment then.
the internal pullup resistor from the arduino active.
That pull-up "resistance" is too high and you may not be able to turn off the phototransistor and generate a logic 0.
Use a resistor and its value will generally be < 10k.
From the data sheet, the off-state collector current of the 4N35 is 50nA max at 25C. So the internal pullup resistor will be fine unless the OP puts the opto isolator somewhere very hot, or he needs a faster turn-off time (but we're only talking about a few hundreds of microseconds at most).
dc42:
See attached. The diode in parallel with the input side of the optocoupler is needed only if there is a possibility of the polarity of the 60-80V input reversing. Enable the internal pullup on the digital input pin.
Sorry to bump this up, but I finally need to build this circuit.
I was just wondering, what is the difference between setting the diode in series with positive, or to put it in parellel with the optocoupler?
Please correct me if I am wrong
In series: Acts as a polarity protection. In case + and - are connected the wrong way it will not allow current to flow.
In parallel: Acts as a short circuit in case voltage is over "reverse voltage", but it was suggested that any 1N400x however for example 1N4007 has 700V reverse voltage, and I am just putting in 80V, so any surge will be much lower. however 1n4148 does have a "reverse voltage" of 100V so that makes more sense.
Both? If I am correct, both diodes would be needed for extra security?
A diode such as 1N4007 will have a lot of capacitance and a slow reverse recovery time. This means that if you get a sudden negative going transient, it will initially be passed through the 1N4007 and cause the opto diode to break down - although probably not for long enough to cause damage. However, using a small signal diode such as 1N4148 (which is also much faster than a 1N4007) in parallel with the opto diode avoids that.
dc42:
A diode such as 1N4007 will have a lot of capacitance and a slow reverse recovery time. This means that if you get a sudden negative going transient, it will initially be passed through the 1N4007 and cause the opto diode to break down - although probably not for long enough to cause damage. However, using a small signal diode such as 1N4148 (which is also much faster than a 1N4007) in parallel with the opto diode avoids that.
thanks dc42, so I dont need both?
Is my description of the function of each diode correct? or am I missing something?
Sergegsx:
thanks dc42, so I dont need both?
Is my description of the function of each diode correct? or am I missing something?
Your description is correct, and you don't need both diodes.
btw you can also get opto isolators that have two back-to-back LEDs on the input side. If you used on of those, then it wouldn't matter which way round you connected the 80V input, because it would work either way. Here's an example: http://www.farnell.com/datasheets/54263.pdf.
Hi, I noticed this long drawn out discussion, here is my bit, find in the attached schematic that if you use a zener diode in series with the input to the opto, the input will not conduct until the input is above the zener voltage.
Using 10mA as the starting current is just a suggestion.
Just some quick calcs and you don't need high wattage components. It will need some more work to check current at 80V, but hey there's the challenge.
A lot of industrial CNC and other control equipment use this method to check if all the supply rails in its system are present before commencing and continuing any sequence.