Sei sulla pagina 1di 6

Mini Project- Stepper Motor Control

Author: University of Hertfordshire Date created: Date revised: 2009

Abstract
The following resources come from the 2009/10 BEng in Digital Systems and Computer Engineering (course number 2ELE0065) from the University of Hertfordshire. All the mini projects are designed as level two modules of the undergraduate programmes. The objectives of this project are to design, develop and test software for an embedded system that will smoothly control the rotation of a stepper motor, taking into account the physical constraints on the maximum operating speed of the motor. Each student will be required to design a C program can rotate a stepper motor to a number of user-defined positions as quickly as possible. This will include sensing of the marker pulse, the implementation of an appropriate speed profile and the use of timer-generated interrupts.

Contents
Mini Project- Stepper Motor Control....................................................................................................................................1 Section 1. Project Introduction............................................................................................................................................2 Section 2. Tasks for Project Day 1......................................................................................................................................4 Section 3. Tasks for Project Day 2......................................................................................................................................5 Credits................................................................................................................................................................................6

In addition to the resources found below there are supporting documents which should be used in combination with this resource. Please see: Mini Projects - Introductory presentation. Mini Projects - E-Log. Mini Projects - Staff & Student Guide. Mini Projects - Standard Grading Criteria. Mini Projects - Reflection. You will also need the Mini Project- Stepper Motor Control presentation.

University of Hertfordshire 2009 This work is licensed under a Creative Commons Attribution 2.0 License.

Mini Project- Stepper Motor Control

Section 1. Project Introduction


1. Learning Outcomes assessed (as taken from the DMD)
All Learning Outcomes specified in the Definitive Module Documentation are assessed as part of this miniproject. The specific Learning Outcomes are:

Knowledge and Understanding


Be able to: Identify and enhance knowledge gained from other studies in areas relevant to the project topic selected.

Skills and Attributes


Be able to: Use relevant measurement instruments to analyse a defined electronic engineering problem relevant to digital systems or embedded computer systems. Synthesise a solution to a defined electronic engineering problem relevant to digital systems or embedded computer systems. Take, and analyse appropriately, test results from that solution. Carry out a simple critical evaluation of the results taken.

2. Project Title: Stepper Motor Control 3. Project Objectives: (technical, specific to this project)
Design, develop and test software for an embedded system that will smoothly control the rotation of a stepper motor, taking into account the physical constraints on the maximum operating speed of the motor.

4. Project Summary: (50 words max)


Each student will be required to design a C program can rotate a stepper motor to a number of user-defined positions as quickly as possible. This will include sensing of the marker pulse, the implementation of an appropriate speed profile and the use of timer-generated interrupts.

5. Introductory Lecture (2hrs) Content:


The importance of embedded system design, specifically structure charts and I/O Maps The MC68230 PIT board Addressing I/O ports Bit manipulation and masks

6. Preparation Session (3hrs):


The students will complete a design and programming task to generate specified patterns on the output pins of the buffered I/O port, controlled by the signals on the input pins. They could, for example, derive and output a parity signal from the inputs. This session will act primarily as a refresher about: The programming and development environment for the 68000 system Debugging (breakpoints, single stepping, watch windows, )

7. Day 1
Expected Outcomes for the day: The student will develop a program that will move the stepper motor to a number of positions specified by the facilitator. The pulses will be generated using delay loops and the program will poll for the marker pulse input. The program should choose the shortest distance between specified positions. Assessment criteria: a logical choice of I/O configuration; a methodical design/build/test sequence; well-structured and legible code including effective breakdown into functions and clear use of #define statements; correct operation of the programs at each stage. Key Tasks: 1. Specify an I/O map to show how the stepper motor is to be connected to the input and output ports. Page 2 of 6

Mini Project- Stepper Motor Control 2. Using a structure chart, design a program to generate the appropriate signals to rotate the motor, using delay loops. Implement and test the program. Perform experiments to choose a reasonable delay length. 3. Modify the design to position the motor at the marker pulse and then to execute a complete revolution, thereby counting the number of steps per revolution and deriving the angular travel per step. 4. Further modify the design to move the motor to a specified position and then to a sequence of positions specified by the facilitator, using the shortest distance between positions.

