Introduction: Stepper Meets Arduino Complete Guide ( L293D,RMCS-1106)
hello, guys in this instructable we will discuss about stepper motor basics their working and stepper motor driver RMCS-1106. So lets get started.
First of all what is a stepper motor?
Stepper motor is a brushless DC motor as same as other motors stepper motor also has to parts rotor and stator the rotor has permanent magnets on it and stator contains multiple winding or we can say poles. So when we apply power to motor the current will flow through the windings and they will react as electromagnet by which rotor will move single step after that second winding will energized and rotor will move another step. As we can see stepper motor moves step by step that's why it is known as stepper motor.
Step 1: Types of Stepper
There are basically 3 types of stepper motor
Note : anticlockwise current flow creates north pole and clockwise current flow create south pole
1. Permanent magnet stepper motor
As shown in figure 1 you can see that in figure the motor has 2 pole (north and south) rotor which are permanent magnet and 4 pole stator which are electromagnets and has winding A,B,C & D respectively. Winding A and C and winding B and D are connect in such a way that when the current flows through them one will act as North pole and another will act as south (for example if A is north pole then C will act as south pole). sometime winding C and D are also named as A' and B' respectively so don't get confuse. so when we apply power supply across winding winding B will act as south pole and winding A as North pole so winding A will repel the rotor and the D pole will also act as north( because B is already south) so the rotor will move towards B and hence one step is complete then pole C will act as south pole and B as North pole then D will became South then A and it will start moving clockwise.
2. Variable reluctance stepper motor
In this type of stepper motor stator contains windings same as permanent magnet but the rotor contain teeth shaped small magnets. The principle of Variable Reluctance Stepper Motor is based on the property of the flux lines which capture the low reluctance path. The stator and the rotor of the motor are aligned in such a way that the magnetic reluctance is minimum. The six phase are connected to a DC power source when winding 2 is connected then it will attract rotor pole and hence one step is completed
3. Hybrid stepper motor
This type of motor is combination of first two types of motor as shown in gif file the rotor contains number of teeth and stator poles also have teeths on it when we connect power supply to it the windings will get energized and attract rotor poles and hence one step is completed
Step 2: Types on Basis of Winding Connection
You may have seen 4,5,6 or even 8 wire stepper motor have you ever think why they have different number of wire? Why? Here is the answer there are 2 Types of stepper motor on basis of winding connection
1. Bipolar stepper motor
In Bipolar stepper motor as shown in figure leads on each coil brought in two ways the current will flow in bidirectional way and each lead is taken separately( 4 wire stepper) this allow stator poles magnetized north or south The driving circuit needs to be more complicated to reverse the magnetic pole, this is done to reverse the current in the winding. This is done with a H-bridge arrangement
2. Unipolar stepper motor
In unipolar stepper motor the current will flow through only half winding as shown in second figure in each winding one lead comes out also known as center tap in each winding the center tap lead can be connected to gnd or vss so as u can see it has 6 wires but when we connect each center tap internally only one wire comes out then it will became 5 wire motor. and when each winding is divided into 2 parts as shown in figure one it will became 8 wire stepper motor.
Step 3: Stepping Techniques
Before moving forward we must know the meaning of step resolution. So step resolution is a measurement of angle which is covered by one step hmmm confused?. okay lets take a example lets say we have a stepper motor which completes its one rotation in 200 steps.
Number of steps = 200
and as we know that one full rotation means 360 deg. rotation around its axis
so step resolution of this motor will be = 360/200 = 1.8 deg
which means our stepper will cover 1.8 deg each step
There are 3 kinds of stepping techniques as follow
1. Full step
As shown in picture of full step waveform first winding A will energized then after some time delay it will deactivated and winding B will energized and rotor will move toward B winding and hence one full step is taken by our stepper motor after that B will deactivated and C will energized and rotor will move toward C winding and then D (same process). There are 2 types of full step excitation mode.
First one winding excitation which is discussed above as you may notice now that in that process only one winding is excited(energized) at a time.
Second 2 winding excitation in this mode instead of just pulling from front we also push it from back. what i mean is when the coil B is energized it will pull rotor towards and at the same time coil A will push rotor toward coil B (current will flow in reverse direction) because of pushing and pulling this mode gives 30-40% more torque than first one (pros +1) and it will also improve speed (pros +1) but as you can see 2 coils are energized at the same time which means it requires double power ( cons +1) but who cares about power ( no offense ) that's why we prefer this mode over first one
2. Half step
As the name suggest half step which means one full step is now divided in 2 parts. As shown in picture of half step wave form we can see that first rotor is attracted at coil A then after some delay coil B is also energized now both coils are attracting rotor so it will move half way toward coil B for equilibrium position LHS force = RHS force then coil A is deactivated and now the rotor is at coil B this very same process is repeated hence its called Half step
Sometime we need more accurate system generally we have 1.8 deg step resolution and even if we apply half step we can only obtain 0.9 step resolution 0.9 deg is pretty accurate but there is a way because after microstepping we can obtain 0.007 deg resolution this is insane right. Microstepping is a technique by which we divide one full steps into number of steps we can say that half step is a kind of microstepping in which 1 full step is divided into 2 we called it 1/2 microstepping.In present(2017) we can divide one full step into 256 part (1/256 microstepping). In microstepping let say coil A is fully(10/10 parts u will understand this later) energized the rotor is now pointing at coil A but after some delay we decrease current which is flowing to coil A 10/10 to 9/10 and this one part of current is give to coil B (1/10) so the rotor is sightly move toward coil B then we keep decreasing coil A current slowly and on other hand we increase coil B current and the rotor will move towards coil B slowly and smoothly. Microstepping is more accurate and smooth in functioning but as we increase microstepping torque will also decrease
Step 4: Stepper Connection With Arduino Through L239D
In this section we will drive our motor with L293D motor driver. L293D is a very common and popular motor driver it can drive 2 DC motor or one stepper motor at a time. Now lets discussed about circuit as shown in figure it is quite easy to connect usually we don't use arduino +5v to drive our motor. Why? because arduino signals are noisy and digital pins can only supply upto 5v 40mA (which is not sufficient) so there is a pin(8) which can provide a external power source to motor drive in this tutorial we use 12v 1A power supply (L293D can work upto 36v). Ground is common so you can directly connect external power supply ground to arduino.
L293D chip can be divided in 2 parts left or right each part can control one DC motor separately
1 and 9 :- These are enable pins which controls motor output pins these should be high in normal working conditions.
4,5,12 and 13 :- These are ground pin must be connected to ground
2 and 7 :- These are these are motor driver input pins which controls the polarity. In case of DC motor if pin 2 is high and pin 7 is low then the motor will move clockwise and if 7 is high and 2 is low then the motor will move anticlockwise.
10 and 15 :-These are also motor driver input pins same functions as pin 2 and 7.
3,7,11 and 14 :- Are motor driver output pins which are connected to motor.
Here is a program that will move stepper motor 360 deg clockwise and then 360 deg anticlockwise
Step 5: RMCS-1106
Rhino motor control RMCS-1106 is a microstepping motor driver for 1.8deg step resolution bipolar motor can be operated between 12VDC - 40VDC 2A. for more information you can refer to datasheet give below.
As shown above RMCS-1106 can be connected in 3 ways. First one is differential we don't really use that way because we need more wires and it will also take 3 more pins of our microcontroller. So now we have 2 other options PNP and NPN we can use any of these but we always prefer PNP(common ground) because when we send 1(high) to any pin (pul+, dir+, ena+) circuits gets complete. Don't get confuse because of + & - signs these signs are two terminals of each circuit positive(vcc) and negative (or ground).
pin description (PNP)
Vcc and ground as you may know these pins are used for power supply
Pul+ :- Pul means pulse when we give a pulse on this pin the stepper motor will take one step.
ENA+ :- ENA means enable this pin is used to enable the driver operations if this is low the driver won't work
Dir+ :- This pin is used for direction high means clockwise and low means anticlockwise
A,A',B and B' these pins are motor coil inputs should be connected to stepper motor
You may see 8 switches First 3 switches are used to control output current Max 1.8A and last 3 switches are used for microstepping Max 1/32. You can see there combination on the label.
Now some mathematics
so here is the condition.
You want to move your Stepper motor 180 deg clockwise and then 180 deg anti clockwise in fullstep at 36 deg/sec. Delay calculation or we can say that time interval between each steps
Step resolution :- 1.8 deg
Speed :- 36 deg/sec
Number of steps taken = 180/1.8 = 10 steps
Time taken to reach 180 deg = 180/36 = 5sec
Time taken by each step = 5/10 = 0.5 sec
Now see the program code u will understand why we calculated delay time in this case
Step 6: I Really Don't Know What to Write Here Soo Its Nothing I Guess :p
Thanks for reading this article i hope u guys enjoyed reading
all photos where taken from google image or from my rough notebook :P
if you guys have any doubts or query please comment below
see you next time \m/
Participated in the
Arduino Contest 2017