0
\$\begingroup\$

In the past, I've had problems powering an Arduino with a DC motor or servo directly with a 9V battery (batteries dying quickly, brownouts, multiple components don't have enough current to work simultaneously), and I read:

  1. That they shouldn't be powered via the Arduino's 5V pin, but with another power source.
  2. 9V batteries actually suck.

Now I have two projects I want to do, one having a DC motor and another one having solenoids, so I don't want to run in the same problem.

I'm still confused as to -how- I should split power sources, like, should I hook the Arduino to a few AA batteries and motor to some more AA batteries? If so, I don't see how one could create ever tinier devices with tons of hardware features (say a smartphone) while not sitting on a mountain of bulky batteries. I did some research and so I really don't know where to look:

  1. Using a single battery pack
  2. Using a voltage divider (appears to be a bad idea.)
  3. Using a linear regulator (also appears to be a bad idea.)
  4. Using a switching regulator

The thing is, I'm not advanced enough to understand what is being addressed in the above link for #3 & #4; I looked for some diagrams about LM7805 and I stay clueless. Moreover, I find lots of articles where authors (or comments) mention how most of the tutorials we find online are done by people who don't know what they're doing (like using a 9V battery or having no diode around the motor), so I don't really know what to trust.

For size constraints and circuit simplicity, I hope #1 is the right way to go, but whichever is the right solution, I look forward to the community to share their wisdom and if possible, a circuit diagram.

As for the power needs, I'll be using an Arduino Nano, my motor project would have the motor always running, while for the solenoid one it's just going to be activated for less than a second. The motor would probably be this one

\$\endgroup\$
4
  • \$\begingroup\$ I would drop the alkaline batteries and grab a lead acid non-spillable “gel cell”. Easy to charge, 12V which is pretty standard, low source impedance and high capacity. \$\endgroup\$
    – Bryan
    Sep 11, 2022 at 18:34
  • \$\begingroup\$ 9 V batteries don't "suck". Any battery will perform poorly if used for an application which draws way above its design rating. The details will be available on the battery datasheet. \$\endgroup\$
    – Transistor
    Sep 11, 2022 at 18:43
  • \$\begingroup\$ Use one battery, but make sure the battery is strong enough for what you need it to do. The reason not to power it from the Arduino 5V pin is that the Arduino has a voltage regulator on it, and that means you are powering the motor/solenoid through the regulator, maybe overloading it. \$\endgroup\$
    – user253751
    Sep 12, 2022 at 0:30
  • \$\begingroup\$ @Transistor They suck in the sense that they can't provide very much power. For circuits that don't need very much power, they can be just fine. The asker is not making one of those circuits. \$\endgroup\$
    – user253751
    Sep 12, 2022 at 0:31

1 Answer 1

2
\$\begingroup\$

As mentioned in one of your links, the Arduinos are designed to run off of unregulated power. so your #1 solution could just involve using a battery whose minimum voltage under load is more than the Arduino's acceptable minimum voltage. Run the Arduino off the battery, run the motor or solenoid off the battery, but be sure to pick the motor power off before the Arduino gets it's power, to avoid sags and ground loops*.

Motors and solenoids generally don't need regulated power. If you choose a motor or solenoid whose nominal voltage is equal to the battery pack's nominal voltage (i.e., a 6V motor would mate to a pack of four AA cells) then you should be fine. You can even go above or below this, if you're careful.

Motors and solenoids generally make power "dirty": they cause the battery voltage to jump around. It may be a good idea to add some bulk capacitance in the form of an electrolytic cap across the battery -- or maybe not; it depends on how good the regulator is on the Arduino board you use.

If you're running dry cells or NiMH cells, then figure that they'll be useful down to about 1.0V to 0.9V per cell -- so a 4-cell "6V" pack will have useful charge down to about 3.6V if your Arduino can run off of that.

As to regulators -- you may not need them if you can just power everything straight off the batteries. If you do need them, here's the quick guide:

A linear regulator delivers almost as much current to the load as it draws from its source. Because power equals current times voltage, and because energy is conserved, this means that as the difference between the input voltage and the output grows, a linear regulator will have to burn up more power to maintain regulation. As an example, if you give 12V to a linear regulator that's giving you 5V, then 7/12 of the power going into the system is getting burnt up in the regulator. So they can get inefficient (and hot) pretty quick.

A switching regulator -- if it's designed right -- delivers a bit less power to the load than it needs to run. You can reasonably expect efficiencies of around 90% -- 95 or more if someone really worked at it, as low as 70% if someone didn't care, or didn't know what they were doing. A perfect switching regulator that's bucking 12V down to 5V would deliver 12/5 as much current as it takes in (you can calculate that just assuming 100% efficiency).

In the last two decades, switching regulators have become easy enough to design that if you're a reasonably experienced circuit designer, you can just follow data sheet recommendations and get something that works -- but they're beyond the skills of basic hobbyists. Fortunately, you can buy modules that you can just plop onto a board, and these modules are often in the same form factor as a 78Mxx linear regulator with a heat sink -- so even if you only do through-hole and you're not experienced with circuit design, you can still make the regulation work.

* Search the term "ground loop" if you don't know what it means.

\$\endgroup\$
2
  • \$\begingroup\$ Hi Tim, I understand that the arduino and load must be attached to a common ground to work, but what do you mean by "be sure to pick the motor power off before the Arduino gets its power" ? I read this like "disconnect the motor from the batteries before you use the arduino". Or do you mean "don't have the motor send an inductive kickback to the arduino" ? \$\endgroup\$
    – user101874
    Sep 11, 2022 at 19:58
  • \$\begingroup\$ 1: search the term "ground loop". 2: find all the posts you can involving Arduinos and motors, and study them. What I'm talking about is making sure that current to the motor and current to the Arduino don't flow through the same wires, or do so for as short a run as possible. \$\endgroup\$
    – TimWescott
    Sep 11, 2022 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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