3
\$\begingroup\$

I have a small DC motor that used to draw from a 3.7 V lithium battery in a small Chinese made device. I did away with the PCB to use an Arduino UNO with my own programs.

I tried using motor shields, but they output a very weak current to the motor. I ended up buying two as I thought the first one wasn't rated high enough but had the same problem, making me think the UNO was outputting a weak signal from the pins.

I ended up using my own MOSFET with a 10mF capacitor and diode, and finally found an FET that works.

I am using a 5 V / 3 A wall adapter and a buck/boost converter to step it down to around 4 V on the motor. The same supply is connected to the Arduino.

My problem now is: It appears when the motor is under too much strain and is stalling, my Arduino resets. I don't know if this is run off current from the motor going back to ground and it's a self-preservation of the Arduino, or something from excess current, or if it's some other power related issue, where not enough current is getting to everything, there is a dip and it shuts off.

Just wondering what might be the cause and if it's an easy fix, or if it is a good thing that it resets, so I don't kill the Arduino when stalling my motor?

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Welcome! Please post a schematic. \$\endgroup\$
    – winny
    Commented Jul 13 at 11:39
  • 2
    \$\begingroup\$ It is not a good sign when a stalled motor causes a reset. To see why it is resetting, you need to post a schematic diagram of your setup and links to the datasheets of the motor controller, the motor, the power supply, and the buck/boost converter. \$\endgroup\$
    – JRE
    Commented Jul 13 at 11:57
  • 2
    \$\begingroup\$ measure the voltage when the motor stalls \$\endgroup\$
    – jsotola
    Commented Jul 13 at 16:27
  • \$\begingroup\$ Using a multimeter, measure the resistance of the motor. Measure the resistance at the wires going to the motor while manually changing the motor position, until you figure out the pattern, then add that info to your question. \$\endgroup\$ Commented Jul 14 at 3:03
  • 1
    \$\begingroup\$ Stalled motor is short circuit of power supply directly across that resistance, which is tanking your voltage, resetting the Arduino. \$\endgroup\$ Commented Jul 14 at 3:07

1 Answer 1

1
\$\begingroup\$

If the motor draws too much current (which is at a maximum when the motor starts up, or stalls), then the power supply will be heavily loaded, and you'll see its voltage drop. That's likely to be a problem for everything else using the same supply, like the Arduino.

Since you say your supply is capable of 3A, you shouldn't ever have your motor (or DC-DC converter) draw that much. A more reasonable amount might be 2A, or 2.5A, leaving 1A or 500mA for everything else. Also, this assumes that the label on your power supply isn't lying about how much it can supply. Typically, for consumer supplies, if you draw the reported current limit, there will be a significant voltage drop, to perhaps 4.5V or worse, so I'd be conservative about how much current I'd reserve for the motor. From here on, I'll assume 2A.

Reducing motor voltage would also reduce motor current, so a buck converter could actually solve your problem, but you'd have to calculate what motor voltage would pass 2A with the motor completely stalled. Start by measuring motor winding resistance, which I'll call \$R_M\$. Let's say you measured \$R_M=1.25\Omega\$. Now you can predict what stall current would be, using Ohm's law, if you connected the stalled motor directly across a 5V supply:

$$ I = \frac{V}{R} = \frac{5V}{1.25\Omega} = 4A $$

Obviously that's too much for your supply, having a limit of 3A, and the supply would fail. So you must decide what maximum current you wish the motor to draw from the supply, say \$I_{MAX}=2A\$.

This is where things get a little complex, since the buck converter is not 100% efficient, and its input and output currents will not be equal. The following is not difficult, but it isn't obvious either. Assuming a buck-converter efficiency of \$Q\$, we can relate input and output power for the converter:

$$ \begin{aligned} P_{OUT} &= Q\times P_{IN} \\ \\ I_{OUT} \times V_{OUT} &= Q \times I_{IN} \times V_{IN} \\ \\ \end{aligned} $$

We also know the relationship between output current and output voltage, for the stalled motor:

$$ I_{OUT} = \frac{V_{OUT}}{R_M} $$

