Professional Documents
Culture Documents
03/04/2012
This page shows the percentage contribution made by the group members (Queron Williams & Adam Waterman) over the last year. Section weightings 12.5% 12.5% 25% 50% Contribution per section Queron Adam Williams Waterman 50% 100% 100% 100% 50% 0% 0% 0% Total percentage Queron Adam Williams Waterman 6.25% 12.5% 25% 50% Total Queron Williams 93.75% Adam Waterman 6.25% 6.25% 0% 0% 0%
Sections 1st term presentation 2nd term presentation Control report Final report
Queron Williams:
date:
Adam Waterman:
date:
03/04/2012
Control Report
Micromouse
Queron Williams and Adam Waterman
03/04/2012
Introduction:
This is a report documenting the modelling, simulation and testing the dc motor that we will be using in our Micromouse project. The model of the dc motor will help me understand the characteristics of the dc motor and tune my mouse for a better performance.
DC motor Modelling: Building a model of the motor allows us to design appropriate controllers and test them in simulation quickly, easily and without risk of damaging anything. To allow us to easily model the motor I used Laplace Transforms. This converts differential equations into algebraic equations, making them much easier to solve. The Laplace transform converts
a function f(t) from the time domain to the frequency domain F(s). Once in the frequency domain the equations may be put into and transfer function which allows us to see how a system acts on an input. Many different Laplace transforms can be found online. The ones which we need are given below:
Constants L(R) = R, Function of Time L(I(t)) = I(s), Derivatives of Time L( dI/dt ) = sI(s),
03/04/2012
When running this simulation we can see that the motor accelerates initially however the graph then levels out as the motor reaches its top speed.
One problem with this is that there is no form of control so adding a disturbance such as an external force to the system changes the output dramatically
03/04/2012
Now that I had an accurate motor model I decided to implement a PID controller to see how the motor would react under different loads. PID stands for Proportional Integral derivative. This means the system calculates 3 separate values and factors them together with a bias to produce an output. In the real world this type of control has many applications from cruise-control to thermostats however for our mouse we will be able to use this for achieving an accurate output on the wheels of our mouse. The system will use feedback from our encoders to adjust output power and make sure the motors are always under control. So what does each term do? Proportional this is calculated by working out the error of the system. Its purpose is to make the system adjust more the further it is from its target. Increasing the proportional gain will make a system more responsive however to much can cause oscillation. Integral this is calculated by adding up previous errors. A proportional system may never reach its target, by adding the integral this continuous error (steady state error) would cause an increase in the system output causing the system to reach its target. Having to much integral though can cause the system to become unstable. Derivative - this is calculated by working out the rate of change in the system. It is used to slow the rate of change in the output of the systems and smooth the system output. Derivative control is used to reduce the magnitude of the overshoot produced by the integral component and improve the combined controller-process stability. The PID is worked out as follows:
Adding this to our model: I Implemented the PID into our simulation so that we could calculate values to be used on our mouse.
03/04/2012
With the PID it can be seen that the system begins to recover from external forces that are applied. For this example Kp = 1 Ki=1 and Kd=1.
Increasing Kp can increase the systems responsiveness. For this example Kp = 4 Ki=1 and Kd=1.
However increasing this to high causes overshoot. For this example Kp = 20 Ki=1 and Kd=1.
03/04/2012
Increasing Ki makes the system recover from steady state error faster however causes the system to overshoot the target. For this example Kp = 4 Ki=2 and Kd=1.
Increasing KD makes the system output far smoother. For this example Kp = 4 Ki=2 and Kd=2.
03/04/2012
I implemented a position PID loop on the mouse that would use the velocity of the right wheel (x20) as the target position for the left motor. This allowed us to use one of the motors as visual feedback to show the speed of the other wheel, much like a speedometer would in a car. The PID routine was placed inside a 10ms interrupt so runs at 100Hz. We sent the speed of the right motor, power output to the left motor and position of the left motor over UART with an FTDI cable and graphed the results in MATLAB. We sampled at 100ms as this was the fastest that the Uart allowed at a low baud rate.
The green is the speed of the right motor, red is the position of the left motor. As you can see the output motors position was able to very accurately track the input wheels velocity. The blue shows the power level to the left motor, this initially appears to be very noisy however this is actually just the PID attempting to constantly adjust the output power.
03/04/2012
This enlarged snippet of the previous graph shows how accurately the position PID tracks the velocity. There is no point where the position is more than 1encoder click out from the velocity..
03/04/2012
10