YTread Logo
YTread Logo

Big Stepper Motors with Arduino

Jun 06, 2021
We've seen

stepper

motors

before, but today in the workshop we will work with a large

stepper

motor, see how to read the specifications of the stepper and choose a driver for your motor. We will also use an Arduino to control everything we are doing. taking big steps today so welcome to the workshop hello and welcome to the workshop and today we are going to work with stepper

motors

again now that we have seen stepper motors before we do a full video on stepper motors and in that video Le I explained how a stepper motor is different from the other types of motors we have used in our projects.
big stepper motors with arduino
What are the different types of coil windings? The windings of your bipolar and unipolar stepper motor. How to drive stepper motors using dedicated driver modules and also using H-bridges and concepts like microstepping and while we have covered all of that, that is not what we are going to cover today, what we are going to cover is what we need to do to drive a large stepper motor, now this is a very large Stepper Motor. This is a NEMA 23 size stepper motor that draws a good 4.2 amps of current to get its full capacity and is a very powerful motor.
big stepper motors with arduino

More Interesting Facts About,

big stepper motors with arduino...

Now this motor is too powerful for the modules and H-bridges that we saw before, so we have two options, one option would be to build our own drivers from MOSFETs, which is not what we are going to do today, but instead we are going to use a driver now this is an industrial size stepper motor driver and there are a variety of these out there. What we are going to learn today is how to read the specifications of our stepper motor to select a driver for it and then we are going to see how we can connect this to an Arduino and control the stepper motor, so we will start by first learning how to read the specifications of our stepper motor to determine what type of driver and module we need. select to use it, so let's take a look at that right now.
big stepper motors with arduino
We've already covered the basic specifications of stepper motors in my previous video, so if you need a refresher, go and see what I want to show you. in the real world, how the specifications of a stepper motor would be read. This is a stepper motor that we are going to use today, so let's take a look at some of the specifications that are listed on the Step Online website. Here are the electrical specifications now, this is a bipolar stepper motor and in the previous video we covered the difference between bipolar and unipolar stepper. It has a step angle of 1.8 degrees, which means that in one full step the motor shaft will move 1.8 degrees and of course, can you do a microstep to get a finer resolution by calculating that you can see that Would it take 200 steps for this to make a complete rotation?
big stepper motors with arduino
Here is the holding torque specified in both Newton meters and inches advertised and now here is probably the most important specification in the full electrical specifications and that is the current per phase and that is 4.2 amps now this will be where it will give its maximum torque. Also keep in mind that if you're going to microstep and you're probably using this controller, then you're going to have to do that. Double that current requirement when choosing a power supply because this is per phase, meaning each of the coils could be at 4.2 amps simultaneously. Now here, conversely, it's the least important specification here, the voltage three point seven eight volts, what the heck is that? all about like I said before I'm going to drive this with my bench power supply and I plan on using 24 volts and some people may use sixty volts or 48 volts to power this motor why does it say 3.78?
Well, this is The reason why the phasor resistance is the electrical resistance of each of the coils and 0.9 ohms. Well, if you're good at math, try multiplying four point two by 0.9. Guess what you will get as a result. This is simply a calculation. voltage, this has nothing to do with the maximum voltage that the stepper motor can be operated at and I'll show you another example of that in a few seconds. This is the inductance, which is very useful to know if you are actually designing the stepper motor driver or if you are trying to tell Herman what the maximum frequency is that he could drive the motor, after that we get into some specifications physical.
Now this is a NEMA 23 size motor, so all of these specifications are pretty consistent and the connections, which is very important, of course, to know because this is the coil a plus and a minus and B plus and B minus and this gives you the color codes for those cables. Now this also links to a couple of spec sources. Let's take a look at them because they also have information and also you may not go to a website for your stepper motor; In fact, you may only get a couple of spec sheets included with the engine.
Here's the first one that goes over most of the physical aspects. specs for the motor and again the electrical specs which are like we've seen before and notice they put the amps and resistance at the top. Also if you go down here you won't even find the voltage listed because again that's just a calculation based on these two and these are all the same specs we've seen before apart from things like pitch accuracy and inertia etc. . and the weight of the engine itself. Now the other diagram they have is actually very interesting: it's a torque diagram.
Now this is the pull torque and notice that it is rated at 36 volts even though this motor was only specified at less than 4 volts. This is another example of how little the voltage reading actually means in the stepper motor specifications and this is 36. volts at 4.2 amps and notice that it is semitones so in other words they will have activated two coils at the same time in this configuration. Now let's go to this table and take a look. Now this is the torque pull and notice that the torque decreases as the speed on the stepper motor increases.
Now they start at 60 rpm, which is one revolution per second, and notice that it says it needs four hundred pulses per second. Remember that it takes two hundred pulses in full step mode to rotate. the motor so it would take four hundred pulses in a half step so this relates both the frequency as the pulses and the speed in rpm which of course you can also calculate mathematically and again as you can see the torque will decrease as the motor step by step. it moves faster and that's basically how you read the specifications when selecting a stepper motor.
Right now, here's the stepper motor that I'm going to use and as you can see, this thing is quite a beast, it's a NEMA 23 size. So you can see that it has a very large d output shaft here and the standard bracket. NEMA 23. This is a bipolar stepper motor. Its specs are that it has a stall current of 4.2 amps and a stall torque of 425 inches of bounce which is quite a bit of torque which is also the same as three Newton meters if that means more to you and as a motor bipolar is about four output wires that have come up to the bare wire over here and I have a multimeter over here so I can measure the resistance of the coil and as you'll see it's pretty low and yeah 0.9 ohms like I'm reading there, so there is a very low coil resistance on this, now its rated voltage is rated at three point seven eight volts.
In the courses we just saw that the voltage rating is basically a mathematical calculation of the current. of loss and the resistance of the coils, so this is the big beast that we are going to work with today now that we understand a little more about reading. stepper motor specifications and we have also seen the stepper motor that I am using today, it is time to turn our attention to the driver. Now this is the driver module I'm going to use, but I want to make it clear that I don't need to use the identical module I'm using.
I have based my module selection on the current requirements of my stepper motor and that is what you should do too and there are a variety of modules that look like this. and that can work on the same Arduino circuit, they are wired the same and can use the same code, the only difference is their voltage and current ratings. You will see that there are some DIP switches on the side of the controller and the selections you make for your particular motor and controller combination may be different than what I am using, but otherwise you can use basically any of these controllers.
I bought this one on Amazon you can get them on eBay at electronics and electrical supply stores too so let's take a closer look at the controller right now here is the motor controller I'm going to use today like I said this is typical of most micro stepper motor drivers will now have connectors on the side and these connectors on the top here where it says power and fault is where you're actually going to put the input connector on the Arduino, so we're going to control both the direction as the stepper motor pulses feeding signals. here and they come in a derp - derp + pulse - pulse plus a capable - enable + if you will find that when we do the wiring it will be a little different than what you expect we will actually use a common 5 volt and not a common ground for these now, in the bottom, you have the connections that go to the motor itself, so one coil a plus and a minus and the other coil B plus and B - and on the Bottom here we have the power supply connection.
This particular one will work on both AC and DC, so if you're using DC, put the positive here and the negative here. AC of course you can connect any of the cables anyway and this one. If you have set this particular one from 18 to 80 volts AC or 24 to 110 volts DC, it is actually about the same range if you multiply it by 1.40 1/4, which is what you do when you have a wave rectifier complete, you will find that they are quite well in the range of 25 to 113 volts DC supplying AC. Now these connectors are pretty cool, they're screw connectors, but they also come off like this so you can connect the cables externally and then mount everything here. connecting it and that's very useful because as you can see this is a pretty big beast here now on the side they have a table and the table tells you how to set it up for things like current limiting and so it gives you the different currents that you can configure it and also for microsteps for the number of pulses per revolution and this is the table that determines that here and you configure all of this on the side here on a DIP switch they have a switch on the side that you can use to configure everything now, this It's quite a beast, it's in a metal case and on the back you can see that it has a heatsink that also has a fan, so expect it to dissipate quite a bit. some heat and needs to be mounted in an area where heat is convenient, so there you have the motor driver that we're going to use in today's big stepper motor experiments.
So we've seen the motor, we've seen the controller. It's time to connect everything now there is another component that we haven't seen yet and that is the power supply. Now I am going to use the power supply on my other workbench today because it is a variable supply and it can supply up to 30 volts at 5 amps and that should be enough to be able to drive the motor and in my case I am driving my motor at 24 volts. Now remember that your power supply will be determined by your controller and your motor etc. you may be using a different voltage and a different current and that's fine as long as your power supply is capable of supplying the driver.
You may also note that many controllers, including the one I just showed, have a built-in rectifier and can accept AC. voltage as well as DC voltage, so you could use an AC transformer instead of a DC power supply if you have those type of controllers, now the Arduino will be powered from your computer's USB power supply so it won't run be affected by the power supply in the controller, so let's take a look now at how we connect our motor, our controller and our power supply to the

