Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

myRio Digital Control system using lag-lead approach - with video

Overview

This program is a posting of the code used in a youtube video. I have written myRio realtime code for a phase-lead compensator and a P-I controller. This enables a closed -loop digital controller to work on position (with multiple rotations past 360 degrees) and velocity. You can then have a system that controls the speed of the motor with some precision - forward and reverse and also have a position servo where we control the angle of the servo through multiple turns.

Description

Multiple code is implemented on the FPGA. The code reads position from a quad encoder connected to the shaft of a dc motor. It also measures velocity using a parallel piece of code. Both sensor software are written on the FPGA. It also generates Pulse Width Modulation (PWM) and has a second digital reader for position that uses another quad encoder for a setpoint. The realtime processor communicated with the sensors and generates a control signal to close the loop and maintain stability. A phase-lead (advance) compensator is used for stablising the loop and a P-I compensator in cascade is used to obtain high gain at low frequencies. This rejects disturbances and gives good accuracy.

Hardware and Software Requirements

Hardware is custom but consists ot a myRio, 330W dc motor (or any wattage depending if you can drive it from your H bridge), an H- bridge, two quad encoders (Yumo, E6B2 CWZ 3 E, 1024 pulses per rev - not that critical), and a 12v dc power supply. Some mechanical design is needed to mount one of the quad encoders to the shaft and add some form of load that rotates. We use an aluminum cylinder. External wiring is of course needed where appropriate to drive the H bridge. A wiring diagram is not included since the concept only is being illustrated though the full code is included.

Steps to Implement or Execute Code

1.Unzip the attached file. Open the folder.

2. Open the project folder named Servo and examine the files.

3. Open the FPGA file Servo and run it - it will compile. After compilation then

4. Run the host program called Servo host

Run the code as per the video.

 

Additional Information or References

Youtube video

 

https://www.youtube.com/watch?v=421b9ZQtjD8

 

Contributors