Controller more tha...
 
Notifications
Clear all

Controller more than one stepper motor with the same controller

18 Posts
7 Users
9 Likes
1,209 Views
Ed
 Ed
(@ed)
Active Member
Joined: 10 months ago
Posts: 10
Topic starter  

I am working on a project that involves a number of bipolar stepper motors. Only one of the steppers will be run at a time. The stepper will move CW/CCW "X" steps then move CCW/CW "-X" steps to return to its initial position. I can use either the L298N or the A4888 controller. To save on cost I am looking for ways to insert some circuitry between a single controller and the steppers that would select which stepper to run. The circuitry should be extensible so if I wanted to add more steppers in the future i could do so. Any help would be appreciated.

Ed


   
Quote
Will
 Will
(@will)
Famed Member
Joined: 2 years ago
Posts: 2235
 
Β 
Using the A4988 stepper motor drivers and an Arduino as controller using the AccelStepper class would allow you to run several steppers. Each motor would required only 2 Arduino pins.

Experience is what you get when you don't get what you want.


   
ReplyQuote
Ed
 Ed
(@ed)
Active Member
Joined: 10 months ago
Posts: 10
Topic starter  

@will There are 54 steppers to control so I need some logic to select the stepper for the controller to run. I am trying to engineer sending the control signals to all 54 steppers at the same time but only one of them receives the signals and runs.

Ed


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 2 years ago
Posts: 2235
 

@edΒ 

I think my head just exploded πŸ™‚

If I understand that correctly, you plan to use one A4988 driver (say) to run 54 steppers which are all receiving the same signals. When the magic happens, one stepper motor moves and the rest are frozen in horror ?

May we ask what this system is intended to perform and why it was designed this way ?

Do you have any amplification or booster stages in your plan ?

Experience is what you get when you don't get what you want.


   
Inst-Tech reacted
ReplyQuote
Ed
 Ed
(@ed)
Active Member
Joined: 10 months ago
Posts: 10
Topic starter  

There are lots of ways to extend the reach of an Arduino microcontroller. For instance, each stepper has two coil circuits A and B. If I insert a SPDT relay between each stepper and the A4888 controller, and connect the steppers A and B coil circuits through the relays,Β  I can control which stepper is connected to the controller and hence use just one controller for all 54 steppers. I can use simple gate logic to select the appropriate stepper's relay. Sending the controllers signal to all 54 steppers at once will hit 53 open circuits and do nothing and one closed circuit, which will run the selected stepper. This is just one way I have thought of to do it. An A4888 controller cost ~5X what a small relay does and requires a heat sink so I am saving some money in the process. I am just looking to see if anyone has solved this problem in other ways. I am sure I can come up with "A" way to make it work (brute force) but I would like to find "The" way to do it (best way) which I do not believe is by using 54 separate controllers. I will keep researching the problem. Thanks!

Ed


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 4016
 

@ed Are you saying you will install 54 SPDT relays and thru some sort of control mechanism select a single relay to connect one stepperΒ  to the arduino pin?

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 2 years ago
Posts: 2235
 

@edΒ 

You could set that up as a uController driving the 3 pins of an A4988 (step, direction and enable) with 7 shift registers (7 x 8 = 56 > 54 needed). Setting the values in the shift registers with Β a 1 bit in the stepper that will actually be operating should cover your scenario.

But you'll probably need a power boost for each relay, because the shift registers won't be able to supply enough power to operate them.

Ron Bentley recently posted about a class library he has provided for managing shift libraries. It's at

https://forum.dronebotworkshop.com/postid/25276/

Experience is what you get when you don't get what you want.


   
ReplyQuote
DaveE
(@davee)
Noble Member
Joined: 2 years ago
Posts: 796
 

Hi @ed,

Β Β  I have only minimal experience with stepper motors from decades ago, so the following is based on what I can see on the web... no responsibility for any errors on my part.

