Controlling 16 DC Motors with an Arduino Uno

Hello everyone,
For a project I am working on, I am having some difficulty figuring out how to control 16 identical dc motors using an arduino uno. For each of these 16 motors, the operating voltage is between 3V-9V and each one has a no-load current of 30 mA and a stall current of 500 mA. I want to be able to operate the dc motors at close to 3V because the motors are described to operate at around 48 rpm at this voltage which is ideal for my project. Regarding speed control, I do not need to control the speed of any of the motors and only need them to run forwards and backwards. I do however need to control these movements independently for each motor. Sorry I am very new to arduino and do not completely understand how to approach this situation and would appreciate any help. From what I have seen in other similar projects, people have talked about using interfaces likes the TLC59711 to expand the amount of PWM channels which from my understanding are used to control aspects such as motor speed, which is not necessary in my situation, which is also why I am confused about what motor driver to use. If possible, it would also be extremely convenient to use as few motor drivers as possible to handle the 16 dc motors independently for the sake of cost. I understand that this would also mean I would have to use an external power supply for the motor driver(s) however this I think would be dependent on for what load the motor drivers are rated for. I have also tried to look at arduino shields that might suit my application however many I have seen are only capable of controlling 2 dc motors. Unfortunately I am very limited in terms of size so that the components such as the motor drivers among others would ideally take up as less space as possible. Previously I had tried to use servos in place of dc motors for my project however I had to switch to using dc motors because I was not able to find servos small enough to fit inside a 0.75" x 0.75" x 0.75" box, else I would have used servos for they seem easier to use with arduino. I greatly appreciate any help with my issue, thanks.

Also in case it helps, here is the link to the motor I am looking at: Micro DC Geared Motor 6V 112RPM-DFRobot

To drive a DC motor in two directions, you need an H-bridge. An H-bridge has two inputs: if one input is high and the other low, the motor will turn in one direction, if the other is high, and the first low, it will turn in the other direction. If the inputs are both low or high, the motor will be off. To drive 16 motors, you'll need 32 digital outputs, an Uno only has 20. You can use simple shift registers to get those 32 outputs, using only three pins of the Arduino. You could use four 74HC595's for example.

Pieter

Dude! Have you ever heard of a paragraph? That's hard to read/comprehend!

For each of these 16 motors, the operating voltage is between 3V-9V and each one has a no-load current of 30 mA and a stall current of 500 mA. I want to be able to operate the dc motors at close to 3V because the motors are described to operate at around 48 rpm at this voltage which is ideal for my project.

You'll need an appropriate (~3V) power supply with at least enough current capability to run all of the motors. Proper design would allow for the full stall-current (which may happen at start-up, even with no load) and if you're running all of the motors at once that's 8 Amps. In reality the motors probably won't use 500mA with the reduced 3V, so you can take some "risk" with a smaller power supply if you want.

Test the motors (all of them) to make sure they start-up at 3V... Sometimes it will take a voltage "kick" or a mechanical push to get them started at reduced voltage. If they need a higher-voltage to get them started, you'll need PWM (and a higher-voltage power supply).

Also, check that "48 RPM" on all 16 motors. The speed will vary (with the same voltage) and you'll have to confirm that it's close-enough for your application.

You'll also need 16 bi-directional motor drivers. An Arduino I/O pin can only supply 40mA "absolute maximum" which is about enough to drive an LED or two, but not a motor. You can build the circuitry or you can buy 16 "H-driver" boards.

I do not need to control the speed of any of the motors and only need them to run forwards and backwards. I do however need to control these movements independently for each motor.

The Uno has 14 general-purpose I/O pins plus 6 analog input pins which can be configured as regular digital I/O pins. (Not enough).

Basic digital logic means each I/O pin can have two states. Motor on/off requires one signal/pin and direction requires another pin. So, you need 32 pins to control 16 motors. Do you need any other inputs/outputs?

PWM doesn't require any additional pins (one pin controls speed, including zero-speed and full speed). That's assuming no speed-feedback. But, the UNO doesn't have 16 PWM pins and PWM expansion isn't "easy".

I'm not implying that an L293D is what you need, only that it illustrates what is needed - unless you're up to building your own with discrete components. This part is included in the Arduino starter kit and is used to control speed and direction of a DC motor. The speed is controlled via PWM pulses to the L293 enable pin(s). Since you're only interested in on/off operation you could drive the motor enable with a digital output.

Sixteen motors requiring three control inputs each = 48 outputs. Obviously the Arduino can't do this unaided. I'd suggest that you'll need a string of 8-bit shift registers. How many?

16 motors each requiring three control inputs to the L293s = 48 shift register stages. Each HC595 holds eight stages so, six 74HC595 ICs. And eight L293D H-bridge ICs to receive the s.r. signals.

There are many choices in prototyping boards to build the circuitry on.

On the software side this will require your sketch to

  • assemble the entire 16-motor on/off/direction state EACH time a change is to be made.
  • push everything out to the shift registers with clock and data signals
  • latch the data into the s.r. for presentation to the H-bridges

