ME 333 Lab 4

From Mech
Revision as of 17:06, 21 January 2010 by Andrew Long (talk | contribs)
Jump to navigationJump to search

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 the 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).



-Programming-