Title: Motor Control of an Oscillating Pendulum
1(No Transcript)
2Motor Control of an Oscillating Pendulum
- Nick Myers and Chirag Patel
- March 9, 2004
- Advised by Dr. James Irwin and Mr. Jose Sanchez
- Bradley University Department of Electrical
Engineering and Technology
3Presentation Overview
- Project Objectives
- System Block Diagrams
- Step by Step Project Goals
- Work Completed - Hardware (Nick)
- Work Completed - Software (Nick)
- Work Completed - Hardware (Chirag)
- Work Completed - Software (Chirag)
- Initial PWM Design Plan
- Summary of Progress
- Possible Additions
- Questions
4Objectives
- To initialize the oscillation of a weighted
pendulum using microprocessor controlled motor
bursts. - To oscillate the pendulum to a predefined angle
and, using optical sensor outputs, maintain the
angle of oscillation.
5System Level Block Diagram
6Subsystem Level Block Diagram
7Step by Step Project Goals
- H-bridge hardware
- EMAC to H-bridge interface hardware
- H-bridge switching software
- Initial motor pulsing software
- Incrementing motor pulsing software
- Optical sensor hardware
- Optical sensor interrupt software
- Oscillation stabilization software
- User interface software
- Pendulum construction and wiring
8H-bridge Hardware
Truth table for forward and backward states
9H-bridge Hardware
- The H-bridge uses (2) N-Channel ZVN4206
Transistors and (2) P-Channel ZVP2106 Transistors
- The H-bridge operates on a supply voltage of 15V
DC - The inputs of the active transistors are pulled
to Vcc - The voltage across the motor is approximately 12V
10EMAC to H-bridge Hardware Interface
- All of the outputs from the EMAC microprocessor
board come from Port 1 - Port 1 supplies 80uA of current
- Additional hardware must be added for EMAC to be
able to turn the H-bridge on/off
11EMAC to H-bridge Hardware Interface
From EMAC
To H-bridge
12H-bridge Microprocessor Code
- The H-bridge will switch motor burst direction
every time the pendulum passes equilibrium - Once the direction is switched, a burst will
immediately be sent - The H-bridge code will be called by the
equilibrium sensor interrupt - The H-bridge code will switch motor polarity by
switching on/off two pins on Port 1
13H-bridge Microprocessor Code
Flowchart
14Initial Motor Pulsing Software
- The equilibrium sensor will always be blocked
initially - Interrupt driven pulsing cannot be used to begin
pendulum oscillation - A constant pulse must be provided until the
pendulum clears the equilibrium sensor
15Initial Motor Pulsing Software
Turn on P1.4 and P1.5 and set 31H1
31H1?
Yes
No
Turn off P1.4 and set 31H0
Turn off P1.5 and set 31H1
Delay
Delay
Flowchart
16Incrementing Motor Pulsing Software
- Once the Pendulum has successfully cleared the
equilibrium sensor, the length of the torque
bursts can be increased - The bursts will only be sent when the equilibrium
sensor is crossed - These bursts will continue to increase in length
until the angle sensor is crossed
17Incrementing Motor Pulsing Software
Flowchart
18Oscillation Stabilization Software
- When the pendulum reaches its desired angle of
oscillation, it should remain constant at that
desired angle - Once the pendulum passes the angle sensor, the
interrupt handler will check how many times the
sensor is crossed - If the pendulum is overshooting the sensor, the
delay will be shortened
19Oscillation Stabilization Software
Flowchart
20User Interface Software
- On startup, the LCD prompts the user Press A
to Begin - The program is waiting to be interrupted by the
keypad button A - When the keypad button A is pressed, the
initial motor pulsing software is entered and the
pendulum begins its oscillation
21User Interface Software
- As the initial motor burst software is entered,
the LCD display changes to Press B to Stop - After every motor pulse, the code checks to see
if the button B has been pressed - If the button has been pressed, the motor is
turned off and the the LCD is reset to the
initial prompt
22Constructed Pendulum
23Optical Sensor
- Two optical sensors
- Equilibrium Sensor
- Predefined Angle Sensor
- RF 200
- Limits Current to 20 mA
- IF 5V/200 20mA
- Enough Current to transmit infrared signal
- Not Enough Current to Damage Optical Sensor
24Optical Sensor
- R1 4700 to account for desired on/off switching
times - ON Switching Time
- 8us 1.7 14.4 us
- OFF Switching Time
- 50us 1.6 80us
- Equilibrium and Predefined Angle Sensor Have Same
Values.
25Sensor Initialization
- Equilibrium Sensor
- Handled by Interrupt 3
- Once obstructed Rerouted to code in order to
output motor burst - Predefined Angle Sensor
- Handled by Interrupt 4
- Once obstructed Rerouted to code in order to
count the number of obstructions - Used to determine overshoot or undershoot
26Initial Design Plan
- PWM signal will be used to initiate the
oscillation of the pendulum. - Once pendulum is beyond the equilibrium sensor,
timed pulse signals will be used to oscillate the
pendulum.
27Initial Design Plan
- Pulse Width Measurement code used to measure
length of time sensor is obstructed by pendulum. - This time will be used to control the length of
the pulsel sent to motor to control oscillation
of pendulum. - Faster the oscillation Smaller pulses
- Slower the oscillation Larger pulses
28Initial Design Plan
- Pulse Width Measurement
- Timer 2 used in gated mode
- When P1.7 High
- Timer begins counting
- When P1.7 Low
- Timer stops counting
- Obtain time value through pulse width measurement
when pendulum is dropped from desired angle. - Compare that value to value obtained each swing.
- If value obtained gt stored value - INCREASE BURST
LENGTH - If value obtained lt stored value DECREASE BURST
LENGTH
29Initial Design Plan
- Initial design was not used due to the
complications encountered - Proved to be more time-consuming than expected
- However, this design can be used for changing
loads.
30Summary of Progress
- Completed H-bridge hardware
- Completed EMAC to H-bridge hardware interface
- Completed H-bridge software
- Completed initial motor pulsing software
- Completed incrementing motor pulsing software
- Completed optical sensor Hardware
- Completed optical sensor interrupt software
- Completed oscillation stabilization software
- Completed user interface software
- Completed pendulum construction
31Possible Additions
- Adding additional angle sensors so that user may
choose from multiple angles of oscillation - Changing initial motor pulsing code so that
changing loads could be oscillated - Creating power storage circuitry so that system
could run from a lower supply voltage
32Questions?