EE 308 -- LAB 13
Final Project - Motor Control
For your final project, you will use two HC11 boards as a motor controller (Figure 1). The two boards will be connected together through their SPI ports, one board acting as master and the other as slave. The slave board will control the speed of a motor using pulse width modulation, and will send the speed of the motor to the master board over the SPI interface. The master board will tell the slave board at what speed it wants the motor to run, and will display the speed received from the slave on its LEDs.
Figure 1: Block diagram for final project lab.
The master board will have a pot connected to it, which will be used to set the motor speed. The speed of the motor should be 0 RPM at 0 volts, and 3,000 RPM at 5 V.
The slave board will control the motor speed using pulse width modulation. It can control current through the motor by turning on and off an FET switch. The duty cycle (the percent of time the switch is turn on) controls the motor speed. A 100% duty cycle will yield maximum speed (about 3,000 RPM when Vmotor = 7 V), and duty cycles of about 10% or less will yield zero speed. An optical sensor attached to the motor will measure its speed. An LED sends light to an opto-transistor -- when the light from the LED can reach the transistor, the transistor will be turned on, current will flow through the 2.2 kOhm collector resistor, and the voltage at the collector will be about 0.5 V. A blade on the motor will momentarily block the light from the LED from reaching the opto-transistor. When this happens, the transistor will turn off, very little current will flow through the transistor, and the voltage at the collector will be about 5 V. This collector voltage is inverted and turned into a clean digital signal by the 74HC14 Schmitt trigger. By using a timer input capture pin to measure the period of the signal from the Schmitt trigger, you can determine the speed of the motor.
The slave board should receive the motor speed set point from the master board, and slowly increase the duty cycle of the pulse width modulation until the speed of the motor equals that commanded from the master. When the master commands the slave to reduce the motor speed, the slave should slowly decrease the duty cycle until the set point is reached.
Program the HC11s in the following way:
PA2 | PA1 | PA0 | | PIA Port B Function |
---|---|---|---|---|
0 | X | 0 | | Motor Set Point |
0 | X | 1 | | Motor Speed |
1 | 0 | 0 | | Up Counter |
1 | 0 | 1 | | Down Counter |
1 | 1 | 0 | | Flasher |
1 | 1 | 1 | | Turn Signal |
Table 1: PIA Port A inputs to control the PIA Port B functions.
Optional. Once you get this system working, program it into the EPROM version of the HC11 chip you received with your kit.