Multiple DC motors from 1 pwm

Hello all you wonderful arduinerds,

I am starting an art installation project where I will have roughly 20 dc motors (rather than noisy servos) tapping against various materials in different parts of a large space. These dc motors will be turned on and off when a torch shines upon an ldr beside each motor.

I do not care which direction the dc motors spin, and they can all spin at the same speed.

--------------------------noob question alert-----------------------------------

Is it possible to control lots of motors using one pwm output from the arduino by simply splitting the output signal on the breadboard? Is it then possible to setup switches on the circuit controlled by digital pin outputs which can turn on and off the signal going to each motor depending on readings from each individual ldr?

thanks, Conor B

Basically yes, but it needs some electronics to "amplify" the Arduino signals. The single pin PWM output has to be amplified by a beefy enough transistor or two to take the current load (What is the mA rating of the motors) and then switched by another transistor to the relevant motor. The power to the motors must come from something else than the Arduino.

What will regulate the PWM output, if it is not constant - a special speed sensor/input? (could be the sum of all the LDRs)

The LDRs you need a sort of input circuit - voltage divider. Do you only need On/Off?

You may have some problems if the wires are very long, especially from the LDR to the Arduino. Use some twisted pair (hack/resuse network cables, cut of the plug)

Lastly there is the pincount - 1 digital PWM output, 20 digital switch output, 20 digital(analog?) input = 41. So it has to be a mega2560.

As an alternative, you may consider doing a simple switch with an LDR going to the motor directly and skip using the Arduino all together. It easy to make a PWM/square wave if you need torque at low speed (one little 555 chip). Of course, if your installation requires some logic (like, the motor turns for at least 30 seconds after light has triggered it) then Arduino is the way to go.

Hey Msquare, Thanks for your reply!

I was thinking that I could use the transistor to amplify the PWM signal before splitting that signal and sending it to the different motors, or would I have to have a transistor for each motor after the PWM signal has been sent?

I was planning on having the PWM signal from the arduino run constantly, but a system of switches or gates on the circuit controlled by the arduino to let the PWM signal pass through onto different motors. These switches would be controlled by digital outputs (and yes the arduino will have to perform some logic on the incoming ldr data).

I'm going to voltage divide with the LDR inputs and use the analogue inputs, that part is fine for me to figure out. Wise advice about the long cable runs.

Do you have any recommendations for what I could use as switches/gates that can be used to block or let signal pass depending on the output from a digital pin?

"recommendations for what I could use as switches/gates " 2 input AND gates - 1 input is the PWM output, the other from a bank of shift registers. Any AND gate with a High input from the shift register will let the PWM thru. The output then controls the transistor that "grounds" the motor - pin.