12.07.2015 Views

Motor Control with Arduino: - ICC Media GmbH

Motor Control with Arduino: - ICC Media GmbH

Motor Control with Arduino: - ICC Media GmbH

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MOTOR CONTROLDesigning the <strong>Control</strong>lerWe are now ready to design a PID controller for the higher-fidelity nonlinearmodel. We linearize the estimated nonlinear model at an operatingpoint of interest and then design a controller for this linearized model.Testing the <strong>Control</strong>ler on HardwareWe create a Simulink model <strong>with</strong> the controller and place it on the <strong>Arduino</strong>Uno board using Simulink built-in support for deploying modelsto target hardware (Figure 14).We tune the PID controller and then select its parameters (Figure 11).Figure 14. Model <strong>with</strong> the controller implemented on the<strong>Arduino</strong> board. The subsystem Get Angle receives the referencesignal from the serial port and converts it to the desiredangle of the motor. The DC <strong>Motor</strong> subsystem configures the<strong>Arduino</strong> board to interface <strong>with</strong> the physical motor.We designed a controller by linearizing the estimated nonlinear ARX modelabout a certain operating point. The results for this controller show that thehardware response is quite close to the simulation results (Figure 15).Figure 11. PID Tuner interface.We also check how this controller performs on the nonlinear model.Figure 12 shows the Simulink model that we use to obtain the simulationresponse of the nonlinear ARX model.Figure 12. Simulink model for testing the controller on the estimatednonlinear model.We then compare the linearized and nonlinear model closed-loop stepresponses for a desired reference position of 60° (Figure 13).Figure 13. Step response plot comparing simulation responses of nonlinearand linearized models.Figure 15. Plot comparing simulation and hardware responsesto a step reference for a controller designed using a linearizedmodel.We also tested how well the controller tracks a random reference command.We see that the hardware tracking performance is also very closeto that obtained during simulation (Figure 16).Figure 16. Plot comparing tracking performance insimulation and on hardware for the controllerdesigned using an estimated nonlinear model.This example,whilesimple,capturestheessentialstepsfor data-drivencontrol. We collectedinput/outputdata from agiven hardwaretarget and usedSystem IdentificationToolboxto construct modelsof the system.We showedhow you can create models of lower and higher fidelity and design controllersusing these estimated models. We then verified the performanceof our controllers on the actual hardware.7 April 2013

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!