And, if there's any chance of more motors being needed in the future, account for it now.

YMMV

https://www.pololu.com/product/2135

Hi,

Hello everyone, For a project I am working on, I am having some difficulty figuring out how to control 16 identical dc motors using an arduino uno. For each of these 16 motors, the operating voltage is between 3V-9V and each one has a no-load current of 30 mA and a stall current of 500 mA. I want to be able to operate the dc motors at close to 3V because the motors are described to operate at around 48 rpm at this voltage which is ideal for my project. Regarding speed control, I do not need to control the speed of any of the motors and only need them to run forwards and backwards. I do however need to control these movements independently for each motor.

Sorry I am very new to arduino and do not completely understand how to approach this situation and would appreciate any help. From what I have seen in other similar projects, people have talked about using interfaces likes the TLC59711 to expand the amount of PWM channels. Which from my understanding are used to control aspects such as motor speed, which is not necessary in my situation, which is also why I am confused about what motor driver to use. If possible, it would also be extremely convenient to use as few motor drivers as possible to handle the 16 dc motors independently for the sake of cost.

I understand that this would also mean I would have to use an external power supply for the motor driver(s) however this I think would be dependent on for what load the motor drivers are rated for. I have also tried to look at arduino shields that might suit my application however many I have seen are only capable of controlling 2 dc motors. Unfortunately I am very limited in terms of size so that the components such as the motor drivers among others would ideally take up as less space as possible. Previously I had tried to use servos in place of dc motors for my project however I had to switch to using dc motors because I was not able to find servos small enough to fit inside a 0.75" x 0.75" x 0.75" box, else I would have used servos for they seem easier to use with arduino. I greatly appreciate any help with my issue, thanks.

Also in case it helps, here is the link to the motor I am looking at: https://www.dfrobot.com/product-1339.html

Sorry but had to itemize it to read it. If all you need is FWD-STOP-REV and speed control then two outputs per motor will work. A PWM mutliplexing IC, like TLC59711 will help to a H-Bridge, or a MOSFET and DPDT Relay for each motor.

You need to do a block diagram of your project, showing the motors and their drivers and controller and power supply, to see what is needed in I/O and hardware.

What is the application?

Thanks.. Tom.. :)

Thank you everyone for your replies as they are very helpful. Also TomGeorge, I will be using these motors for a robotics project to make the fingers on a hand flex and relax with the ability to use the motors' torque to apply much force.

Regarding the motor driver Wawa suggested, I was looking through the other 2 channel dc motor drivers the pololu website carried and found a similar model called the DRV8833. Although the DRV8833 seems to be a bit larger, wouldn't this model be easier to use because of no need for an external power supply for logic power, unless that could be supplied maybe in parallel with the external power supply I would already be using to power the motors. And for my purposes, what would the logic power be used to do?

Also one difference the website states between these drivers is the DRV8835's inclusion of an extra control interface mode which I think might be part of their phase-enable mode, however I do not know what this means or whether I would need that option to do anything beyond tell the motors to stop, run forwards and backwards.

I also should have specified any other pins that might be occupied with other non-motor tasks, which are to operate 2 myoware sensors, 14 force resistive sensors, 5 flex sensors, and a servo. I think this will require 2 analog pins for the myoware sensors, 14 analog pins for the force resistive sensors, 5 analog pins for the flex sensors, and 1 digital pin for a servo I will be using.

I was thinking about using a digital and analog io expander shield (such as this one:https://numato.com/digital-and-analog-io-expander-shield/) because as I understand it, each one of the DRV8835/DRV8833 drivers would require 4 digital pins, and because each driver has 2 motor channels and I am operating 16, I would need to use 8 drivers which means 32 digital pins. I know PieterP suggested using switch registers to expand the amount of digital outputs but wouldn't using the shield be easier? I think the amount of pins the shield offers would be okay because collectively, I would require 21 analog and 33 digital pins, and the shield offers 28 + the arduino's 12 digital pins I could use, and 16 + the arduino's 6 analog pins.

Would it be appropriate to use the shield in this way, and for external power, would I be able to use the external power supply for the motors to provide the logic power if I went with the DRV 8835? Also, I would need to power all of the driver boards using a parallel circuit with my external power supply to maintain voltage right? Thank you again.

Hi,
I’m not sure if you have looked at the major difference between servos and DC motors in your application.

With servo control, you have position control, you do not need feedback to know where your output is.

With a DC motor, you have speed control, will not know position of the output.

Tom… :slight_smile:

I understand, however despite the extra difficulties that come with operating dc motors I think the hassle may be worth it for it is difficult to find servos that offer the same amount of torque especially at the some of the smaller sizes and shapes that dc motors come in. While I will have to test whether the amount of torque the servo I have in mind offers (0.27 kg/cm) is enough for my application, I think that dc motors also being able to rotate continuously might be more effective however I will have to test this but I think I will ultimately choose this option. As far as dc motor setup is concerned however, I appreciate any help regarding my last post as I am still confused about the best route to take with dc motors. Thank you again.