submersible motor not firing

I'm having trouble getting my Nano to power the 3v-5v submersible motor. I had instruction about wiring up through a transistor 2n222 and 4.7k resistor but for some reason is not firing. The serial monitor says the pump turns on and I have it running for 5 seconds... so it should turn on.

Could I the that I am wiring it incorrectly? Or maybe the motor is bad? Can just connect the motor to the 3.3v or 5v output on the nano to test, or will this burn out the motor? Perhaps instead directly to a power source (since it takes 100-200ma according to Amazon).

Thanks for the guidance!

Your Nano can't drive a motor directly. You'll need to provide external power for it.

The 2N2222 transistor base resistor should be more like 180 to 220 Ohm's and like wildbill says, you need an external power source for the motor. Also there should be a flyback diode across the motor to protect the transistor from back EMF.

Are you sure you have the PN2222 connected correctly? Looks backward to me.

If that is a 12 volt pump consider dropping the 2n2222 and going for a MOSFET approach.

Some of those pumps can draw a good current which may fry the puny 2n2222.

Use 150 ohm resistor for the base of the 2N2222 and you'll be able to drive about 600mA fine.

Amazon are lying to you, the 100--200mA rating is not the max current / stall current and
isn't a useful number for anything but battery life, stall current is always what you need
to design a driver circuit, and motor specifications should be quoting stall current always...

I suspect this motor wants more like 1..2A stall current but you may be lucky with the 150
ohm resistor.

A logic-level MOSFET with 0.1 ohms on-resistance or less will be much better.

Hi Everyone, I am very grateful for your responses. It is really nice to know there is an active community for microcontrollers, especially since I spent some time this weekend figuring out what a transistor actually does..!

So, first I must admit that I used a 2N3904 instead of a 2N222. From what I gather I can go up to 1A on the 2N222 but only 200mA on the 2N3904... so that may be my first mistake. However, the pump is 3v-5v and 100mA to 200mA, so even then I should be good, no?

Pump: https://www.amazon.de/-/en/gp/product/B07QGW5HHB/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

@wildbill - My understanding is that with these pump specs, the +5V output should be able to handle this as it is hooked up to a transistor. I know the IO pins are max 20mA, but the +5V pin is 500 mA when powered via USB and 1A when powered via VIN with >1A 5V Power Supply.

JCA34F - When the flat side is facing me, I understand it is EBC. But your diagram says the opposite. So I am not sure.

@ballscrewbob - I am going to run to the store and see if they have a MOSFET because it is something I didn't get in my "starter pack" and I read a lot about them this weekend. I will also pick up a relay. Good to have the right supplies to keep moving along the learning curve.

@groundfungus . Check on Flyback diode. Will hook up as pictured here, although I don't really get how that could work. I'll just take your word for it (for now). Luckily I have a few 1N4007s in my little kit.

I'm trying to figure out how you got to 180-220 Ohm resistor for the base. I'm seeing (on my PN2222 data sheet) that I have a Hfe of

minimum 35 @ Vce=10V, Ic = 0.1mA, and
minimum 100 and maximum 300 @ Vce=10V Ic=150mA

My (likely false) logic is that I need a maximum 200mA running through my transistor (Ic), and my gain is 100, then I need 2mA on my base current (Ib)? So 5V/.002 = 2500.

I'm looking forward to another late night! Thanks Everyone

MarkT:
Use 150 ohm resistor for the base of the 2N2222 and you'll be able to drive about 600mA fine.

Amazon are lying to you, the 100--200mA rating is not the max current / stall current and
isn't a useful number for anything but battery life, stall current is always what you need
to design a driver circuit, and motor specifications should be quoting stall current always...

I suspect this motor wants more like 1..2A stall current but you may be lucky with the 150
ohm resistor.

A logic-level MOSFET with 0.1 ohms on-resistance or less will be much better.

Hi MarkT,

Thanks for your response. Sorry, I was preparing my response as you posted. I guess you know exactly what pump I was talking about anyway! I'm going to run to the store now and grab that MOFSET you suggested.

I'm trying to figure out how you got to 180-220 Ohm resistor for the base.

I pick that resistor to give the most base current that i can so that the transistor is hard in saturation. The current that I can give the base is limited by the recommended current out of a Nano output. That is 20mA. 5V / 0.02 = 250. Next lowest standard resistance is 220 or 180.