And sorry if this looks a bit like a sermon ... I hope it is useful.

------

I guess you mean A4988 .. not A4888.

------

Assuming the motor must be driven in forward and reverse, Bipolar stepper motors have 4 connections .. each requiring a half bridge. (The controller contains 2 Full bridges, and in the case of the A4988, a 'sophisticated' control system with PWMs etc.)

https://datasheetspdf.com/pdf-file/788474/Allegro/A4988/1

https://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdf

Note these are only example datasheets to explain the principles ... this market attracts lots of copies of chips, etc. , so the board you buy may have different characteristics.

---------

To share one controller (L298 or A4988), it is necessary to switch 4 poles. If you had 2 motors it would need to be a 4 pole 2 way switch/relay, where all of the contacts could handle the motor currents and voltages.

You are looking to control 54 motors, so you need the equivalent of 4 pole, 54 way. In principle, this could be made up of multiple 4 pole 1 way relays/switches .. the practicality of that suggestion depends upon sourcing and wiring an appropriate set of 54 4-Pole Single Throw relays/switches.

In principle, but almost certainly not economically practical, the switches could be semiconductor switches based on FETs.

So that leaves relays, which may be possible, but ...? In addition to the relays, you need 54 relay drivers, and some means of controlling each relay. Plus the reliability, size, etc. surely makes this an expensive route in many respects?

--------------

You say you only need to drive one motor at a time. With stepper motors it is 'common' to drive current through them all of the time, so that current 'holds' the rotor in the last commanded position. If you only supply current to one motor, you may find the other motor rotors have moved or 'drifted' when you next command them. The probabily of this being a problem will obviously depend on the physical load applied to each motor, plus the motor (and gearbox if present) design but I would intuitively expect that this could cause you problems if you rely on every motor being at exactly the same position as you left it, when you reselect multiple times.

I presume this problem becomes even more critical if you use 'microstepping', and sometimes leave the rotor at a position that is not a 'whole' step.

Perhaps, these concerns are not relevant to your application ... I only mention them for your consideration.

----------------

You mention the price of controllers ... this will depend on your location, but I did a quick Google for sourcing in the UK, based on the well known Chinese sources, and the first one I found was:

https://uk.banggood.com/Geekcreit-A4988-Driver-Module-Stepper-Motor-Driver-Board-with-Heatsink-p-1577464.html

In 30-off quantities, this priced their board at under Β£1 each, including shipping and UK tax.

Note: I am NOT recommending this product - I hope it is fine, but no direct experience. However, if you can buy these, or any other similar controllers, at around Β£1/$1 each, and they do the job, I think you will have difficulty finding a lower cost approach.

--------------------

There is some controversy about different types of 4988 controllers HR4988 vs A4988, and so on.. e.g.Β  https://github.com/MarlinFirmware/Marlin/issues/23626

This is only 1 reference to get you started ... search around for a better overall view... but treat each individual article with a critical eye ... not all that is printed is true!!

I have no experience to offer, and in the case of sourcing boards, little confidence as to what will be supplied. e.g. the photos for the product I mention above does not have 'A' or 'HR' before 4988 on the chip.

image

The headline description is A4988, but which is it really? Is 'A' better than 'HR', or vice versa? I don't know.

After doing your own research, I can only suggest you buy 1 or 2 and trial them for going for a bulk buy.

------------------

Driving 54 such controllers presents a few issues, the most obvious being power supply rating, heat dissipation and provision of control signals.

If you keep the motor powered 100% of the time, then clearly the power supply and heat dissipation systems must be designed accordingly. Clearly this means the motors and voltage drive must be known and the appropriate maths applied.

I presume you can use the 'Enable' control to depower the motors when they are not moving, providing this does not result in mechanical 'drift' problems, as mentioned earlier. This might be a way of reducingΒ  power and heat problems.

