Opto-isolated inputs and outputs

Hello everyone
I need to interface in an opto-isolated way the outputs and inputs of arduino for 24Vdc signals.
I am attaching an electrical diagram that I designed but I would like someone with more experience to have a look to see if I have correctly sized everything.
Thanks in advance

49358b1d12b2eb9a6442131abbb4024d8e14f91c.jpg

Looks pretty good at first sight.

Redundant resistors - whichever is the lower value in series you do not need. Why did you think you might?

So with a 220 Ohm resistor feeding the output optocoupler, you expect 17 mA to the LED, at 50% CTR (which is optimistic for an obsolescent 4N25), you would get 8 mA out, so to saturate the BC548 you need a base resistor of 2k7 (and a quarter Watt rating would then suffice) and can provide at most 100 mA to operate the 24 V relay. If the relay requires more current than that, you would be advised to use a modern FET instead.

Perhaps a reverse diode across the opto-coupler in the input circuit in case the 24 V is connected in reverse. If you use a modern opto-coupler such as the PC814 it will not even matter which way you connect it.

The optocoupler will not be able to illuminate the indicator LED with a 220 Ohm resistor - if you must have the LED, a 2k2 resistor would be better. A good quality LED will still be visible at 2 mA. In general, you should arrange inputs to Arduino to pull down to ground; using a pinMode of INPUT_PULLUP, a pull-up resistor is then unnecessary.

Paul__B:
A good quality LED will still be visible at 2 mA.

I would make the distinction: "Indicator LED" vs "Super Bright" LED.
With a super bright LED you can get an "indicator" intensity level at very low currents. Even down to 100 µA.
It boils down to how bright you want your indicator to be.

I object to the term "super bright".

The original LEDs - of which I have quite a few in drawers here - simply had a very poor efficiency. The technology has improved remarkably so that they are now - presumably - achieving pretty much their maximum theoretical efficiency.

Sadly for my antiquated collection, it clearly makes no sense to use other than a modern high efficiency - not "Super Bright" - LED in any application. Why would you choose to use an inferior and essentially obsolete part? :roll_eyes:

(With the possible exception of a low voltage "pseudo-Zener" and even there, it is just as likely that the more efficient LEDs also have a lower effective internal resistance. :astonished: )

Hi,

For the output device, why not use a typical inexpensive opto-isolated relay board?? Available in 1,2,4,8 relay units.

See: http://arduinoinfo.mywikis.net/wiki/RelayIsolation

Paul__B:
Sadly for my antiquated collection, it clearly makes no sense to use other than a modern high efficiency - not "Super Bright" - LED in any application. Why would you choose to use an inferior and essentially obsolete part? :roll_eyes:

Good point.

Change R5 and R6 to 1k each, you're overloading the output optocoupler substantially there.

First of all thank you all.
I had to cancel the initial scheme in order to load the updated schema. Now it should be corrected, right?

Arduino_IO_schem.jpg

Paul__B:
Looks pretty good at first sight.

Redundant resistors - whichever is the lower value in series you do not need. Why did you think you might?

So with a 220 Ohm resistor feeding the output optocoupler, you expect 17 mA to the LED, at 50% CTR (which is optimistic for an obsolescent 4N25), you would get 8 mA out, so to saturate the BC548 you need a base resistor of 2k7 (and a quarter Watt rating would then suffice) and can provide at most 100 mA to operate the 24 V relay. If the relay requires more current than that, you would be advised to use a modern FET instead.

Perhaps a reverse diode across the opto-coupler in the input circuit in case the 24 V is connected in reverse. If you use a modern opto-coupler such as the PC814 it will not even matter which way you connect it.

The optocoupler will not be able to illuminate the indicator LED with a 220 Ohm resistor - if you must have the LED, a 2k2 resistor would be better. A good quality LED will still be visible at 2 mA. In general, you should arrange inputs to Arduino to pull down to ground; using a pinMode of INPUT_PULLUP, a pull-up resistor is then unnecessary.

terryking228:
Hi,

For the output device, why not use a typical inexpensive opto-isolated relay board?? Available in 1,2,4,8 relay units.

See: http://arduinoinfo.mywikis.net/wiki/RelayIsolation

I know I could use a module already available on the market but my intention is to try to build a rack with replaceable modules depending on the desired configuration.

Hi,

OK, that sounds like a good project.

Here's what is IN most of the relay modules:

Years ago I worked with a guy at IBM who had over 100 patents. A couple of times I worked on some new project with him. He would start off with "OK, What do we know about this? What have other people done in trying to solve this problem? Time to do some research".

Then he would say, "You know, it's stupid not to use a good idea... just because it wasn't YOURS..."