Optocoupler Question

Hi.

Would it be possible to use an optocoupler to make an Arduino input tolerant to both 12v and 24v?

I don't know a great deal about the specs of an optocoupler and unfortunately for me, understanding data sheets is a bit like the black arts.

I realize that a current limiting resistor needs to be in series with the coupler. Can the same resistor handle either voltage?

From my (possibly wrong) calculations, a 12v supply with a 1.2K resister would give 10mA. Presumably, a 24v supply would give 20mA. Would that typically fall within a band that a coupler could accept or would it be too wide?

Sorry if this seems a little vague but, I'm primarily a mechanical engineer.

Thank you in advance.
Paul

yes. you have it correct.
just select an opto that works within those ranges.
you could do the same with a voltage divider on an analog pin

you can also use a cap and a resistor to create a pulse based on the R/C time constant. then measure the pulse rate on the digital pin.

Thank you very much for the answer.

Now I just need to try and track down a suitable optocoupler.

Thanks again.
Paul

Colaboy:
Now I just need to try and track down a suitable optocoupler.

So many out there, spoilt for choice, though these are common enough and come in single,dual or quad versions.
http://pdf.datasheetcatalog.com/datasheet/siemens/ILD74.pdf

Usually find you can lower the input current to a lot less than 10ma; 2 to 3ma works for me.

That's fantastic, thank you.
I can get those no problem.

I've studied the data sheets you linked to in an attempt to better understand them. That way hopefully, I don't have to bother you good people in future.
I can see a value for maximum current but, I can't spot where it mentions a minimum current. Am I not interpretating correctly or does it not mention a figure. Electronics data sheets have always been somewhat of a mystery to me.

Thanks
Paul

There is no minimum current.

However optocouplers have a “transfer ratio” - how much current the transistor will pass for a given current through the LED. And this is not linear; it becomes (much?) poorer at low values.

In general, you want to run at least a milliamp through the LED, and expect a few hundred microamps through the transistor.

That maximum current is a "must not exceed" value to prevent burning out the LED. I would stick at ½ that or so.

I've use 100s of the PS2501-4 which have 4 isolators, 80V max and 600% CTR (5mA through the IRLED will switch up to 30mA through the transistor). One thing nice about optoisolators is that they can be used for high side switching with as much ease as low side switching, probably why you'll never find one that uses a PNP transistor.

ricky101:
So many out there, spoilt for choice, though these are common enough and come in single,dual or quad versions.
http://pdf.datasheetcatalog.com/datasheet/siemens/ILD74.pdf

Usually find you can lower the input current to a lot less than 10ma; 2 to 3ma works for me.

LED’s decay with use. so your 2mA today may not work in 10 years.
It is selected like any transistor. I you need to make sure your input will saturate the output.
and, like any transistor, there is no need to dump more power than that which gets the job done.
I usually just use the next lower resistor. can’t think of when I had to use more than 10mA though.