Hi, can anyone help with my project please (first one). This is using an Arduino Uno R3 to turn two pumps on, one at a time for 1 second each, they are driven from a 12 volt supply (not the arduino supply) so I'm using a 4N35 optocoupler to turn them on. The first pump turns on no problem but the 2nd pump wont turn on at all. Any help with my code or circuit to resolve the problem would be greatly appreciated.
An opto-coupler cannot handle the current required by a motor. You need high current MOSFETs.
You also need flyback diodes. Without them, the MOSFETs and opto-couplers will be damaged (they may already be damaged if you connected them like the diagram you posted).
You also need current limiting resistors between the Arduino and the opto-couplers.
You have connected a common ground between the 5V circuit and the 12V circuit, making it pointless to use opto-couplers.
I have just one question why you would connect the negative of the batteries to the GND of the Arduino? It totally defeats the isolation purpose of the optocouplers.
Thanks everyone for the replies, I have changed the optocoupler to a SPDT relay, and now I have the pumps turning on. Would love some feedback on this version too, pick any holes in it before I turn the simulation into a project
@mjs_05
You can't drive relays directly from an Uno I/O pin.
You will need a driver circuit.
What is the current and voltage required by the relay coils?