CS223 Lab Assignment #5
Using the Step Motor
Lab date and time:
· Tuesday April 2, 2013
· EE 103 (in the EE building, on the left side of 1st floor as you leave the elevator)
Groups: Each student should find a partner and form a 2-person group. The group will work together in the lab. Students who have no lab partner will be assigned one by the TAs.
Lab Assignment
In this lab we are going to investigate the use of a stepmotor. A step motor (or stepper motor) is a brushless DC (direct current) electric motor that divides a full rotation into a number of equal steps.The step motor has permenant magnet rotor and electromagnets are placed at fixed intervals on the stator. The step motor on the experiment set is a permenant magnet, parallel coil step motor. Step motors operate by electrical pulses.When an electrical pulse is applied to its coils step motor will turn one step.Each step can be a small angle such as 3.75 degree or 7.5 degree etc. They can be controlled digitally and therefore can be used in plotters, printers, some medical instrumentz, robotics etc. In order to turn the motor one step a current pulse should be applied.

The step motor on the experiment set will move 7.5 degrees with a current pulse. In order to complete a 360 degree turn 48 pulses have to be applied. The frequency of the pulses determine the speeed of the step motor. The step motor you are going to use can do maximum 40 steps per second thus the period of application of the input pulses should be more than 25 milliseconds. The characteristics of the the stepmotor is given in the below table.
| Operating Voltage | 12 volts |
| Typical phase current | 175 mA |
| Stepping angle | 7.5 degrees |
| Maximum Speed | 40 steps/sec |
| Torque | 20 mMm |
| Weight | 170 gr |
The step motor requires 175 mA current which can not be supplied by the Basys card.(Basys cards output ports can give maximum of 12 mA.) Therfore the step motor is driven by a driver circuit contaning more powerful transistors. Thr Basys board outputs can than be connected to input of the driver. In order to operate the step motor following sequence of inputs should be applied to its four drivers.
For clockwise rotation 1010, 0110, 0101 1001 and for counter clockwise rotation 1001,0101,0110, 1010. After application of a 4bit input the motor will turn 7.5 degrees.
Preliminary Design Report
All groups should be prepared to submit their Preliminary Design Report at the start of their lab section time. You report should containing the following items, each starting at the top of a new page:
a) A cover page which includes the following (in order from the top): course name and code number, the number of the lab, your group number, the names and ID numbers of each member of the group, and the date of you submit the report.
b) The FSM for the driver which will drive the step motor. Verilog code for the driver. Testbench for your Verilog code.
c) Prepare the Verilog codes using the FSM for the step motor simulate driving a car. assume that the step motor is the wheels of your car. Your car operates as follows:
1- Use a switch on the BASYS board to Start or stop the car. When the car starts stepmotor turns clockwise.
2- Use 2 switches on the BASYS to specify the speed of the car.(Your car can have four different speeds 4 fastest 1 slowest,0 car stops)
3- Use another switch to reverse the car.(i.e your step motor should turn counterclockwise).
4- Show the speed of your car on the hex display.
5- Use the push buttons for signaling right or left. The signals will be the leds on your BASYS board.
Prepare testbench for testing your design of the car.
Note: Remember that the stepmotor maximum speed is 40 steps/second.
IMPORTANT NOTE: The Verilog modules are code, and as with any program code, they should be well-structured, well-commented, use meaningful identifiers, use white space and indentation as appropriate to facilitate understanding, and in summary, should be self-documenting. If code is difficult to understand, it is not self-documenting!
All pages in the report, with the possible exception of a hand-drawn logic diagram, should be printed, front side only. All pages should be on white A4 paper. Each page of the report should contain just one of the items listed below—do not put more than one design or Verilog code on a page. Each page should have a heading or title that clearly states what is contained on that page. The pages in the package should be stapled together in the order given, attaching in the upper left-hand corner. The whole package should have a neat, clean, professional appearance.
Of course you will need a copy of your designs and Verilog programs with you at all times in the lab: to work with, to refer to, to possibly correct and change, to discuss with the TA, to use in debugging. Therefore, you should make a photocopy of the Preliminary Design Report, for you and your partner to use during the lab.
In-Lab Demos
You should come to lab fully prepared. You are advised to arrive with the problem above fully implemented and tested and ready to work. Your grade will be based on the following:
a) You will also be asked to do simulation, using the testbench modules you created, for Verilog modules in Prelimniary work part(b) and (c).
b) Using the flat connecter given connect the Basys board outputs to step motor input terminal. Implement each of the Verilog code you have designed in the preliminary work. Do the Xilinx design flow (Synthesize, Implement, Create Programming File, and Download) to realize your design on the Digilent FPGA board. When you are convinced that it works correctly, show the physical implementation results to the TA, who will grade each demo of your designs.
c) Finally, the TA will ask each lab partner questions to check your knowledge and understanding of the project and Verilog, and you will receive a grade according to your answers. As a result, your grade and your partner’s grade might not be the same grade, depending on your answers to the oral questions.
Cleanup !
Clean up your lab station of all papers, trash, parts, wire, etc. Delete the Xilinx Project(s) you created and all the files you created today from the lab computer, so that the lab computer is in the same state that you found it. DO NOT leave any of your files on a lab computer!! Now turn off the computer, and leave your lab workstation for others the way you would like to find it—clean and organized.
NOTES