Tuesday, July 26, 2016

Simulink Angle Encoder Feedback Motor Control

This is a continuation of the MATLAB and Simulink Incremental Rotary Angle Encoder post.

Controlling an Elevation Motor based off of Angle Error

This is where the fun starts. 



Using the current angle output of the Angle Encoder Subsystem (AES) and the User's Desired Angle (UDA) another subsystem must be made within the model to correct for the error.

The components connected to the output of the AES are to be explored in the following sections. The Current Angle is subtracted from the Desired Angle via a summing block. This output is then fed into the input of the Elevation Angle Error Subsystem that corrects the motor position based of the input.

TO BEGIN a look at the Elevation Angle Error Subsystem is necessary to see how Simulink will correct the motor position based off of the error input. When the error is 0 the elevation motor will not spin, it does not need to, when the error is positive it will spin one way and when negative in the other. When the error approaches 0 the motor will spin at a slower rate than when the error is far from zero. This block utilizes the Proportional Control of a PID Controller. Using P control has shown to be useful because the power supply used to drive the elevation motors have regulators in remote mode. 

Check Out this blog's ending to see how to hook up the relays for direction changing. To operate in remote mode with Dr. Mark's Agilent Power Supply is reasonably challenging. For this there is a blue binder with the instruction manual within it, with my notes. The link above will explain which pins on the unit to plug into but you must first properly set the power supply into remote mode. This may take a half hour, it is okay. 


Elevation Angle Error Subsystem (Opened)

By now you need not explanation of how this works. By following the paths one can figure out the if statements and outcomes of this system. The only part which does need to be explained may not be evident to the folks who are not familiar with the arduino's Pulse Width Modulation (PWM) function. Before the speed control writing pin receives information that information is checked against a reference. If the number is below a reference number it is left alone, if it is above this reference number the output is the reference number. The block which is responsible for this action is the Saturation block. The arduino's maximum input for a PWM value is 255, do not exceed this value. If this value is exceeded the program will shut down because the arduino force quit all and any operations.

You ought to never have a PWM value that high. During field testing, with proper tuning of the power supplies for the drive, VIPER moved well when the PWM value neared high 30's range, this can be adjusted later on and is not going to destroy lab testing. The lab testing for this model never exceeded 60 as we observed no noticeable change past that point on the power supply's gauges.

Using this Model in the Laboratory Setting

View this YouTube Upload to see what this section accomplishes.

Although an explicit circuit diagram would be useful, I am withholding all and any drawings until I am told to release them. I would rather the next student who picks up this project figure out the H-Bridge I made and where each wire from the arduino goes because that is the best way to learn, to do it. Also, the circuit I made will most likely be intact. Dr. McColgan and Dr. Hassel will have the circuit diagrams if you truly do get stuck. I was able to figure it out after taking the Electronics and Experimental Techniques class, although I believe you only will require Electronics to figure the whole thing out. Experimental techniques just was a humbling class which made this mountain of a project manageable since we also learn how to tackle big labs in the course.

Using this Model in the Field Setting

The first step to do this is to CAREFULLY wheel the power supplies and circuit out of the Roger Bacon and Morrell breezeway to get to VIPER, this is the easiest way. 
Top Elevation Motor Connector Pinout

The Connector installed on
the top Elevation Motor.
These connections are for the top elevation motor only, they are important to take note. The cable that connects to both the bottom elevation motor (full operation mode) and directly to the power supplies *(testing only). Ports A and E are the drive pins, V+ and V- respectively, and Ports C and D are the brake pins. To disengage the brakes apply 90 VDC across the brake pins.
To spin the motors apply voltage across the drive pins, these pins will flip between +/- depending upon the direction needed. This is not an AC circuit but a DC circuit that changes polarization on command via the H-Bridge. 









1 comment:

  1. Hello everybody,

    I wish to know how to use serial Receive port for arduino. I try to use it but I have already a problem with the port configuration, it return to me an error

    ReplyDelete