Hi everyone!
I'm trying to run two pumps using my arduino and trying to separate the power of my arduino (USB port) from the power for the pumps (12v adapter) so I can eliminate the possibility of breaking anything. I made my circuit on tinkercad and it works fine there but I want to make sure it's all good before continuing and actually building it. Please check the attached schematic.
For the optocoupler, I will be using 4N25 instead of the one shown and for the transistor, I will be using PN2222A NPN. For the resistors, I will be using 1 k ohm like in the tinkercad.
During my first coarces in programming, some 45 years ago, it was told that there is no theoretical way to prove that sotware is fault free but only reality signing of faults. I have not heard any different science later.
If Your system works ok, check temperatures at as many parts as possible. If no place shows any disturbing heat and Your system does what You want, You ought to feel safe.
Opto couplers are normally used to separate circuits, in this case the Arduino circuit from the motor circuit.
But..., you share grounds. That defeats the use of opto couplers.
Pump negative should go to the collector, and base/LED circuit is all wrong.
The 2N2222 is most likely not getting enough base current with that circuit, and could overheat and fail.
Common bjt transistors are only good for a few hundred milliamps with the ~20mA base current an Arduino can provide.
Your pump could be drawing more than that. Post a link to the pump.
I would forget about that circuit, and just use a common logic level mosfet configuration. First diagram in this link.
Leo..
Wawa:
Opto couplers are normally used to separate circuits, in this case the Arduino circuit from the motor circuit.
But..., you share grounds. That defeats the use of opto couplers.
Pump negative should go to the collector, and base/LED circuit is all wrong.
The 2N2222 is most likely not getting enough base current with that circuit, and could overheat and fail.
Common bjt transistors are only good for a few hundred milliamps with the ~20mA base current an Arduino can provide.
Your pump could be drawing more than that. Post a link to the pump.
I would forget about that circuit, and just use a common logic level mosfet configuration. First diagram in this link.
Leo..
Datasheet has important things missing, stall current, and is therefore almost useless.
If you want to use the 2N2222, then connect emitter to ground and collector to motor negative.
Motor positive to 12volt, with diode across the motor to protect the transistor.
Use a 220 ohm resistor between Arduino pin and base.
Share motor supply negative/ground with Arduino ground.
Leo..
Wawa:
Datasheet has important things missing, stall current, and is therefore almost useless.
If you want to use the 2N2222, then connect emitter to ground and collector to motor negative.
Motor positive to 12volt, with diode across the motor to protect the transistor.
Use a 220 ohm resistor between Arduino pin and base.
Share motor supply negative/ground with Arduino ground.
Leo..
Leo,
I set up what you described on tinkercad and I see how it works, my question is should I then not use the optocoupler? If I should use it, how can I set it up without sharing grounds?
This is the basic opto coupler diagram.
D2 can be the indicator LED, R2 needs to be calculated for ~20mA (= 100 ohm if LED~1.8volt and opto~1.2volt).
R1 should be ~470 ohm, diode can be 1N4004, and the relay coil should be the motor/pump.
Motor supply 12volt instead of the 5volt on the diagram.
Leo..