The provision of control signals ..principally Step and Dir, but possibly also Enable, Sleep, etc. are a discussion, and maybe a training course, in their own right. I suggest you check through the forum, including contributions to this thread, (and elsewhere) for contributions from others for methods of expanding a few pins on an Arduino to drive some 54 board sets -- you may wish to ask a few pertinent questions when you get that stage.

-------

Good luck with your project, Dave.

Β 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@ed

Posted by: @ed

@will There are 54 steppers to control so I need some logic to select the stepper for the controller to run. I am trying to engineer sending the control signals to all 54 steppers at the same time but only one of them receives the signals and runs.

All the responses I see so far appear to assume that all responsibility is placed upon the hardware/driver side of the equation... however, your (and if I understand your requirements correctly), can be easily achieved via creating your own servo class.Β  If you have some experience with classes, and or are willing to put in some time to learn how to implement them, then it seems quite possible to do what you want.

You may well however require as @will mentioned, a shift register to implement your design, unless you have a micro controller with enough pins to manage them all.

Cheers

[EDIT] - Just pondering a thought... perhaps a shift register is not even needed?Β  I see no reason that the signal pin of each servo motor cannot be connected to a common pin via a common bus?


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 10 months ago
Posts: 982
 

Hardware circuitry is not my area... but on the subject of 5X the price.

Amazon says,

Β  = 1.8X

For the whole project, it would cost $35 more.Β  That premium goes down depending on the complexity of the hardware solution required to use just one A4988.Β  Compared to the total project price of the stepper motors and whatever you're driving with 54 steppers, I would consider the $35 premium worth the simplicity of electronic design.Β  Although everyone has their own price/pain point.

VBR,

Inq

P.S. I think everyone is adjusting to the "new" price of things.Β  It really hurt to fill up my truck the last time.Β  The price bump was far higher than $35.Β  Eating out, groceries, construction supplies.Β  My shed project willΒ  be 4X what it would have been two years ago.Β 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@frogandtoad

Posted by: @frogandtoad

@ed

Posted by: @ed

@will There are 54 steppers to control so I need some logic to select the stepper for the controller to run. I am trying to engineer sending the control signals to all 54 steppers at the same time but only one of them receives the signals and runs.

All the responses I see so far appear to assume that all responsibility is placed upon the hardware/driver side of the equation... however, your (and if I understand your requirements correctly), can be easily achieved via creating your own servo class.Β  If you have some experience with classes, and or are willing to put in some time to learn how to implement them, then it seems quite possible to do what you want.

You may well however require as @will mentioned, a shift register to implement your design, unless you have a micro controller with enough pins to manage them all.

Cheers

[EDIT] - Just pondering a thought... perhaps a shift register is not even needed?Β  I see no reason that the signal pin of each servo motor cannot be connected to a common pin via a common bus?

Β [EDIT]

Basic Arduino Servo Library Commands:

Based on these, I see no reason why we can't just detatch() and atatch() at will, depending on which device we wish to interact with.Β 

Methods
Β  Β  attach()
Β  Β  write()
Β  Β  writeMicroseconds()
Β  Β  read()
Β  Β  attached()
Β  Β  detach()

Cheers


   
Inst-Tech reacted
ReplyQuote
DaveE
(@davee)
Noble Member
Joined: 2 years ago
Posts: 796
 

Hi @frogandtoad and @ed,

Β  I aimed my ponderings above at the assumption that @ed had identified a stepper motor type for the 54 motors, plus the principle that either a L298 or A4988 controller would be a suitable controller type for driving these motors.

@ed says:

To save on cost I am looking for ways to insert some circuitry between a single controller and the steppers that would select which stepper to run.

So the bulk of my discussion was based on that assertion and the consequences. As this basically involves directing 4 independent power lines to each of the 54 motors, this clearly represents a considerable electrical switching and wiring challenge.

-------------------------

@frogandtoad is proposing to use servo motors, which are quite different in their approach, and require completely different controller hardware and software. In some circumstances it is possible to use either a servo motor or a stepper motor. So the suggestion of considering servos is valid, given the application has not been stated.

