Motor Control of an Oscillating Pendulum

Download Report

Transcript Motor Control of an Oscillating Pendulum

Motor 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
Presentation 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
Objectives
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.
System Level Block Diagram
User Input: Start/Stop
EMAC Motor Control and Sensor
Reading
Pendulum Oscillation
Angle
Subsystem Level Block Diagram
User Input
8051 MicroController
Board
EMAC to Hardware
Interface
DC Motor
Pendulum Arm
Pendulum Swing
Angle
Motor Power Supply
Feedback
Optical Sensors
Step 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
H-bridge Hardware
Truth table for forward and backward states
A
1
0
B
0
1
C
0
1
D
1
0
Motor Direction
Forward
Backward
H-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
EMAC 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
EMAC to H-bridge Hardware Interface
+15V
Rc1
From EMAC
Rc2
Rb1
Q1
80uA
Rb2
Q2
Re1
15uA
To H-bridge
H-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
H-bridge Microprocessor Code
Initialization of H-bridge by
setting 31H to 1
Yes
31H=1?
No
Output P1.5
Set 31H to 1
Output P1.4
Set 31H to 0
Flowchart
Initial 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
Initial Motor Pulsing Software
Turn on P1.4
and P1.5 and
set 31H=1
Yes
31H=1
?
No
Turn off P1.4
and set
31H=0
Turn off P1.5
and set
31H=1
Delay
Delay
Flowchart
Incrementing 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
Incrementing Motor Pulsing Software
Turn on P1.4 and
P1.5 and set
31H=1
31H=1?
Yes
No
Increase Delay
Length
Increase Delay
Length
Turn off P1.4 and
set 31H=0
Turn off P1.5 and
set 31H=1
Delay
Delay
Flowchart
Oscillation 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
Oscillation Stabilization Software
Turn on P1.4 and
P1.5 and set
31H=1
31H=1?
Yes
0
No
Times
sensor is
crossed
Times
sensor is
crossed
2
0
Increase
Delay
Length
2
1
1
Same
Delay
Length
Decrease
Delay
Length
Increase
Delay
Length
Turn off P1.4 and
set 31H=0
Delay
Same
Delay
Length
Decrease
Delay
Length
Turn off P1.5 and
set 31H=1
Flowchart
Delay
User 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
User 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
Constructed Pendulum
Optical 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
Optical 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.
Sensor 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
Initial 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.
Initial 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
Initial 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 > stored value - INCREASE BURST
LENGTH
• If value obtained < stored value – DECREASE BURST
LENGTH
Initial 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.
Summary of Progress





Completed H-bridge
hardware
Completed EMAC to Hbridge 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
Possible 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
Questions?