DC motor making arduino reset

I am making a doser for my fish tank using an Arduino Nano and this dosing pump.

http://www.ebay.com/itm/321939780612?_trksid=p2057872.m2749.l2649&var=510882555830&ssPageName=STRK%3AMEBIDX%3AIT

I'm using a 12V, 1A power supply connected to both the Nano and dosing pump. When the dosing pump comes on, the Nano jumps back to the start of the sketch. Without the dosing pump connected, the sketch runs fine operating the optocoupler relays as expected.

I read somewhere that a diode can help, so I connected a 1N4148 diode to dosing pump ground, then turned the diode around-did the same to dosing pump +, but that did not help.

I wondered if you guys could maybe help figure this one out...Here's the sketch I cobbled together.

unsigned long minutesInMs(int m){ 
  return m*60000;         //values will be expressed in minutes 
 
} 

unsigned long secondsInMs(int s){ 
  return s*1000;          //values will be expressed in seconds
} 

 
void setup() {
  
  pinMode(9, OUTPUT);       //pins 9 and 10 on arduino are connected to relays to control mixing pump and dosing pump
  pinMode(10, OUTPUT);
}


void loop() {
  digitalWrite(10, LOW);    // turn dosing pump off
  digitalWrite(9, HIGH);    // turn mixing pump on using a NO relay
  delay(secondsInMs(20));   // let mixing pump run for 20 seconds, or long enough to create kalk slurry    
  digitalWrite(9, LOW);     // turn mixing pump off
  
  digitalWrite(10, HIGH);   // turn dosing pump on using another NO relay      
  delay(secondsInMs(3));    // let dosing pump run only briefly to prevent a precipitation event
  digitalWrite(10, LOW);    // turn dosing pump off 
  delay(secondsInMs(5));    // leave dosing pump off briefly to allow slurry to dissipate
  
  digitalWrite(10, HIGH);   // same as above, this just spreads out the kalk slurry.      
  delay(secondsInMs(3));
  digitalWrite(10, LOW);   
  delay(secondsInMs(5));
 
  digitalWrite(10, HIGH);   // same as above.      
  delay(secondsInMs(3));
  digitalWrite(10, LOW);
  delay(secondsInMs(5));

  digitalWrite(10, HIGH);   // almost same as above.      
  delay(secondsInMs(3));
  digitalWrite(10, LOW);    // turn dosing pump off 
 
  delay(minutesInMs(30));   // in 30 minutes, the mixing pump turns back on and the loop function repeats itself again and again and again...
}

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

We have no idea how you have the motor connected to the NANO, what is the current being drawn bt the motor?

Thanks.. Tom... :slight_smile:

The power supply can't supply the startup current of the pump, so the voltage is dropping. That is causing the Arduino to reset. A possible fix is a diode and capacitor between the motor and the Arduino, as shown here.

It's still causing the nano to reset.

Here's how everything is hooked up. Did I get the cap and diode right? I used a 1N4148 diode-is that heavy duty enough?

Thanks guys.

kalk slurry.pdf (283 KB)

saltyjoe:
I used a 1N4148 diode-is that heavy duty enough?

No.

1N4004 (etc.)

In addition to the 4004 diode you could try a larger capacitor (3300 uF).

The problem is really the motor power supply. It could actually be shutting down completely and resetting after a short period.

Unfortunately the seller doesn't give you any information about the motor current draw, but it could be anywhere between 2 and 20 amperes at startup.

Try measuring the stall current at low voltage (at say 3V, with the motor shaft locked). Then multiply by 4 for 12V.

Hi.
Do you have a DMM, you need to measure the 12V the supply and see what it does when you turn on and try and run the motor.

What is the Opto, what are its specs?
Please re draw your "circuit diagram" and include pin numbers etc.

Have you measured the motor current?

Tom..... :slight_smile:

"The problem is really the motor power supply. It could actually be shutting down completely and resetting after a short period."

Do you mean my 12V power supply or something built into the motor? I'm getting the same results using a 12V 2A power supply as the 12V 1A power supply.

Here's the opto;