In the case of either stepper or servo motors, clearly there must a separate 'path' of control signals to each motor from the controlling Arduino or equivalent. This path will probably involve multiplexed signals from the Arduino, accompanied with suitable expanders such as shift registers, as the number of control pins on an Arduino is much lower than the number of motors envisaged. Hence, a practical and economic hardware 'pathway' must be decided on.

In the case of servo motors, each motor may require an analogue voltage to each motor, to determine the position of that motor. I do not know whether it is practical to share a common voltage outlet, by only enabling one motor at a time - this would require the mechanical loading on the motor to be less than that needed to move the rotor when the motor was unpowered, assuming the servo does not provide some form of 'memory' function.

-------------

The majority of the discussion I provided assumed that stepper motors were chosen, and suggested that providing each motor with a low cost controller was probably more practical than trying to share a single controller's output with 54 motors. Such controllers have a semi-standard control input requirement, and the methods of driving a considerable number of these from a single Arduino is discussed elsewhere, including by other contributors to this thread.

If servo motors could provide the necessary mechanical drive required for this particular project, then a corresponding hardware path for each motor drive would be required.

Best wishes, Dave


   
frogandtoad reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Reputable Member
Joined: 1 year ago
Posts: 366
 

@frogandtoadΒ  Indeed, software implementation might be easier than using hardware logic to multiplex a servo control signal as the highest number of analog multiplexers I've seen is about 1:16 .. a far cry from the 54 lines of control @ed has spec'ed out. I appears to me that you could set up a class, and call it Servo as an array, and just detach all the servos except the the one you want to control, and attach it..Could that be done? and if so.. how would one go about setting that code up. Could you possibly write a simple code to illustrate this function?

kind regards,

LouisR

LouisR


   
frogandtoad reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@davee

Posted by: @davee

@frogandtoad is proposing to use servo motors, which are quite different in their approach, and require completely different controller hardware and software. In some circumstances it is possible to use either a servo motor or a stepper motor. So the suggestion of considering servos is valid, given the application has not been stated.

Oop's, my mistake, and thanks for picking that up, though I'm not really sure that matters in this situation anyway, as my response is more about the implementation, rather than the device being implemented, as they still fall under the same issues, no?

I get the gist of your response, and appreciate it is quite a valid concern, and now you've put some doubt into my mind as to how achievable it might be πŸ™‚

The main issue I saw with the request was the number of motors required, and how to keep track of them... I suggested a class, and that makes tracking of them a whole lot easier and practical.

Thinking about it again, a shift register may still be needed, however, a class to accommodate the amount of motors would in my opinion still be a welcome inclusion to help the programming and logic that much better.

Cheers


   
Inst-Tech reacted
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@inst-tech

Posted by: @inst-tech

I appears to me that you could set up a class, and call it Servo as an array, and just detach all the servos except the the one you want to control, and attach it..Could that be done? and if so.. how would one go about setting that code up. Could you possibly write a simple code to illustrate this function?

kind regards,

LouisR

Indeed, it could be an array, or we could use composition... I guess there are at least a couple of ways we can use to implement our stepper/servo object(s).

My initial thought was, hmmm... how can we track each motor?... (how do we know which one we want to talk to?) - Well, as it turns out, we can, well, at least I think we can πŸ™‚

That's why I thought of using classes, where we can actually associate an ID or NAME with each individual device (motor), such that we can query those attributes over a loop.

Just having a quick look at the stepper motor library... we might be able to take another approach.

For example, implementing a pointer to a dynamically allocated stepper object(s), created and destroyed on demand.

The mind boggles, and I'm sure that the project outcome is in there somewhere πŸ™‚

Great pickup, questions and analysis - We're on the right track!

Cheers


   
Inst-Tech reacted
ReplyQuote
Page 1 / 2