Andrew Radecki
Introduction:
The idea behind my project was to take a normal computer fan, make it run at one speed, change the speed, and have it revert back to the original speed. The goal, along with the actual implementation, was to have the fan achieve this as fast as possible, while still being relatively accurate. In order to assess the current speed of the fan, a light sensor was used which was able to detect a small piece of tinfoil placed on one blade of the fan.
High Level Design:

The implementation of my design used Hyperterminal to connect to the MPC823’s serial port. It initially asked the user to set the speed of the fan by adjusting the voltage. Next the user could change the speed. The fan would then adjust the dutycycle of the fan signal to adjust the speed higher or lower. Algorithmically, the program compared the current speed of the fan as it was just sampled to the user-defined goal speed and adjusted the dutycycle accordingly. The goal was to get within some fractions of the initial speed.
Member Task
Distribution:
Everything was completed by me.
Hardware Design:
The hardware design was relatively straight forward. The fan output pin was memory mapped. Writing a 0 or a 1 to the fan’s location in memory changed the value on the output pin from 0 to 1 respectively. The speed of the fan was controlled by alternating switching the fan on and off according to a dutycycle. The input from the light sensor was directly connected to an external interrupt.
Software Design:

User input to the system occurred via the Hyperterminal serial port connection. All interactions with the serial port were done through C programming. The user only interacted with the system via the serial port. The system communicated between C and assembly via two global variables. One controlled the current dutycycle of the fan, the other the current time of the sensor. The sensor’s timer constantly counted up until it reached its maximum value. It was up to the C function to determine the difference between timer values to determine the current speed of the fan. Once the current speed of the fan was determined, it was compared with user-defined value and used a simple algorithm of adding/subtracting from the dutycycle to adjust the speed of the fan. When the fan speed was within a sufficiently close speed range, the system ended, announcing that the speed had been adjusted.
Results of the
Design:
In the end, everything worked as it should. The speed had to be set low and ramped high, as the dutycycle could not be adjusted enough to the high end to ramp the speed back up unless the change was very slow. The algorithm to adjust speed worked relatively quickly. Throughout the design process, the main issues arose with the interrupts and implementing 2 timers at once. Initially my plan was to reset the timer which counted the time between sensor interrupts every time it was actually interrupted. After spending much too long trying to get this to work, I ended up simply letting the time count for ever and restart automatically and merely comparing sequential values placed into the global variable. The only issues that arose from this were ensuring that the comparison was actually between a different counter values and the “wrap-around” when the timer reached its maximum value.
Conclusions:
I did not need more processing power and no special circumstances arose with my components. I would have very much liked to stream-lined the actual presentation of my project, but time did not allow me to do so. It would have been nice to allow the user to define an initial speed via manually setting the dutycycle or using a Nintendo-8 controller. A user friendly menu also would have greatly enhanced the final presentation of the project. Additionally, I would have liked to display the actual speed the fan was spinning at, either via the serial port or by an external LCD.