 Hello, Myself, Ravindra Chauhan, Assistant Professor, Department of Electronics Engineering, Vulture News of Technology, Solaapur. So in this session we will discuss the stepper motor interfacing with the 8051 microcontroller. So at the end of this session student will be able to apply the concept of stepper motor interfacing in controller based system design. The outline of this session will be, first we will go through the construction of stepper motor, then the interfacing of stepper motor with microcontroller 8051, then program to rotate the stepper motor. Now the stepper motor is a brushless DC motor, it can be rotated in small angles and these angles are called steps itself. Generally the stepper motor use 200 steps to complete the 360 degree revolution. Since it rotates 1.8 degree per step, 1.8 degree per step means 360 divided by 200. Now the stepper motor normally used in many devices where it needs the precise rotational movement like the robots, antennas, hard drives etc. Stepper motor can rotate at any particular angle by giving the proper instructions. Now basically there are the two types of stepper motors the unipolar and bipolar. So unipolar stepper motor generally has the five or six wires. So in which four wires are one end of four stator coils. So here the four coils are there 1, 2, 3, 4 and four wires means one end of these four coils. So A, B, C and D. And other end of the all four coils is tied together which represents the fifth wire and this is called the common point or common wire and generally there are two common wires. See one is here and one is here for by connecting one end of the two coils as shown in figure. So unipolar stepper motor is very common and popular because of its ease of use. In bipolar stepper motor there is just four wires coming out from two sets of coils means there are no any common wire. So stepper motor is made up of stator and rotator. So the main parts of the stepper motors are stator and rotator. Rotator represents the four electromagnet coils which remains stationary around the rotator and the rotator represents permanent magnet which rotates and whenever the coils energized by applying the current the electromagnetic field is created resulting the rotation of the rotator. And rotator is nothing but it is a permanent magnet. So coil should be energized in a particular sequence to make the rotator rotate. On the basis of this sequence we can divide the working method of unipolar stepper motor in three different modes wave drive mode full step drive mode and half step drive mode. So what is wave drive mode? In this mode one coil is energized at a time. All four coils are excited one after another. It produces less torque in compare with full step drive mode but power consumption is less. Following is the table for producing this mode using the microcontroller means we need to give logic one to the coils in the sequential manner. Now see here only one coil is excited. So first step A coil is excited next B next C and next D in a proper sequence. You can start from anywhere but you have to follow the sequence either this or this. In this two coils are excited at the same time. The power consumption is higher. We need to give the logic one to two coils at the same time. And then the next two coils and so on. So here see in the first step the two coils A and B are excited. And in the second step B and C are excited then C and D and then D and A. So you have to follow this proper sequence. You can start from the step two but step two, step three, step four and again step one. So when you are sending this one sequence the motor will rotate by 1.8 degree. In the off-drive mode in this mode one and two coils are excited alternatively. Means firstly one coil is excited then the two coils are excited. Now see here in the step one only A is excited in the step two A and B are excited. Then B, B and C then C next C and D. So this is the combination of full and wave drive mode. And used to increase the angular rotation of the motor. Now interfacing with 8051 is very easy. We just need to give the zero and one to the four wires of stepper motor. According to mode we want to run the stepper motor. And rest two wires should be connected to a proper 12-volt supply. Now here we have used the unipolar stepper motor. We have connected four ends of the coils to the first four pins of the port one of 8051 through the ULN 2003A like this. So port 1.0 to 1.3 is connected and this ULN 2003 is used because whatever the current drawn by this port pins is not sufficient to excite the coils of the stepper motor. So to boost this or to amplify this this ULN 2003 is used. So this ULN 2003 is also referred to as the driver device which is used to drive the coils of the stepper motor. Now here take one example. Write the assembly program to rotate the stepper motor in clockwise direction continuously. Use four step sequence. So let four step sequence is stored in internal data memory from address 30h and this sequence is nothing but this 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 0 1 1. This is the standard sequence that is stored at address 30. So what is the requirement first read this first sequence and send to the port one where the stepper motor is connected. Next go to the second sequence send to the port one and do this continuously so that motor can rotate continuously. So here move r0 hash 30h means r0 is loaded with the 30 to point over the required sequence. Then r2 equal to 0 4 because the number of sequences are 4. Then load the accumulator with this first sequence and send to the port A send to the port one wait for some time. Go to the next sequence by incrementing r0 you check how many sequences are transferred so decrement the r2. If r2 is not equal to 0 again as jump. So if r2 is not equal to 0 back load the accumulator with the next sequence send to the port one wait for some time go to the next sequence. When r2 is 0 means all these four sequences are transferred again you start from the beginning do the same things again and again so that the motor can move in continuously. Now write a program to rotate a stepper motor for two revolutions. Now let motor with a 2 degree step angle means after sending the one sequence the motor will move by 2 degree. So the steps per revolution will be 180 360 divided by 280. So movement per four step sequence is 8 degree 2 into 4 is 8. So to move the rotor 360 degree we have to send this sequence how many times 45 consecutive four step sequence. So to move the motor for two revolutions we have to send 90 consecutive four step sequence. Now you think how to modify the previous program for this. References the 8051 and embedded C programming by Majidi microcontroller from Ajay Deshpo. Thank you.