I'm working on a project that is essentially three motorized raising shelves. I would like to have each shelf have a corresponding switch for raising and lowering. Is it possible to have three or four dc motors with corresponding switches on one Arduino? When doing my own research on this matter, I've found many tutorials explaining how to use an L293d to run up to four motors at once, but not several motors individually running when programmed. Any help would be greatly appreciated. Thanks!
One can control many motors at once with an Arduino. How many depends on the Arduino board, the motor drivers and how the motors are controlled. To just turn a motor on and off with no speed control, a single digital pin driving a transistor would be used. To control a motor speed in one direction, use a transistor driven by a PWM pin. To control speed and direction a PWM pin and a digital pin (2 pins per motor) to control an H bridge driver.
DC motors require external power supplies. Arduino boards cannot supply the current required by a motor.
The L298 motor driver is an ancient and inefficient motor driver. There are much better motor modern MOSFET output drivers available. Pololu has a good line of motor drivers.
If you need speed control then an Uno has 6 PWM outputs. If the motor drivers have digital control for FWD and REV then you could control 6 motors. However many motor drivers need one PWM signal for FWD and another for REV and in that case an Uno could only control 3 motors.
You could use external logic chips to steer a single PWM signal to either of the the two motor driver inputs but if you need to control more than 3 motors with 2 PWM signals per driver it would probably be simpler to use an Arduino Mega as it has more PWM outputs.
...R
So now tell us why you think an Arduino has anything to do with your project? ![]()
I appreciate all the help! I've taken your suggestions and done a bit more research and found the L298n motor driver to be quite promising. I've also decided to just use two DC motors instead of the three or four. And as for the question of "why I'm using Arduino?" I'm a mechanical engineering student and I know that I could most certainly do this project without Arduino, but I wanted the practice with coding and wiring because I hope to use Arduino in future projects.
Thanks again!
found the L298n motor driver to be quite promising
Not. That motor driver is ancient and inefficient technology. The bipolar transistor outputs waste 2 to 4+ volts of the motor power as heat. And you cannot trust the specs that the makers of those boards claim. A bag of them might make a good door stop or maybe a (small) boat anchor.
Pololu has a wide selection of efficient modern MOSFET output DC motor drivers. You can trust the stated specs and the Pololu pages have good tutorials on their use.
To get at the "how to use an Arduino to do this" part of the question, there are many ways to skin a cat, but you might look at something like the Adafruit Motor/Stepper/Servo Shield which can drive 4 DC motors forward/reverse. It uses I2C so it only uses 2 pins, you can stack more if you want, and you will learn about I2C for future projects.
No affiliation, I just use these to control latching solenoid valves.
haresfur:
but you might look at something like the Adafruit Motor/Stepper/Servo Shield which can drive 4 DC motors forward/reverse.
I wonder if the motors that raise the shelves need more current than the motor shield can provide?
Motor drivers should be chosen that can comfortably provide the stall current of the motor they are controlling.
...R