arduino 6 wire stepper motor
For me, stepper motors represent sort of the best of both worlds between regular DC motors and servo motors, so regular DC motors. They spin really fast or they have a lot of torque. They can move a big load, but you don’t really have any precision over position. You can’t really precisely control where, in its rotation it is servo motors. On the other hand, let you have precise rotational control over position, but they really don’t spin very fast and they don’t really oftentimes. They don’t go more than about 180 degrees, stepper motors sort of bring those two ideas together. You both get a lot of torque and continuous rotation, but you also get the ability to precisely control the position in the rotation that the motor is in so and the way.if stepper motor works. Just for a little bit of background is basically inside of here. There are a few different. There are a few coils and those coils just like on a regular DC motor. You energize those coils and they cause the shaft to move. Unlike a regular DC motor each time you energize one of the coils it the motor only rotates a tiny little bit. It makes a single step and when you have so, this is an example of a bipolar, stepper motor. It basically has two sets of coils inside, and each of those coils has two wires, and the basic idea is that when you power one coil, you step the motor a little bit and then you undo energize that coil and power, the other coil.
It steps it. A little bit more and by switching back and forth between which coils your energizing, you cause the road, the shaft rotate continuously, so let’s go and start taking a look at how to wire this up. Now I was going to show you guys how to wire up the stepper motor using an h bridge, like I have in some of my other motor tutorials and it’s definitely possible to do this, but instead of using an h bridge today, I thought use one of These very low cost stepper drivers and these cost. If you look on eBay or Amazon, you can get these for just a couple dollars: apiece and they’re much more suited to driving stepper motors. So, rather than going with an h bridge and it yeah H, bridges cost a little bit less, but this is sort of the better way to drive a stepper motor and it’s, also much easier to code and you’ll see why? So if you really, if you guys really want me to do an h, bridge video to drive a stepper motor, let me know – and I will do it but for today – we’re just going to take a look using a stepper motor driver and I’ll make sure to Put a link to one of these guys in the description of the video, so you guys can find these and find other ones wherever you want. So yeah just take a look in the description for a link from one of these guys, so let’s go and jump into wiring this guy up, so I’ve come in close on the breadboard here, so you can see exactly what I’m doing and I’m going to start Off by just placing the driver somewhere on my breadboard and with the orientation at least of this driver, I have the little potentiometer here.
The little trimmer pot towards my Arduino, and the first thing that I want to do is just get power and ground established. For this trip so on here we actually have two sets of power supplies. We have a voltage and ground for the just power on the chip, which can be anywhere between 3.3 and 5 volts and then back here. We also have power for specifically for our motor power supply. Now I will note that these guys on the motor power supply do require eight or more volts. I think it might be eight to 36 volts, so you, unfortunately using one of these, cannot power your stepper motor, your volt V motor off of your 5 volts coming from your Arduino. You do need to have a higher voltage power supply, but first let’s just wire up the power for the chip. So the first thing I’m going to do is I’m, going to take a ground wire and put it on this far corner here on the board and positive 5 volts in this case goes right next to that, just one in from that corner. So now that we have the power for the chip connected, let’s hook up the power for the motor, so we have another ground line, and that is just going to connect again to the ground on our board here. So just like that, it’s the second one in from the left here – and we just connected it right to this board and my external power supply I’m, going to wire up using this little.
This long jumper wire here I’m just going to pop that in to ground for now and I’m going to leave this part unconnected until a little bit later. The voltage for the motor so that’s your V motor, connects to that corner, pin and again I’m going to leave this power connector unconnected for now just having them in place from until later. So now we have all the powers set up for this board. Let’S go ahead and start doing some of the logic wiring. So the first thing that I want to do is the third and fourth pins from the right here. Are the sleep and reset pins on this board, and I will be honest. I haven’t used this board a whole ton. These are brand new for me. So in all the on line diagrams have seen those two have been pulled together so I’m just going to connect them using this little jumper wire right here and if you know why you connect those two together. Let me know in the comments I’ve honestly just gotten. These boards, I don’t, know a whole lot about them, so let me know why it is you connect the sleep and reset pins together and, lastly, before connecting our motor, I want to connect our logic for the board here so connecting the Arduino to the board. So the first one I’m going to do is this yellow wire and I’m going to plug it into the rightmost corner.
Pin there and I’m going to connect it to my Arduino is pin 11 and this corner pin here is the Direction pin. So when this pin on the Arduino is high, the motor will spin in one direction and when this pin is low, the motor will spin in the other direction. And lastly, I got this white wire here, and this connects right next to that and connects to my Arduino pin 12 and this white wire is the step wire. So, every time we send a high low pulse from the Arduino, it will make the stepper motor take one little step in whatever direction. It is that we’ve chosen with the Direction pin so now that we have all the electrical connections. Wired up let’s go ahead and wire it in our motor so I’m going to zoom out here, so we can see a little bit better and on my motor I have already gone ahead and figured out which two wires go to which coils. So I have this. This is a bipolar, stepper motor and there are two sets of coils inside of it, and each coil goes to a pair of wires. Now, if you don’t know which coils you have or which wires correspond to your coils, the easiest way to figure that out is to just take a geometers and go to the resistance measurement setting and just tap each of the probes against you know one probe here And then one probe on the next wire or contact that you have and when you get a reading where you have both probes connected and you get a small resistance reading, that is one coil.
So, basically, if you, if your multimeters says olr overload or whatever it is, it means that those two wires are those two contact points are not connected to each other and therefore do not represent a coil. So these two wires internally on the motor connect to one of the coils and these two wires connect to the other. So once you have that figured out, then you take your two coils and right in between your motor power and your chip power. You have four or you should have four available slots open to you, so each coil goes right in those slots, so we have our first coil goes right there and they’re there right next to each other, and the second coil also go right next to each other. So it’s just coil one, a B and coil two, a B and that’s all you need to connect up the stepper motor so now let’s go ahead and take a look at the code and get this running all right. So here we have the code to run our stepper motor and I’ve, designed it to look fairly similar to the code used to run the bi directional motor in the H bridge tutorial. So up here at the top. We have our step pen and that’s equal to pin 12 and our Direction pin equal to pin 11 and in setup we go ahead and we set those as outputs and before taking a look at loop.
We have a couple functions down here, and these are just a couple of helper functions just to make it more clear what it is that we’re trying to do so. We have stepper forward and step reverse and that that just changes the direction pin either high or low, and then we have motors, step and motor step just basically pulses. This step pin here just high low really quickly. So we just right step, pin high delay, one millisecond and then step pin low, and that tells the controller here to have the motor make one step. So in our loop we start off by saying, step or forward, and that sets the forward pin and we have a single four loop here that runs from 0 to 100, each time making a step and delaying by one so and and this little delay by one. Just gives the the system enough time to just let the motor actually make a step. So we run through going a hundred steps in one direction and then we call stepper reverse and we do another hundred steps going in the opposite direction. The exact same for loop, so now that we’ve taken a look at the code let’s plug this all in and see if it runs so. The first thing I’m going to do is finally attach those power supply wires to a little twelve volt supply that I have and now I’m going to plug it in we’ll, see if it works, hey there we go, so you might not be able to see it.
It’S a little bit hard to tell but it’s, basically just pinging back and forth, going a hundred steps each time so yeah it’s pretty easy to wire up one of these motors and, like I said they have a lot of torque. I mean it’s hard for me to physically stop it, while it’s running and they’re really precise in positioning. The only thing that you have to watch out for with these is that, if you put enough torque on them or or whatever might happen, they can skip steps. So if I really grabbed it with my fingers, I can stop the shaft from spinning at all, but there’s no feedback to my system here to the arduino, telling it that this motor stopped spinning. So, unlike a servo where it actually has a sensor inside to detect where in its rotation it is, this has no such sensor. So if you have something that requires very precise positioning and you need to always make sure that you’re at the right position, you might want to add some some way of detecting that position either. Attaching a rotary encoder to the stepper motor output or a linear, encoder or whatever it might be, but these don’t, basically they don’t, have any feedback. So you need to implement your own feedback if it’s, really critical, otherwise yeah stepper motors are great they’re, really fantastic. High torque high position, control and they’re really not too hard to wire up so that’s it for today’s video.
arduino 6 wire stepper motor Video
arduino 6 wire stepper motor news
Posted on Thursday July 25, 2019Deducing Stepper Motor Wiring Hackaday … Continue Reading »
Posted on Tuesday May 28, 2019Best Arduino Stepper Motors in 2019 All 3DP … Continue Reading »
Posted on Tuesday April 09, 2019Arduino Drives Seventeen Stepper Motors, Carefully Hackaday … Continue Reading »
arduino 6 wire stepper motor Social
🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr