![]() ![]() |
|
| Home | Team Members | Mechanical Design | Electrical Design | Software Design | Results | |
|
|
Software DesignThe software we developed needed to assimilate the sensory input from the on/off switch, the Hall IC, and the potentiometer and produce an output to the motor. The digital input from the Hall IC goes high during the time the magnet is in close proximity to the sensor. With a single magnet on the pedals, the rising edges of the signal correspond to a single rotation. The software determines the time between successive rotations and calculates an angular velocity in RPM. This is known as the rider's cadence, a desired pedaling pace. For demonstration purposes, we determined our desired pedaling cadence was 50 RPM and set the up/down shift thresholds to 60 and 40 RPM, respectively. When the rider crosses one of these thresholds when the system is on, and the bike is not in the maximum gear if the rider has exceeded 60 RPM or the minimum gear if the rider has slowed below 40 RPM, a "desired gear" is set. The current gear is determined by the voltage reading off the potentiometer via the analog input. A Matlab function converts this voltage into a gear number. The voltage ranges were determined through a thorough unit test and statistical analysis. When the desired gear is not identical to the current gear, a signal is sent to the analog output equal to the difference between the two. Gain is added to amplify the difference signal to a voltage sufficient to run the motor. By using this sign convention, we easily control which direction the motor turns. When the motor has turned enough to change the current gear, the desired gear and current gear are once again equal and a zero signal is sent to the analog output. In addition, in order to give the user time to adjust to the new gear, a three-second delay is implemented before the system is allowed to attempt another shift, if needed. The full Simulink model is available here. We used a timestep of dt = 0.01 seconds when compiling it to run in stand-alone mode on the PC104 stack. |
Created to fulfill the requirements for MECH_ENG 333: Introduction to Mechatronics - Winter 2006 |
|