Please check my schematic

Hi,
i working on board for driving 24V relays and selenoids (500mA max).
For outputs i using photomos relay and for inputs optocoupler.

Im beginner ... can you please check my circuit?

Thank Koudy

You've got very little current flowing thru the output LEDs, and even less on the receive side.
If you're not getting much (any) response, consider decreasing the current limit resistance values for more current flow.

Thank for reply...

Current flowing thru the output LEDs is about 1,5mA. Typical LED operate current by datasheet is 1,2mA (3mA Max).

PhotoMos datasheet:

Sorry for my english...

I think you may be reading the data sheets incorrectly. The 1.5ma is the current that will just about turn on the device. If you look further down the datasheets at the graph which shows output against LED current you will see that you need about 20ma to get a good turn on with low output resistance (high output current).

You therefore need to decrease the drive resistor to ensure you get a decent current flow into the optocoupler. However 4 circuits at 20ma will be too much for the arduino output stages so you will probably need a driver transistor for each opto device, something like the 2n2222.

jack

I don't understand why there are low pass filters on the lefthand devices, this will make them switch even slower and possibly overheat. Note the photoMOS devices switch very slowly anyway and won't work with PWM.

Put the polarity protection 1N4007 on the high side perhaps? For 10mA LED drive 330 ohm resistors are about right. If each device fed from a separate pin this is within the Arduino spec.

Ok thank,

I changed resistors to 560ohm (about 7mA ... recommended LED forward current is 5 to 10mA).
Inputs are tested and works fine.

I want expand circuit from 4 inputs and outputs to 16.
Is possible drive 16 outputs at same time (7mA x 16 = 112mA from MCU)?

Yes. You have a Mega with lots of I/O pins?

The Arduino can source or sink 150mA max through its pins, so I think that's OK. But why those electrolytic capacitors? They will slow down switching and leave the devices in the linear region for longer (linear region = bad news for switches)

CrossRoads:
Yes. You have a Mega with lots of I/O pins?

Yes I have a Seeeduino Mega.

MarkT:
The Arduino can source or sink 150mA max through its pins, so I think that's OK. But why those electrolytic capacitors? They will slow down switching and leave the devices in the linear region for longer (linear region = bad news for switches)

Capacitors are intended as filters... is it wrong?

From previous reply: "Put the polarity protection 1N4007 on the high side perhaps?" i don't understand ... sorry

The photoMOS devices are switches - an opto-isolator driving a MOSFET - switch them slowly and they will be in a half-on-half-off state for some time - at this time they will dissipate significant power and possibly overheat. The devices are rated at 0.5W on the output circuit, but if you switch 0.5A at 24V say, then in the half-on-half-off state they will be dissipating 12v x 0.25A = 3W (6 times their rated continuous power).

Thus its important to either have the input fully off or fully on so the switch is in one state or the other. So switch the input fast, not artificially slow. Why do you think you need a low-pass-filter BTW?

Capacitor helps to reduce electrical noise...

Maybe might be better use transistor with optocoupler instead of PhotoMos (eg PC847 + TIP120).
It's a good idea?

Can I use this schematic instead of photoMOS version?

Anybody help?

You need a pullup resistor on the opto output, and then an inverter so the drive transistor is only on when the opto is driven.
Had a better write up with this, upload server full error wiped it out on me.
Here are some other parts suggestions for expanding to 16.
Maybe use 74AC299PC, 8 bit shift register wtith 24mA drive capability to drive the optos for example if need more than 1 on at a time.

Use of shift register is good idea.
Your schematic looks good, I only replace shit register to PCF8574P (Remote 8-bit I/O expander for I2C-bus) and ULN2003A to ULN2803A.
Is this correct?

PCF8574P:
http://www.nxp.com/documents/data_sheet/PCF8574.pdf

ULN2803A:

Thank Koudy.

I'd say that looks pretty good Koudy.
The ULN2803 is also open collector, so you will need pull up resistor there to ge t a high at the TIP125 bases.

Walk a 1/0 thru the logic, the 74LS04 may be 1 inverter stage too many.
PCF8574 low turns on opto, bringing pc847 output low, bringing 7404 output high, bringing uln2803 output low and turning off the TIP125.

I guess that works - nothing turned on unless the first part in the chain puts out a high.

Why do I need 74LS04 inverter? Circuit should work without inverter... Or not?

Without inverter:

Next question is about power supply...
VDD is connected to the Arduino +5 V pin, VSS to arduino GND, +24V is supplied from external power supply.
Question is, can i connect +5V in my circuit to arduino +5V pin or is better connect it to external 24V supply through DC-DC convertor?

Thank Koudy

Resistors output of PC847 are in wrong place, need from +5 to collector, collector also goes to UNL2803 input.
Emitter to ground. Treat the same as you did with RN1 in fact.
Here's 2 ways to think about how your Hi/Lo's will work.
(actual parts not shown, just some parts for ideas)
If your end up having the motor turn on when you don't want it, can just change how you drive the opto-isolator.

This maybe work fine...

PCF8574 High = opto on -> opto output low -> ULN output high -> TIP125 output low (relay is off)
PCF8574 Low = opto off -> opto output high -> ULN output low -> TIP125 output high (relay is on)

I understand it correctly?

I believe so.