plugging this in, we get:

$$ \begin{aligned} \frac{V_{OUT}}{R_M} \times V_{OUT} &= Q \times I_{IN} \times V_{IN} \\ \\ \frac{{V_{OUT}}^2}{R_M} &= Q \times I_{IN} \times V_{IN} \\ \\ V_{OUT} &= \sqrt{R_M \times Q \times I_{IN} \times V_{IN}} \\ \\ \end{aligned} $$

If I use a few example values, \$R_M=1.25\Omega\$, \$V_{IN}=5V\$, \$Q=70\%\$:

$$ \begin{aligned} V_{OUT} &= \sqrt{1.25 \times 0.7 \times 2 \times 5} \\ \\ &\approx 3V \\ \\ \end{aligned} $$

That's the voltage you'd require your buck-converter to output, if you wanted the current drawn from the 5V power supply to remain at or under 2A even when the motor is stalled or heavily loaded.


What I show below is a way to actively measure and limit motor current, and automatically produce the correct voltage, without a DC-DC converter:

schematic

simulate this circuit – Schematic created using CircuitLab

Resistor R1 senses current, switching on Q2 when the voltage across it reaches 0.7V. That pulls Q1's gate towards ground, tending to switching it off, and an equilibrium is obtained in which current settles at a little over 2A.

R1 removes about 0.7V from the motor's supply, so that under load it won't see more than 4.3V or so. That might even remove the need for a DC-DC converter, which is why I powered this directly from +5V.

For completeness, here's a similar throttle at the high-side, which would require an extra transistor:

schematic

simulate this circuit

In both cases Q1 will dissipate about 8W under stall/start conditions, but as long as those are short-duration, that shouldn't be a problem. If those conditions last longer than a couple of seconds, you'll need a beefy heat-sink on Q1.

The current limit will be:

$$ I_{MAX} \approx \frac{0.7V}{R_1} $$

Don't forget D1, which will protect your MOSFET (and Arduino) from the motor's inductance.

\$\endgroup\$
8
  • \$\begingroup\$ Thank you all for the kind help, espcially in suppling diagrams. Perhaps I should have listed the specifics of my circuit and the components. I'm a bit of a noob with electronics and using R as voltage dividers has always perplexed me, hence using a buck/boost to throttle voltage with trial and error by turning a screw. The motor seems to need more voltage for the same power output as the 3.7v battery gave, I'm not sure why. I will look at this in closer detail when I come back as I'm off out now for the day. Thanks all \$\endgroup\$ Commented Jul 14 at 12:42
  • \$\begingroup\$ So just to confirm, the buck/boost only affects voltage, but the motor that is being strained to a stall would pull in excess current until the same supply that powers the Arduino would struggle to power everything, even with my voltage limited feeding the the motor. And the resistor method above would divide the amps to limit what is being fed to the motor no matter what? I will have to try modifying my circuit and see what happens. Thanks for the help. \$\endgroup\$ Commented Jul 15 at 12:05
  • \$\begingroup\$ @DannyAkuma Reducing motor voltage would also reduce motor current, so a buck converter could actually solve your problem. It would also be more efficient that my two current limiter examples. I've added the procedure to calculate converter output voltage required to stay within the supply's capabilities. \$\endgroup\$ Commented Jul 15 at 13:44
  • 1
    \$\begingroup\$ @DannyAkuma the "resistor" method is just throttling current "no matter what" as you say, but it is not "dividing amps", like a voltage divider divides volts. This is a very different principle. \$\endgroup\$ Commented Jul 15 at 13:48
  • \$\begingroup\$ Thanks so much for your help Simon, reading back through your detailed plan of action a lot of it is lost on me as I'm very maths challenged and a noob at electronics in general. I tend to brute force my way into getting things to work the way I want with overkill, guesswork, throwing money at it and trial and error. It's just how I work rather than use too much brain power, so I appreciate the effort to explain things to me. I'm just not that good with this stuff, which I find to always be far more involved than I have time to fully commit to, since my time is always very divided. \$\endgroup\$ Commented Jul 15 at 22:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.