Difference between revisions of "ME 333 Lab 4"
Andrew Long (talk | contribs) |
Andrew Long (talk | contribs) |
||
Line 5: | Line 5: | ||
The PIC32 is going to generate a square wave reference signal (ref) that will cause the motor to alternate between two positions. This reference signal could be changed to any arbitrary signal such as a sinusoid or a triangle wave, but for this lab we are going to stick with a square wave. The period and amplitude of the square wave will be analog inputs to the PIC32. |
The PIC32 is going to generate a square wave reference signal (ref) that will cause the motor to alternate between two positions. This reference signal could be changed to any arbitrary signal such as a sinusoid or a triangle wave, but for this lab we are going to stick with a square wave. The period and amplitude of the square wave will be analog inputs to the PIC32. |
||
The quadrature encoder creates two signals similar to those shown below. These signals will be sent to a encoder/decoder chip that converts the signals into up and down counts to be sent to the PIC32. The up and down counts will be read by the PIC32 and converted into a position for the motor (output). |
The quadrature encoder attached to your motor creates two signals similar to those shown below. These signals will be sent to a encoder/decoder chip (LS7083) that converts the signals into up and down counts to be sent to the PIC32. The up and down counts will be read by the PIC32 and converted into a position for the motor (output). This algorithm will be explained in further detail in encoder section. |
||
The error is the difference between the reference signal and the output. The error will be sent to a controller, in this case a proportional controller and converted into an input signal (u). This is shown in the equation below: |
The position error is the difference between the reference signal and the output. The error will be sent to a controller, in this case a proportional controller and converted into an input signal (u). This is shown in the equation below: |
||
The input signal is then converted into a PWM to cause the motor to move and produce a new output. |
The input signal is then converted into a PWM to cause the motor to move and produce a new output. |
||
Line 13: | Line 13: | ||
So how do we do this? |
So how do we do this? |
||
First, we are going to write the code in which we will learn about the following topics: |
First, we are going to write the code in which we will learn about the following programming topics: |
||
*Timers |
*Timers |
||
*Interrupts |
*Interrupts |
Revision as of 16:41, 21 January 2010
In this lab, we are going to use the PIC32 microcontroller to control the motor's position with a proportional feedback controller. A block diagram of the overview of this lab is shown below.
The PIC32 is going to generate a square wave reference signal (ref) that will cause the motor to alternate between two positions. This reference signal could be changed to any arbitrary signal such as a sinusoid or a triangle wave, but for this lab we are going to stick with a square wave. The period and amplitude of the square wave will be analog inputs to the PIC32.
The quadrature encoder attached to your motor creates two signals similar to those shown below. These signals will be sent to a encoder/decoder chip (LS7083) that converts the signals into up and down counts to be sent to the PIC32. The up and down counts will be read by the PIC32 and converted into a position for the motor (output). This algorithm will be explained in further detail in encoder section.
The position error is the difference between the reference signal and the output. The error will be sent to a controller, in this case a proportional controller and converted into an input signal (u). This is shown in the equation below:
The input signal is then converted into a PWM to cause the motor to move and produce a new output.
So how do we do this?
First, we are going to write the code in which we will learn about the following programming topics:
- Timers
- Interrupts
- PWM
After programming the PIC32, you will construct the circuit for this motor controller. This circuit will include the following information:
- H-bridge
- Motor with Encoder
- Encoder/Decoder Chip
After the circuit has been created, we will test the feedback control with different proportional gains (Kp).