Controlling 12V 2A Max DC Water Pump With Arduino Uno

So im planning to use arduino uno to get data from sensor and turn on the pump for a few seconds before the sensoor make another reading to determine whether to turn off the pump. So i use any of electric parts laying around to finish this project. I use my internet knowledge to make this circuit
image
I use IRLZ34N for transistor and 1N5400 for diode. Is my circuit right or does it need some work? I also plan use 12V for supplying Arduino Uno through Vin from the same power supply as water pump. Is that a good idea or not? I heard arduino Uno have voltage regulator.


Here is my arduino uno. Its not original i hope its okay

Hii beginnersluckk!
Although the circuit seems perfect but i would recommend to use a relay to turn on and off your pump and for the control part you should definitely go with an optocoupler which will help you to isolate your control circuit with powercircuit. and you will not loose your arduino at any cost.

There is nothing wrong with upper circuit too, it will work fine

1 Like

Tiny thing, but R1 should be on the Arduino side of R2.

2 Likes

Yes you can use 12v power supply on arduino.
which sensor you want use on your project... :question:
whats your plan to make from arduino :question:

Bad circuit. R1 needs to go to the port pin. The way you have it drawn is all over the internet and it is wrong. You are forming a voltage divider reducing the gate voltage which in return reduces the MOSFET enhancement. You have picked a good part that will work as you have drawn it. You probably do not need D2 with this MOSFET but would with some others. Be sure to connect the Arduino ground to the source of the MOSFET.

If this were my design I woulds power the Arduino via Vin with the 12V. This would help with any transients on the +12V line. Remember A Power Supply the Arduino is NOT!

You can also purchase Solid State Relays that are opto opto isolated for just a few dollars that will also do the job. Stay away from mechanical contacts they make lots of electrical noise.

2 Likes

Be careful when using the power plug or Vin. Powering through Vin or the power jack means that the Arduino and all peripherals that are on the 5V rail are powered by the onboard 5V regulator. The on board 5V regulator is not heat sinked so will supply limited current before it overheats and shuts down. Keep the total power dissipated by the on board regulator to less than 1W to avoid overheating. The amount of current depends on the voltage input to Vin or the power jack. The higher the voltage the less current can by supplied. I would use a buck converter to drop the higher voltage to 5V and connect that to the 5V pin on the Arduino, bypassing the, weak, 5V regulator. Then the rated current of the DC DC converter is available on the 5V line.

With 12V into Vin, the current supplied by the 5V regulator should be kept under 150mA to stay under 1W dissipation. The Uno needs about 50mA leaving 100mA (max) for other uses.

1 Like

image
Ohh, Is this how its supposed to be? I changed the symbol for the transistor because i realized that its wrong. This is the full circuit for arduino to power supply and the water pump. I dont think i will use relay because its pretty expensive. Is optocoupler a must? my project is that arduino will receive if the soil is dry or not and if its still dry it will stay on and when its not it will go off. Sorry for my bad english.

image
Ohh, i just realized that i was making a voltage divider! Thanks. I have made the full circuit because i feel like i didnt explain good enough. Should i use relay? i didnt feel like i need to use them because the pump is DC and only 12V.

Hello @gilshultz ,
I suggest you have a look at this: Flyback diodes and why you need them - #6 by PerryBebbington

1 Like

You don't need a relay unless you want isolation. Even then you can use a MOSFET with an opt-coupler to get isolation if required.

The only problem with your circuit is as mentioned by @groundFungus in reply #7, be very careful feeding an Arduino with 12V to Vin as the current available at 5V is somewhere between not much and hardly any.

1 Like


I dont think I will draw to much current at arduino for my project. I searched the internet and i learned that the output from Vin will be the same as input at DC jack at arduino Uno. So if i plug in 12V AC/DC adapter to DC jack and power the motor it should be fine right?. Can i use online bought arduino jumper for that?. Heres my diagram. So i tried making another circuit using the optocoupler PCB17 and the transistor is replaced by IRFZ34 because the voltage is higher 12V. Sorry if i ask too much question, i swear i'll try answering some question on forum too

Not sure why you have added the opto-isolator.

Yes, the IRFZ34 requires a higher gate voltage to turn it on and the opto-isolator achieves that, but I don't see any reason to replace the IRLZ34, which has a Vds of 60V, so plenty more than you need.

The opto-isolator does not isolate anything as everything is fed from the same power supply.

What is your thinking?

Not quite, there is a diode between the power jack and Vin, so if you feed the power jack and draw current from Vin it has to flow through the diode. Not only that but it also has to flow through the thin tracks on the PCB. I suspect those tracks and the diode will go up in spoke if you power a motor through them.

1 Like

Ohhh okay... I thought it would protect the digital pin from voltage spikes (Sorry, never used them before and im really new) . I saw an example here:


If i use the ground (Number 2 optocoupler) at another ground pin at arduino, would that help? isnt the ground pin at arduino the same as the ground of power source?. Anyway i think i wont use an optocoupler.

I searched from youtube (https://www.youtube.com/watch?v=7EpJ0fR5_cQ&ab_channel=HamedAdefuwa) and from my understanding if we use 12V for the gate of the IRLZ34 the voltage would need to go back to about 2 Volt to turn off the transistor. So its faster for IRFZ34 to turn off the transistor since it only needs to go down to 5 volt.

Yeahh i though soo. Didnt know they had diode too. Thanks for all your help! it helps my understanding of electrical circuit practical application. I think i will stick to my design from before.

Ok, I like that you are thinking about this, well done for that.

Read this: Flyback diodes and why you need them
The diode gets rid of the spikes. Also, in a MOSFET the gate is isolated from the source - drain anyway, so there is little or no opportunity for noise to get to the micro-controller pin in normal operation. You are trying to fix a non-problem.

Your new schematic with the 2N2222 is no good because you don't have the diode across the motor and the maximum current for a 2N2222 is 600mA, well below the 2A you want.

No, they are all the same and there is no help to be had because it's an attempt to fix a problem that does not exist.

I've not watched the video, from your description I'm not sure I want to. The gate of a MOSFET is a small capacitor. Capacitors in series with resistors charge and discharge according to some maths I have forgotten (some homework for you, find the equation), however I can remember 2 important things: Rule of thumb is it takes 5RC seconds to (dis)charge a capacitor through a resistor. This is not strictly true but it's close enough for most practical purposes. So look at the gate capacitance from the data sheet and the resistance used for charging it and do the maths. The other thing is that current, voltage, time and capacitance are related by 1. What I mean is that if you (dis)charge a 1F capacitor with 1A for 1 second then the voltage across it will change by 1V. Note I said 1A, not a particular value of resistor, I mean a 1A constant current source, which you don't get with a resistor.

If you mean the schematic in reply #9 then yes, do that.
However, if you want to learn there's no harm in building the other circuits to experiment and compare them, if you are interested. An oscilloscope would help a lot.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.