The Ultimate Guide to Stepper Motors: Unraveling the Micro-Stepping Technique

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
these are stepper Motors of the same type and same specification the one in left seems to take discrete steps but the one in right seems to run smoothly and continuously the only difference between these two Motors is the way they are driven hey there curious minds today we are diving into fantastic Universe of eser motors and incredible micro stepping technique get ready to uncover how these motors make things move smoothly and silently even though driving a ster motor is not a big deal I will explain how to drive a ster motor in detail you just need a microcontroller and a driving circuit but after you succeed in driving a Seer motor you will face a big trouble when you run the motor at highest speed everything seems to be okay but at lowest speed a steps of motion looks like red hand of a clock which is discrete and undesirable in this video I will explain eser Motors and their structure different types of eser motors eser motor characteristics different methods to drive eser motor using microcontroller and finally I will teach you the exact technique to make a steper motor motion smoother at low speeds using pure microcontroller without ardino libraries or additional or specific IC or modules so get ready to roll up your sleeves and join me in some Hands-On learning stepper Motors are one of most popular and applicable electrical motors with specific features that make them suitable for particular applications high torque at lowest speed and high accuracy make them usable in CNC machines 3D printers or robotic arms and open loop control make them easy to use before everything else I'm going to show you some eser Motors and discuss their specifications all of these are ster Motors ster Motors can be recognized by the number of wires coming out of them stepper Motors usually have four wires like this car engine stepper motor or five wires like this one or even six wires like this one however there are exceptions I mean I have dealt with three wires sear motor in the past in addition when you turn the shaft you can feel its steps on your finger the first thing to discuss is the eser motor type you may have he up many eser motor categories unipolar bipolar four wire five wire six wire Motors I have to tell you that all of these are the same categorizing estare Motors into groups like unipolar or bipolar is done mostly based on how to drive them not the stepper motor itself or its inner structure or its nature also categorizing stepper Motors by their wire count is not correct you may ask how a four wire stepper motor can be same as a six virus ster motor good question I'm going to explain inside any ordinary eser motor there are some windings actually Four windings like these each of the bindings has two ends then here you can see eight ends 1 2 3 4 5 6 seven and eight ends if you face eser motor that has eight wires it means that these winding ends are pulled out directly if theair motor has six wires like this one it means that the factory connects these two ends together and also these two ends together together then they pulled out these two points along with a b c and d wires let's name these red points common wires and this a b c and d wires driving wires if theer motor has five wires like this one then windings are wired like this and this point is pulled out along with driving wires I mean points a b c and d I'm going to call this wire as a common wire and finally if the motor has four wires like this car engine eser motor inner wiring is something like this and only points a b c and d are pulled out remember I'm talking about ordinary stepper Motors I mean maybe there are other stepper motors with other structure structures you have to be careful at this stage I know you are thinking about unipolar and bipolar categories you may ask which one of these is unipolar and which one is bipolar I'm sorry to let you know that all of these are unipolar and bipolar at the same time it is weird right this is a common mistake to affix a unipolar or bipolar label to a steeper motor actually unipolar or bipolar is a label for the method by which we are driving the Seer motor not theer motor [Music] itself if the direction of current in all windings inside the Seer motor does not change at all we call the driving method unipolar and if the D direction of current changes we call it bipolar in this structure we have connected common wires to Source voltage so you can drive the motor by sinking each of A B C or D wires and it is obvious that the current will always flow from common wires to AB C and D wires in this structure it is not possible for current to flow from ABC or D wires to Common wires so this driver is a unipolar driver but this structure is different this is a four wiress theer motor or a six wiress theer motor which common wires are left in the air in this structure the driver is able to apply either Source or ground voltages to each of A B C or D wires so the direction of current can be changed in driving wires for example if the driver applies Source voltage to a and ground voltage to B then the current will flow from A to B but if the driver applies Source voltage to B and ground voltage to a then the current will flow from B to a it means the direction of the current can be changed so this method is a unipolar method in short a unipolar driver needs a common wire hooked up to ground or Source voltage along with driving wires to drive a stepper motor but a bipolar driver can drive the stepper motor motor using only driving wires and doesn't need a common wire so five and six wire steeper Motors can be driven using either unipolar or bipolar drivers and the four wire reer motor is forced to be driven exclusively using a bipolar driver due to absence of common wire note that the direction of current in Ester motor inner windings has nothing to do with the direction of motion of motor shaft to drive a ster motor I mean to make the shaft turn clockwise or counterclockwise at a desired speed we need to apply proper voltages to these wires at right time if you look at the label on the motor you can find the basic properties of the motor for example on this six wire stepper motor those details are written here according to the information provided here on this label we have to apply 3.2 Volt or 0 volt to these wires to control the speed and direction of the shaft I'm going to call this 3.2 volt motor voltage to drive this stepper motor we need to hook up these two wires to motor voltage these are common wires and apply zero volts to these wires periodically these are a b c and d [Music] wires this is the step table of a full wave unipolar steper motor driver look at this table in first state 0 volt is applied to point a and other points are left in the air they are not connected in second state point B is grounded and other points are left in the air in third state Point C is grounded and in last state 0 volt is applied to point D to turn the shaft clockwise we need to apply these states in this order 1 2 2 3 4 1 2 3 4 periodically to the motor and to turn the shaft counterclockwise we have to apply these states in reverse order to motor like 4 3 2 1 4 3 2 1 4 3 2 1 repetitively the speed of rotation depends on how fast you go from state to state for example if you go like this 1 2 3 4 1 2 3 4 this will result in slow rotation of the shift and if you go like this 1 2 3 4 1 2 3 4 1 2 3 4 this will result in fast rotation of the shaft it is state is equal to one step and each step is equal to 1.8 Dee you may ask why is each step 1.8 de this is one of eser motor's characteristics it is written on the motor here it means that we need to apply 200 steps to the motor to make the shaft turn one complete Revolution I mean to make the shaft turn one complete Revolution we need to go through this table 50 times you may ask how do you make these State sequences on a circuit I'm going to answer there are several Solutions but one of most precise and easy solutions is to use a microcontroller GPI op pins of a microcontroller can generate the sequence of States easily but they can't deliver much current so we can't hook up theair motor directly to the microcontroller look here this stair motor draws about 1.2 ampers while the output pins on this microcontroller gpio can provide only few milliamps to drive this motor using this microcontroller we need intermediate circuit which is called a driver circuit there are two main approaches for making driver circuits to drive AER motor using transistors or driver I's like l298 L 6203 Etc both transistors and Driver ICS can be used to make either unipolar or bipolar drivers choosing right driver ccate and method is mostly depends on the application and the project you are working on in the this video I'm going to use transistors to make driver circuit and I will make a unipolar driver out of transistors note that to make a bipolar driver out of transistors you have to use a transistor structure called [Music] hbd these are tip 122 Darlington pair transistors that can switch loads up to 5 ampers and these LEDs are here for indicating the signal on microcontroller output terminals you also need to connect MOSI miso sdka and reset terminals on microcontroller to corresponding pins on the programmer I have used two pins here as input to control a speed of this per motor let's set up this circuit and test [Music] it [Music] look here the motor is running to make its movement more visible I'm going to stick this PCB to the shaft with these two tactile switches I'm able to control a speed and direction of the [Music] motor you may set up the exact same circuit with exact same program but it doesn't work for you in such a case it is likely that you didn't connect the driving wires in right order in this video I assume that the driving wires are in this order a to d but in real world sear Motors the order of driving wires may vary for example the order of driving wires on your ster motor maybe are in this order or this one or this one you can find the right driving VI order by Tri an error or referring to the data sheet look here at higher speeds the rotation of motor is almost as smooth but in low speeds discrete steps are clearly visible and completely sensible this is not acceptable in most applications what we can do there is a technique to make low speed steps smooth it is called micro stepping this technique is to divide each single step into desired number of substeps two 4 8 16 or even more how to do that let's see dividing a single step into two substeps is super easy if you are driving the motor using a unipolar method like what we are doing in this video you only need to expand this table into this one it is very clear these states between main states I mean this one this one this one and this one are combination of the main states you see in this state winding a is on on and winding B is off and in this state the winding B is on and winding a is off but in this intermediate State actually these two are on at the same time and create a half state to do this we just need to alter the code the driving circuit is okay let's try this this is running at full step and now it is running on half State you can see the difference this method is called half step or halfwave driving and now the steps are a bit softer than before but the steps are still rough and not completely smooth what we can do yes that's right the answer is simple to add more substeps but implementing this simple answer is not as simple as you expect we have to make some fundamental changes in the code to makes us able to control the force produced by each winding I know it is getting confusing let me explain this is the stepper motor and this one is the shaft suppose that here is the current step say point a and here is the next step say point B I'm going to zoom this area here to make it more visible in fullwave driving going from A to B was done at once and immediately in the half wve method the shaft would come here to this point in the first half step and go here in the next half step but in micro stepping me intend to hold the shaft in intermediate points almost everywhere between A and B to do that we need to apply proper voltage to winding wires to limit the current here is the point x the distance between point x and point a is D and the distance between point x and point B is 7times D suppose that you want to hold the shaft on point x then you have to apply 7/8 of motor voltage to winding a and 1/8 of the motor voltage to winding B the theory is really simple but there are two main problems in real world projects the first problem is to find the best and efficient method to control the voltage or current on each winding wire there are a lot of solutions for example pwm which is very simple and handy and it is controlling the current or voltage by increasing or decreasing duty cycle the second problem is so weird and will appear after implementing the pwm let's get started this is a table from previous sections let's look at it again State one is where winding a is active and all other windings are inactive state two is where winding B is active and all other windings are inactive state three winding C is active State four winding D an active winding means that the pwm on that winding is 100% and inactive winding means that the pwm on that winding is 0% so if you want to go from State one to state two in micro stepping you have to decrease the pwm on winding a to zero gradually in the same time increase the pwm on winding B from 0 to 100% in the same time when the pwm unwinding B reaches to 100% it means that the step is completed and you have to take the next step next step is to go from state two to state three where the winding C is active so the similar thing will happen here you have to decrease the pwm on winding B from 100% to 0% gradually and in the same time time you have to increase the pwm and winding C from 0 to 100% in the same time like this when the pwm unwinding SE reaches to 100% it means that this step is completed and you have to take the next step next step is to go from state three to State four you can repeat this process to take more and more steps I'm going to write the pwm based driving program and test the new driver the result is not what we expected the motor May vibrate like this and this is normal it is happening because of heterogenity between two pwm pulses on neighboring windings I know you thought that this was the second problem I already mentioned but no this vibration can be simply fixed by using four capacitors on transistor outputs actually these capacitors are converting pwm pulses into analog voltages like this actually these capacitors aggregate the pwm ontime voltage and form an analog voltage look at the shaft the vibration and the noise is gone and the movement of the shaft is a bit softer but still it is not what I expected after applying micro spping the movement of the shaft was not what I expected this is the second problem that I mentioned earlier this is the movement of the shaft before applying micro spping and this is the movement of the shaft after applying micr stepping this is a bit softer than before but it is still unacceptable what is the problem this is happening because the force produced by the winding is not linear I mean the amount of force the winding produces at 80% duty cycle is not four times bigger than the force produced by the same winding at 20% duty cycle they are extremely different and this fact cause highest thickness for for the shaft to the main step points solving this problem is not very difficult you have to select substep points nonlinearly I mean the distance between two substep points should not be equal for example I found these points for my stepper motor by trial and error and I'm using these instead of these which are selected linearly by equal distance of 32 these points are great although you can find better ones last thing to mention is the range of these numbers you may expect these numbers to be between 0o and 100 but they are not they are between 0 and 255 the reason is the resolution of pwm on microcontroller which is 256 this is why the minimum step point in these numbers is zero and the maximum step point is 255 so that's it that's done let's test these numbers and see see the result it looks great and now it is working just fine the method that is implemented in this video is not the only one to implement microing method and there are many other methods you can learn about them by the way I wrote the code in ATM studio for 80 Mega 8 AVR microcontroller and all the code for all three methods of driving a separate Motors are available there there is a link to that code in description so my friend I hope you enjoyed this video and learn something new thanks for watching if you find this video helpful please give me a thumbs up and if you like this video make sure to subscribe for more
Info
Channel: Electronic Wizard
Views: 53,703
Rating: undefined out of 5
Keywords: stepper motor controller, motor, stepper driver, stepper motor driver, hybrid stepper motor, electronics, microstepping, motor controller, stepper controller, motor driver, stepper motor, step motor, electric motor, bipolar stepper, microcontroller, stepper, pulse width modulation, PWM, half step, h Bridge, h-bridge
Id: hYk9Um9bdCY
Channel Id: undefined
Length: 24min 45sec (1485 seconds)
Published: Sun Nov 05 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.