arduino

. Now for our first experiment, you will of course need your motor driver and your stepper motor, as well as an Arduino. using an Arduino Uno here, additionally, you'll want a push button switch, a pull-up resistor for the push button switch.
I used a 10k resistor and a potentiometer, any linear part with a value of 5k or higher will do. I am using a 10k pod, let's start by connecting the motor driver to pin 6 of the Arduino from the Arduino ghost the derp - the connection on pin 7 of the Arduino stepper motor driver goes to the pul - the connection on the Droid o The controller of both the derp plus and pol plus connections on the motor controller are connected to the 5 volt output of the Arduino. One side of the push button switch is connected to pin 2 of the Arduino.
A 10k resistor is also made from this connection to the 5 volts on the Arduino, the other side of the push button switch is connected to the ArduinoIt is connected to ground, one side of the potentiometer is connected to the ground of the Arduino, the other side to the 5 volts of the Arduino and the wiper of the potentiometer is connected to the analog input. a 0 and that last makes its connections to the stepper motor and the power supply, your stepper motors would be connected looking at the specifications of your motor with one coil going to be positive and negative and the other coil going to positive and a .
Negative, you will also need a power supply whose specifications depend on your motor driver and, to some extent, your stepper motor. Now I am using a 24 volt power supply and it is a DC supply so I watch the polarity while connecting it to my motor. controller my motor controller will also accept an AC input but some will not get a gain. Look at the specifications of your motor driver and your motor to determine the requirements for your power supply and now that everything is connected, let's look at a simple sketch that we can use to test everything.
Now the first sketch we will run on the Arduino will be very simple, all we are going to do is capture the movement of the potentiometer and use it to control the speed of the stepper motor. Now we won't be using any libraries in this sketch, we'll just be pulsing the motor directly through the Arduino code, but what this sketch will do is give you a good idea of ​​how easy the motor controller is to work with and how the different signals work. control, so let's take a look. that sketch right now here is the sketch that we are going to use to test our big stepper motor.
Now it's a pretty simple sketch that doesn't require any libraries. Let's start by defining a number of pins and so a The reverse switch is where we connect the switch and that is pin number two. Of course I've used a button here, but keep in mind that this could easily be a limit switch and you could even have more than one in parallel, so for example if you're trying to move the motor between two extremes you can place a switch at each end and of course it doesn't have to be a mechanical switch; in fact, it would probably be better if it was an electronic switch, like a Hall Effect Sensor or optical spot, so just something to think about.
Now this variable defines where we send the pulse pin. This is the PL input on our motor controller, so we set it to pin seven and we set pin six to the. controller for the der pin and we have our potentiometer and it is connected to the analog pin a0 now a couple of variables now PD is the pulse delay period now this is the inverse of the frequency and we will set it to an initial value of 500 and we also define a boolean and we call it set derp and initially we set it to low, now this will set the direction and so toggling this will reverse the motor.
Now we have an interrupt controller which I call Motor Rev and all it does is it takes this work set area below and inverts it so that any derp set is the reverse, if it goes in slowly, it comes out high or vice versa, well , now up to our configuration, the configuration is very simple, we configure the pin modes for the two pins that we have defined to connect to the motor driver as outputs and we also connect the interrupt to the reverse switch the switch that we have defined on the pin now this is the correct format to connect it interrupts you use the digital pin to interrupt the function and assign it the pin number instead of the interrupt number which you could also have inserted here and then when that interrupt is activated we call rev motor and activate that interruption in the next pulse.
Now remember that. The line is held high, so if the button is pressed, the line will go low and that will be a down condition and that will trigger the interrupt which in turn will call this interrupt handler here now in the loop and again, this is pretty simple. First we have to determine the pulse duration and we do this by reading the speed using an analog readout. Remember this is connected to a zero pin and we map it using the map command or the map function. Excuse a value from 0 to 1023 because that will be the input value and we assign it to a value of 2,000 250.
Now notice that we are going in the opposite direction, so the speed increases as we go clockwise. clock because again the pulse duration is the inverse of the frequency, so the higher this number, the slower the motor will spin. Next we write our address in the set with the center value in the derp of the controller, so whatever that value is, it will set the direction of the motor and then here we will send the pulse pin high, we will delay it for the pulse period , the width or the delay of the pulse and then we will send it low and delay it for the same period, so What we are doing with these four statements is essentially creating a pulse and then this is a loop that we just continue repeating this over and over time, so it's a pretty simple sketch.
We're going to do some extra action right now, so here's the test setup I have to test my big stepper motor now because of the amount of torque this motor produces. I didn't want to just leave it on the workbench because it could be a little dangerous, especially as you can see. Using a miniature vise as an indicator of the position of the motor shaft, I put the whole combination here in my vise and here, of course, you can see the stepper driver. I have it connected to the stepper motor plus the power supply which you can't see will supply it with 24 volts and down here on my connections to the Arduino on the back I have the potentiometer that I'm going to use to control the speed of the motor and the switch I'm going to use. to use to reverse the motor and remember this switch could also be another type of optical slide switch or a Hall effect switch and you could use it at the end of the motor stroke or whatever is driving the motor to make the motor run . in the other direction, you could even put two of them in parallel if you wanted.
Now I haven't done any bouncing on this slide, so occasionally when I press it it looks like it's being pressed twice, but if you use an optical or electronic. switch, you wouldn't have that problem, so what I'm going to do now is turn on the switch and as you can see, the motors are spinning and as I move the pot, I can move it faster right now, by the way. this is set so that one revolution is 800 pulses using the DIP switches on the side here and of course as you may perceive this differently the speed will change now I'm going to turn it up a little bit more it's going pretty fast now that it is enough.
It's really scary to see that grip turn I hope it stays warm that's its dad at its lowest speed okay now let's hit the switch you can see the D bouncing an effect there it goes into reverse, reverse, reverse again so that you can see to the side. Perhaps from some considerations about D bouncing this seems to work quite well, so as you can see it's pretty easy to use a stepper motor with Arduino and some simple code, but we can improve our code using a library . Now, the Excel step-by-step library is one. which we have used before is a very common library for stepper motors and with this library you can achieve very precise control of your stepper, so let's do another demonstration using Excel stepper.
Now keep in mind that since this is such a common library, there are many sketches that make use of this library, so now, armed with the information you have, you can take those sketches and use them with your large servo motors, like this Let's take a look at the step by step of Excel now. In my original video on stepper motors I reviewed the acceleration stepper motor library in some detail, so I won't repeat myself here. If you were following those videos, you probably already have the Excel step-by-step library installed on your