8. Day 2
Expected Outcomes for the day: The student will build on his or her experience on Day 1 to create an interrupt-driven system that will rotate the motor at a speed (in r.p.m.) specified on a number of input pins. The student will then investigate the range of speeds at which the motor can rotate, in the presence of different amounts of inertial load. The student will then be asked to rotate the motor a given number of times as quickly as possible while maintaining reliable positioning. Ideally the student will develop the idea of using a speed profile and will implement this. Assessment criteria; a methodical design/build/test sequence; well-structured and legible code including effective breakdown into functions and clear use of #define statements; correct implementation of interrupts; correct operation of the programs at each stage; a well-designed sequence of experiments to determine the best performance of the motor. Key Tasks: 1. Design, implement, and test a program to control motor revolution speed in terms of Hertz using the delay function. 2. Determine the maximum speed at which the motor will turn (from a standing start) with and without extra inertial load. 3. Modify your code so that the motor begins to rotate using the pulse rate, which gradually increases and then decreases. This is known as implementing a "speed profile". 4. Modify the design to complete a fixed number of revolutions as quickly as possible (using a speed profile). Demonstrate the performance of the system.

9. Facilitator guidance (key ideas to draw out from students):


Day 1: Need for clear design. Variations in motor positions. Benefits of reusable functions. Limits of open-loop control. Day 2: Relating processor speed to motor behaviour (e.g. speed). Impact of real-world effects such as inertia. Speed profiling.

10. Required Resources: Laboratory Facilities and Teaching Support.


Laboratory Resources: LD403 1. PC Workstations with development environment for 68000 Flight boards. 2. Main 68000 development boards, buffered I/O boards, stepper motor boards, detachable discs to attach to stepper motor dial to vary the inertia. Teaching Resources: 3. Briefing packs for the preparatory session and both practical days.

Page 3 of 6

Mini Project- Stepper Motor Control

Section 2. Tasks for Project Day 1


Write functions to perform each of the tasks listed below. You should demonstrate each task as you complete it. The code that you submit at the end of the day should include all of these functions. Initialise the motor by moving it to a standard starting position. Count the number of steps required for a full rotation of the motor. (Read the result using the debugger.) Perform this procedure in full-step and half-step mode. Design, develop and test a diagnostic start-up routine that moves the motor to its starting position, performs enough steps for a full rotation, and verifies that the motor is back in the starting position. Output a signal to indicate whether the test was successful. Move the motor to a position that the user has specified on the input switches. Move the motor through a sequence of 3 positions (4, 9, 2) that are stored in an array in the program. The motor must take the shortest route between the specified positions.

Page 4 of 6

Mini Project- Stepper Motor Control

Section 3. Tasks for Project Day 2


Perform each of the tasks listed below. You should demonstrate each task as you complete it. The code that you submit at the end of the day should include all of the changes described below. Your code includes a "delay loop" to control the rate at which pulses are sent to the motor. Perform experiments to relate the number of times the loop is executed to the pulse rate (in Hz). Modify your code to include a variable that represents the desired pulse rate (in Hz). Your code should convert this rate into an appropriate limit for the delay loop. Perform experiments to determine the maximum pulse rate that can be used to rotate the wheel. Attach the extra mass to the wheel. Repeat step 3 to determine the maximum pulse rate with the extra mass attached. Modify your code so that the motor begins to rotate using the pulse rate from step 5, and then gradually increases the pulse rate. This is known as implementing a "speed profile". Experiment to find out the maximum pulse rate that can be achieved in this way and the maximum rate at which the pulse rate can be increased. Optional Tasks: Notice that the motor will overshoot if it is moving at high speed and is stopped suddenly. Modify your code so that the speed profile includes a gradual increase in speed, followed by a period at constant speed, followed by a gradual deceleration. Using your speed profile, make the motor complete exactly 20 revolutions in as short a time as possible.

Page 5 of 6

Mini Project- Stepper Motor Control

Credits
This resource was created by the University of Hertfordshire and released as an open educational resource through the Open Engineering Resources project of the HE Academy Engineering Subject Centre. The Open Engineering Resources project was funded by HEFCE and part of the JISC/HE Academy UKOER programme.

University of Hertfordshire 2009

This work is licensed under a Creative Commons Attribution 2.0 License. The name of the University of Hertfordshire, UH and the UH logo are the name and registered marks of the University of Hertfordshire. To the fullest extent permitted by law the University of Hertfordshire reserves all its rights in its name and marks which may not be used except with its written permission. The JISC logo is licensed under the terms of the Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England & Wales Licence. All reproductions must comply with the terms of that licence. The HEA logo is owned by the Higher Education Academy Limited may be freely distributed and copied for educational purposes only, provided that appropriate acknowledgement is given to the Higher Education Academy as the copyright holder and original publisher.

Page 6 of 6

Potrebbero piacerti anche