8 DC Motors and 1 Arduino Uno, Same Speed, On and Off

Hello all,

I'm trying to control 8 different DC motors using 1 Arduino Uno. All the motors will function at the same speed, it's just a matter of turning a specific one on and off.

I originally was planning on using a 1 to 8 demux, but I don't think that the demux can supply a PWM output as they are just logic gates, so they would either turn them on (5V) or off (0V).

I'm also looking for a solution that would use the least amount of pins as I'm using the other pins for other demultiplexers.

I'm a little confused on how to proceed and I'm fairly new to Arduino. Any help would be greatly appreciated!

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html.

What are the DC motors, spec/date link will help.
Do you need direction control or just speed.

If just speed and ON/OFF you can use a serial input/parallel output shift register to control 8 MOSFETs to switch the motors on and off, and off the top of my head use diode switching at the MOSFET gate to apply the PWM.

You will need some control lines for the shift register and the PWM line for the control.

Just an idea, others may be able to suggest other alternatives.

How many pins do you have free to use?

Thanks.. Tom... :slight_smile:

Yes, MOSFET switch for each.

For your PWM: I understand all motors are to move together. If MOSFETs are small enough (gate charge, mostly) you may get away with connecting them all to a single pin. Do use a current limiting resistor on the connection to the gates.

Alternative: a set of non-inverting buffers, each of which controls one or two MOSFETs. Those typically come in sets of six in a single IC.

If that's now what you're looking for: provide more detail. Lots more detail.

Sorry if I didn't include enough detail.

I will be using the P14355-ND motor. I have a circuit made for it including a 2N222 transistor as a switch, a 270 ohm resistor into the base, a 1N4004 into the collector in parallel with the motor to remove effects due to the negative voltage spike from the motor, and the emitter into ground.

I currently have 4 digital outputs (DOs) being used for a 1 to 8 demux (74F138) that I'm using for a 7 segment display with 500 ohm resistors connected in the outputs as current limiting resistors so my display doesn't burn out.
I also have 3 DOs bein used for a 1 to 4 demux (CD4555B) that I'm using to control 4 different valves (the valves I'm still looking at parts for that are small enough for my project).
I have 2 DOs being used for a 1 to 2 demux (SN74LVC1G19) that I'm using to control 2 different LEDs of different colours as indicators for my project.

So I have 11 DO pins being used excluding the pins I need for the motors. I know the arduino uno has 14 DO pins but I know can also use the 6 analog pins as 6 DO pins, I just have to specify it in the code.

So I have 9 DO pins left. I am aware that's enough for the 8 DC motors, but I'm using PWM to use the motor at a certain RPM. I also would like to find a solution where I wouldn't have to use 8 DO pins in case I need more DOs in the future for additions to my circuit.

Edit: I don't plan on running all motors at once, I plan on running one motor depending on what I input into the MCU.

The Uno has six PWM enabled pins, that's not enough for you.

Options:

  1. external PWM board.
  2. software PWM (doesn't seem to work in conjunction with hardware PWM, so you'd have to move all eight to software PWM).
  3. Arduino Mega which has more hardware PWM available.

I have 2 DOs being used for a 1 to 2 demux (SN74LVC1G19) that I'm using to control 2 different LEDs of different colours as indicators for my project.

That demux is then redundant... Just connect those LEDs directly to the output pins.

You could use the Adafruit motor shield V2. That uses only the I2C pins and is stackable, so you can use as many as needed.
On AliExpress cheap clones are available for around 4€ a piece.

If all motors shall run at the same speed, a rotary encoder and PID regulator is required with each motor. This requires more input pins and computations.

You could use three PWM output pins, and three digital I/O pins to control 9 motors.

Simple array using parts you mentioned, just wired differently.

Slumpert:
You could use three PWM output pins, and three digital I/O pins to control 9 motors.

Please do post a circuit diagram of how you think this would work.

Based on the scope described by the OP.

“I’m trying to control 8 different DC motors using 1 Arduino Uno. All the motors will function at the same speed, it’s just a matter of turning a specific one on and off. ”

Here would be my circuit for 8 motors using 3 PWM pins and 3 digital pins.

This allows you to basically switch one at a time. Or a limited selection of groups. Not full control of every single one, and an arbitrary set of motors to run at the same time - they're not LEDs, you can't just matrix it and expect it to work like that.

Your circuit also misses the required current limiting base resistors.