arduino

ide, but if not you won't need to go through the library manager and do it, so go to the sketch to include the library and then go to manage libraries once the library manager is open, search for filters by typing accel stepper and here is step four of excel.
I already have mine installed, but if yours is not installed, when you highlight it with the mouse and the install button will appear as it does with this library, I don't have it installed, so just press the install button in Sell Stepper and that will install the library for you, once installed you can use some of the built-in example sketches to run the motor driver. All you need to do is change the starting line in the sketch and let me tell you I'm going to go down and open examples and then scroll down to see custom library examples and you'll see a cell step by step and there are several different examples that you can try.
There's one here called bounce, let's look at that for a second. It's pretty simple. one, this essentially sends the motors from one limit to another and also accelerates and decelerates, so it's actually a nice feature, now the only thing you need to do at the beginning here is define the object step by step in a different way, so what I would do is just comment that one of them gives me another line here and this is the way you want to do it, so what you're telling a cell step by step to do is create an object called step by passed.
The mode here is number one, it just indicates the way it communicates with the stepper and that is the correct mode for our modules, and seven and six are where we have connected our pulses and our dur connections, so do it in that particular format for any of These examples will work fine, so let's go and take a look at the bounce sketch running right now on our stepper motor example, so I uploaded the bounce example from Accel Stepper to my Arduino, now you can try some of the others. In addition to the examples, all you have to do is remember when you are defining the object step by step to use the syntax I showed you and you can change any of the existing examples.
Of course, you can also use other code that uses the Excel step by step using one of these unit modules, so all that's left to do is turn it on a little bit and we have it right at the end now Excel step four what it does is speed up and then it turns and then it slows down and it stops and then it reverses and does it all again and there you have it, one thing you probably can't hear because I think my noise reduction technology is muting it, but in the stepper motor where the fan turns on every time I turn it on and I didn't really feel any heat.
I ran it the other day for a few hours, there was a bit of heat in the stepper motor, of course I'm not driving it anywhere near its full capacity. its maximum torque, so what I'm going to do now is keep going at 800 pulses per revolution. I'm going to turn off the power for a moment and now I'm going to use the DIP switch on the side. They have a diagram here that tells you the microsteps and current settings, so you need to set this up correctly. Make sure you don't exceed the current of your stepper, but I'm going to press this one down and that should cause It only uses four hundred pulses to make one revolution, so let's try it again and it's definitely moving faster, so using microsteps and speed controls in Excel step by step or whatever skeptic you are using, you can control both the speed of your motor and to some extent its torque because the different micro-stepping modes will give you more torque.
Well, that's all for today's video. I hope you enjoyed it and I hope you're now inspired to start building things with a really big step by step. motors, but before you run out and start building all that stuff, I just have to warn you that large stepper motors, like all other large motors, can exert a large amount of torque and therefore can be dangerous If you have your hands or other appendages in the wrong places when working with them, so be careful when working with these motors now. If you need more information on how to drive high step motors with the arduino, you can calculate the article on the Durham Bot Workshop Communication website and you will be able to find a link to that article right below this video while you are on the website.
Consider subscribing to the newsletter. It's my way of keeping in touch and finding out what content you would like me to create for you in terms of videos and articles and if you haven't already, please subscribe to the youtube channel. I'd love to have you as one of my subscribers, so until the next time we meet, take care, be careful with those big stepper motors and we'll see you again soon here at the Journal Bot workshop, bye for now.

If you have any copyright issue, please Contact