Stepper Motors in Arduino

Saral Tayal
A free video tutorial from Saral Tayal
Director of education at Tinker Spark
4.4 instructor rating • 2 courses • 4,362 students

Learn more from the full course

Electronics in a nutshell: non-technical, bite-sized [2020]

Begginer's best friend to mastering Electronics Fundamentals through super-short 5 minute videos. Join 43,000 viewers

01:57:12 of on-demand video • Updated May 2019

  • How electronics components work, how they are used in circuits, and how to use them in your projects
  • Common sensors used by Arduino, Raspberry Pi & other circuits
  • Why we use electronic components the way we do
  • Understand how the most important electronic components work
  • Understand the different electronics terminology, units, and electronic symbols for various electronics
  • This course is a great building block for begginers to take on more advanced electronics concepts or use this as a resource for a quick refresher on concepts
English [Auto] We're going to learn about stepper motors unlike brushed off brush less motors step towards have a high degree of judicial accuracy. This makes him perfect for applications such as 3D printers CND or even industrial machinery. During the board this common step a more defined in 3D printers we can see that they do mean parts to a step a motor laser router. And this is steeper the Stater In this module contains multiple electro magnets while the router in this motor is a permanent magnet itself. If you look even closer at the router we can see these U shaped cutouts. What these do is help channeling magnetic force and later we will discuss them in more detail next. Each motor can be wired one of two ways either using a bipolar wiring or unipolar wiring support to talk about meaningful and waters. I'm going to represent a router a step a motor or delay this with a diagram that looks like this. So now as you can see the three electrical contacts there's one over here there's a positive contact in the middle and there's another blank one here. Depending on which side we connect crown to us if you're gaining ground here or here we can create a magnetic force electromagnetic force around this fire. So let's do one of that system. Let's add one of these. And what I've done is I've gone into the middle to positive and I've gone the right side here to negative. And as you can see it's charged. Now what's going to happen is the magnet in the middle would react to electromagnet and appropriately turn light. So now if you wanted to switch this router around and make it during the other direction or we could do is simply reverse the polarity instead of ground being connected here. Now ground is connected in this side of the coil which induces electromagnetic force in the opposite direction. So now what's going to happen is it's going to rotate in the other direction. It's simple as that but as you might have noticed only half of the coil is active at one time. If you want to charge the other side only that half of the active if you were to charge this side of the coin you need the side is active. So wasting a lot of point space that's where vital the motors here come into play as you can see Bible and what is here. Well you have two electrical contacts you don't have the touch central electrical contact like you need for the motors. So how this works is if you provide a voltage that means connect the positive government to one side and a negative dominant to the outside we can induce current our electromagnetic force along this coil. So in this case what's going to happen is inverted in this direction like so. And if you decide to flip the polarity like so the electromagnetic force will also be switched in a nutshell you pull the motors are much easier motors to drive much of the cost of twice the wiring in the coils as Bible motors. I think these two quads here allows us to rotate the rotor a full 360 degrees rather than just randomly flipping the rotor 180 degrees so create a much simpler version of the step a motor diagram in the center here. So it's easier to follow along sort of energize the motors and the rookies are lined appropriately. Now what if you wanted to move the motor in a clockwise direction for to do that with an to quite the to so here the is turned 45 degrees clockwise. Now what if you wanted to continue turning clockwise now I've just got to. And as you can see that auto will turn in this direction. Fantastic. Now you get the gist. Now we're going to continue to do this motion and dress call one and quite two to keep rotating this motor another 45 degrees another 45 degrees. And like so we have moved the center rotor a whole 360 degrees. Now as you saw when you wrote it I would do 360 degrees. We were moving in increments of 90 degrees but what if he wanted to move in increments of 45 degrees. Let's start with energizing one coil. Now while this quality energy is what if you energize the other coil like So what's going to happen is our water was done in 45 degrees. Like so if you wanted to move it another 45 degrees counterclockwise. What we could do is simply turn off this coil and now what's going to happen is this motor with continued U-turn. Like so now what if you wanted to move it another 45 degrees counterclockwise. Well we can activate coil one again. The module continued joint 45 degrees. Now this technique is called half stepping and it falls under a technique called micro step in by using micro step and we can get a lot more rotation resolution but it comes at the cost of dark down like traditional motors stepper motors. I read something called steps steps refers to the distinct position that is step a motor can make in one 360 degree rotation. That means a 200 step motor such as the one I'm holding here can make 200 individual increments of movement within a 360 degree turn. Before we move on let's quickly talk about the three types of stepper motors. The first is the permanent magnet stepper motor. This motor features a magnetic rotor. The second type of stepper motor is a very little reluctant stepper motor. This doesn't have a magnetic motor like the last motor but it features those U shape cutouts that I showed you earlier. Certainly we have the hybrid synchronous motor which kind of mashes both of those motors together and a hybrid motor and features both a magnetic core and those you ship cutouts. Lastly did do a quick little demo using this NEMA 17 slash 14 step on motor. It's very commonly used in DIY or hobby grade applications such as building your own 3D printer CND or even homemade robots. Now this is a hybrid synchronous motor with bipolar wiring and we'll be driving it using the common 8 4 9 8 8 stepper motor driver. We can now use both the raspberry pi or the Arduino using the stepper drivers very simple the only two pins that we need to worry about the step in the direction and step in or basically tell the motor to move and the direction then we'll tell the motor in which direction to move. This is the circuit that I've used and that's the code that I've used the code everything here is from the Armenian but the code can be compiled for the Raspberry Pi as well and I'll work in the same way. As you can see the stepper motor spins before we end this video. Let's quickly talk about on the drawbacks or the cons of this stepper motor. Now although stepper motors have been often miniaturized most stepper motors are big and bulky step on what is required a lot of power to operate and can often get hot under Operation next based on how these stepper motors are driven or what driver's circuit you're using. Stephan would say these can get quite noisy next because we require a specific drivers circuit just to control this motor the wiring in the electronics for stepper motors can get a little bit complicated for beginners next using micro stepping to increase the resolution of your step a motor will decrease the amount of dark you step a motor can produce. Thanks for watching.