http://www.ebay.com/itm/4-Channel-12V-Relay-Module-Coupling-Optocoupler-High-Trigger-For-MCU-Arduino-/231429969189?hash=item35e24d1525:g:An4AAOxy4c5Rw-w-

In case the link won't work, here are the optp specs.

High Level Trigger.
•12V 4-Channel Relay interface board, and each one needs 50-60mA Driver Current.
•Equiped with high-current relay, AC250V 10A ; DC30V 10A.
•Standard interface that can be controlled directly by microcontroller (Arduino , 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic).
•Indication LED’s for Relay output status.

I decreased voltage to 2.89-2.94V using resistors on the 12V +, but it was not enough to turn the motor.

I did not see a voltage spike when the motor was turned on, just a steady 12.1V. Also, saw no current spike. Amps were mostly around 0.39-0.43A. I let it run for half a minute and saw a quick 0.52 and a quick 0.36. This is with the pump head attached.

I took the pump head off and without a load on the motor, the sketch ran as expected. (That was with three caps)

I now have four 1000 uf caps in parallel and a 1N4007 diode. With the pump head attached, it's still causing the nano to reset after the pump runs a single 3 sec cycle.

I have some 1N5822 diodes-is it worth a shot to try one?

Here's a diagram showing the caps. I left the mixing pump out because it's not causing me any grief. I disconnected the mixing pump from the circuit until we get the dosing pump sorted out.

Thanks all.

kalk slurry with caps.pdf (303 KB)

Please measure the motor stall and full load running current.

Hi,

Can you post a picture of your project please.

Also if you are using the 4 relay board, please draw you diagram to show it, at the moment you are just showing an opto-relay, the relay board would be better in your diagram with pin names.

Thank you.. Tom.. :slight_smile:

Here's a pic-I know she aint real pretty-what the heck, it's a bench test!

If I were to include the other three opto relays on the diagram, one would have a note that said for future use and the other two would have a note that said they will never be used. I can do that if you want...Every single connection is accounted for and nothing is not shown.

I apologize, but I'm not sure what DCA setting my DMM was on for the former test. This time it was set at 10A.

With the pump head removed and motor under no load, I got 0.03A whether the pump was running or not. The sketch ran as expected.

With the pump head installed, I got 0.03 at startup and run, but as the motor stopped there was a spike that seemed to follow a general up and down pattern. It reset the nano every time. Here are 27 reads, in order.

0.36, 0.80, 1.46, 2.16, 3.97, 2.89, 0.29, 0.51, 1.06, 1.79, 3.19, 3.29, 1.24, 0.36, 0.60, 0.82, 2.19, 4.10, 3.26, 0.27, 0.40, 0.67, 1.54, 2.47, 4.29, 1.36, 0.32, 0.59

This seemed strange to me but with the motor shaft locked, I got a steady 0.03.

Now it sounds like the problem is due to the inductive shutoff spike.
Add a flyback diode across the motor (1N400x), banded end toward V+ as shown below.
flyback.png

This seemed strange to me but with the motor shaft locked, I got a steady 0.03.

Something is wrong with the measurement -- that can't be correct.

BTW on this forum we always argue that it is best to power motors separately. Your experience is a textbook example!

That flyback diode did the trick! Thank you!

I very much appreciate your time and expertise solving this for me.

IDK if it's good or bad to be a textbook example, but now I can see why a dedicated power supply makes sense. For this, a diode makes more sense to me than a second power supply.

I just found that I can't check conductivity on my DMM-I must have fried something today checking for current. That probably explains the bad reading for the locked shaft.

Thanks again, thanks all.

You probably blew the internal current overload fuse on the DMM. Open the back to check.

Yep, the fuse blew, but not quite quick enough....something a little deeper got fried too. Oh well, a new DMM is on the way. Thanks!

It turns out that the flyback diode works sometimes on this motor and sometimes not. I tried a beefier diode...The argument for a dedicated power supply is a good one! Anyway, a 9V wall wart seems to operate the nano and 12V opto relays.

I learned some good stuff and it was fun-thanks.