control 4 stepper motors with Arduino

Here is my situation:

For my project I need to control 4 stepper motors individually, but I want to keep the Electronics as simple as possible.

Components:

  • 28BYJ-48 ULN2003 5V Stepper Motor
  • ULN2003 Driver Board
  • Arduino UNO

My question is:
Can I connect the driver boards as I did in the picture, and just power the boards individually when I need the motors to rotate, since they all have to rotate at the same speed? Or is it easier to just use an Arduino Mega and connect all motors seperately?

This is my first post by the way so please tell me if I did something wrong.

You write about individual control but the picture tells the opposite. They are independent to 0%.
Decide what You want.

Wow, great first answer -.-
The question is, is possible to use the motors individually by powering the individual driver boards?
For example: I want to rotate the first motor. If all 4 driver boards are powered, all motors would move. But what if I can control which board to power?
As I mentioned I am new here and I don`t have too much experience with arduino.

Stepper motors need power all the time to maintain their position, their holding torque.

So if they are not powered they would basically be "loose"?

Yes.

An arduino can control a bunch of steppers. It can't power them though - you need a separate supply.

So I would have to use an Arduino MEGA, since the UNO only has 14 I/O pins.

  • seperate 5V power supply

You need drivers that handles the current to the steppers. Changing to a Mega makes nothing to that.
The controller sends out Direction and Step, for each motor. That uses 8 outputs.

As I mentioned in my original post, I am using ULN2003 driver boards, each one takes up 4 pins. That would be 16 pins in total just for the motors.

student_rl:
As I mentioned in my original post, I am using ULN2003 driver boards, each one takes up 4 pins. That would be 16 pins in total just for the motors.

Not really. Two of those pins are probably power and ground. Those come from the power supply, not the Arduino. PS ground and Arduino ground should be connected too. You may have an enable pin on the driver; you can just tie it high or low depending on what it needs. No need to use Arduino pins for each one.

student_rl:
So if they are not powered they would basically be "loose"?

It's not quite that simple with the 28BYJ-48 motors. There is a lot of friction in the gearbox which MAY hold position sufficiently for your project.

If you don't need a lot of precision then de-powering the unwanted motors may be adequate.

What you are trying to make? It is impossible to give good advice without knowing that.

wildbill:
Not really. Two of those pins are probably power and ground.

The 28BYJ-48 uses 4 signal pins.

Which reminds me that it is possible to control a 28BYJ-48 with two pins and some additional circuitry. See this link. I have not tried it myself.

...R

Ouch. So those nasty drivers are just a set of Darlingtons? Can't you use something a bit more modern from Pololu? Is there a some reason to prefer such a simple (but pin consuming) solution?

What you are trying to make?

Okay, I will try to explain

I am making an automatic pill dispencer
The wheels inside the drawers rotate, the motor is supposed to sit in the middle of it. (i know that the 28BYJ-48 isnt perfect, its too big, the shaft isnt centered, etc. but its what i have to work with right now)
I have been looking for a smaller stepper motor but I couldnt find anything smaller

Robin2:
Which reminds me that it is possible to control a 28BYJ-48 with two pins and some additional circuitry. See this link. I have not tried it myself.

This is actually quite helpful, i'll look into that

wildbill:
Ouch. So those nasty drivers are just a set of Darlingtons? Can't you use something a bit more modern from Pololu? Is there a some reason to prefer such a simple (but pin consuming) solution?

Nope, no reason, just havent found a better solution :slight_smile: I really just need something uncomplicated
Now I know where to look though, thanks!

first off WELCOME to the Forum !

second, YES, you can do what you want with what you got.

the darlingtons and those steppers are a great match.

third, YES you can just disconnect power to any stepper. think of it like a car on a hill. put it in neutral and what happens ? OK, just pick some flat ground and Bob's Your Uncle. if you are holding up the can of water over your head.... you might want to test what happens first.

also, it is very simple to add an end switch or just make the the stepper run into a brick wall, skip a bunch of steps and then know with a pretty high degree of certainty where you are at that point.

When resistance is greater than force, the stepper stops spinning and magnetically, it just misses steps. does not hurt anything. and it offers a way to create a ZERO without using any more pins.

and to be extra nice to you..I'll tell you more good news. You can use the Analog pins as digital pins. so 16 pins are there for your use and you have a few to spare.

as for the prior warnings. the range of steppers use is much-much broader than we run across in the hobby world. We tend to get tunnel vision and try to make everything fit a mold. if locational accuracy and positioning is important, then, loosing power can miss steps. if a single missed steps messes up your work, it is a bad thing. kind of in that tunnel vision area of things you don't do.

some more to get you a little more aware. you can get some cheap stepper drivers, like the A4988. these take two pins. one tells the motor to step, the other tells it which way. called Step and Direction. so 2 pins and you control one motor.

if your project has all the steppers moving one way, then you can use them and just wire the direction to ground or 5v and it will just step one direction.

back to the darlingtons. it is a little steep for a noob, but there is a thing called a shift register.
with that, you can use 4 pins and it has 8 outputs. then it also has the ability to connect to more shift registers and each one has 8 outputs. a couple of our members, Crossroads for one, [ Wawa for another ] runs a score of those steppers on high power shift registers from I believe, 4 pins.

[ edit correction on the thread
https://forum.arduino.cc/index.php?topic=700458.msg4748881#msg4748881
Wawa was the one who controlled many steppers from one NANO ]

You can do what you want with an Uno, 4 of the small Geared stepper motors and their driver boards, and a small 5V supply.
The Uno can power one stepper with no load, I did a lot of testing that way, and would probably be okay with a load consisting of just pushing one pill. A separate supply would be better tho. I didn't try multiple motors.

I have 16 of those small geared steppers running from a Mega, using 64 pins. The load is only a holiday decoration, very light, so they stay in place when not being stepped (I turn the drive signal off to the ULN2003 board, so the stepper just has 5V on its common pin and then 4 open collector outputs on its 4 coil pins):

I used this for a power supply for 16 motors and a Mega. I think it's probably overkill, but it wasn't expensive.
I use 6 of them, working my way up 6 Megas and 96 motors.
https://www.mpja.com/5-Volt-DC-Plug-Power-Supply-4A-Regulated/productinfo/18520+PS/

1 Like

Just a note but you cannot use chopper drivers with those steppers.

Those motors have a common power lead that feeds both coils.

Those steppers and motors are a matched pair.

wildbill:
Ouch. So those nasty drivers are just a set of Darlingtons?

They work well.

If it works don't fix it :slight_smile:

...R