MOSFET driver.

Gate resistor to limit current while charging the gate capacitance. Arguably, optional.
Pulldown to keep the MOSFET off during reset.
Cap across motor optional.
Diode NOT optional.

MarkT:
I suspect this motor wants more like 1..2A stall current but you may be lucky with the 150
ohm resistor.

I tested it with the Multimeter and got 80mA when running dry and max 120 mA when running with water. Blocked both the hose and the water intake and it didn't cause a stall (I guess because it is just running dry and not creating any suction)... But no where close to the 1.2 A. Unfortunately there isn't much data on these pumps as they are generic white label

groundFungus:
Gate resistor to limit current while charging the gate capacitance. Arguably, optional.
Pulldown to keep the MOSFET off during reset.
Cap across motor optional.
Diode NOT optional.

Apologies if this quick photo and messy layout is taboo.
I got two MOSFETS (STP16NF06L and IRLZ44NPbF) and they both look to be up to the job. I use the IRLZ44NPbF.
As provided in your drawing, I added a flyback diode and a 104 capacitor.
Unfortunately my Nano is soldered to a PCB and I'm having trouble getting the old BJT out of the way. So I thought I could use this ESP32 instead. I'm hoping that the 3.3V IO pin that I am using for the gate will be enough to saturate the MOSFET, and more importantly if I'm crossing voltages here... otherwise I would think I could run the pump off the 3.3V of the ESP32 instead of being off my power source (assuming my previous multimeter figures are accurate).

yes, it is my first

groundFungus:
Cap across motor optional.
Diode NOT optional.

Hi groundFungus,
Thanks for the diagram. I understand now Faraday’s Law and the purpose of the flyback diode… but why the capacitor?

The cap can prevent high frequency noise from arcing brushes from getting on the motor power supply.

kalkulate:
I'm trying to figure out how you got to 180-220 Ohm resistor for the base. I'm seeing (on my PN2222 data sheet) that I have a Hfe of

minimum 35 @ Vce=10V, Ic = 0.1mA, and
minimum 100 and maximum 300 @ Vce=10V Ic=150mA

Hfe is not relevant to using a transistor for switching, as a switching transistor uses cutoff and
saturation regions of operation, not the active-forward region for which hfe is relevant.

[in active forward the base-collector junction is reverse biased, which you definitely don't want
for switching as the transistor will dissipate loads of heat]

My (likely false) logic is that I need a maximum 200mA running through my transistor (Ic), and my gain is 100, then I need 2mA on my base current (Ib)? So 5V/.002 = 2500.

Use "base current = 0.1 x collector current" for a BJT in switching circuit and you'll be good.

I'm looking forward to another late night! Thanks Everyone

Thanks GroundFungus and Mark T for getting back to me. Now that this is running I out of the hardware side for a bit and working on getting sensors connected over the internet... but that is for another topic !

MOSFET firing beautifully - thanks.

I am running this on an ESP32 DEVKITC v4, which uses 3.3V. However, I'm powering with USB.

The motor has a peak draw of 207 mA on 5v when I tested it extensively. It's a membrane pump that does 3v-6v.

I've am powering it off of the 3.3v pin of the ESP32 at the moment. It runs... haven't tested it longer than a few seconds and without any tubes/water hooked up.

I could also hook it up to the 5V pin.. does anyone know if that feeds directly off the USB or does it go through the onboard voltage regulator?

Thanks for tips. I know, I know.. best would be to run it directly off it's own power supply, but USB is very convenient..

kalkulate:
I tested it with the Multimeter and got 80mA when running dry and max 120 mA when running with water. Blocked both the hose and the water intake and it didn't cause a stall (I guess because it is just running dry and not creating any suction)... But no where close to the 1.2 A. Unfortunately there isn't much data on these pumps as they are generic white label

Blocking the input of any pump or fan just makes a vacuum for the impeller to run in. Basically NO LOAD. Blocking the output will load the pump/motor so you can approximate the stall current.
Paul

ahha, I'll test that in the morning, thanks Paul

Another way to estimate the stall current is to measure the motor winding resistance and divide the motor supply voltage by the measured resistance. Take several measurements rotating the motor a bit between readings. Use the lowest reading in the calculation.