Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1184 Discussions

PID controller implementation help needed

Honored Contributor II

Hi all, I am in the final stages of a project for my first year digital logic class and have learned a lot. For my final project I am doing a PID controller implementation and have built much of the circuitry needed. Each of the components have been individually tested to work as intended and now put together into a final assembly. I don't know how much of this is right because I've been learning as I go and some of it is made from wired components and some from VHDL, so sorry if this is just a mess for some of the more experienced engineers out there.  


General Description of Project: 

This is a PID controller implementation that is meant to mimic the functioning of a processor in terms of data flow and operations as a learning experience. The controller receives data input from the user via an IR remote and range data from an ultrasonic range sensor. The data is processed in a program cycle and the results fed into a PWM controller in VHDL that outputs a PWM signal to an external motor driver. I'm using the GPIO pins to interface with the motor driver and ultrasonic range sensor. I'm using the Altera DE2 board, HCSR04 range finder, and L298n based dual H-bridge driver to run one motor.  


Intent of Project: 

To enable an automated robot to follow an object in front of it at a user-set distance, moving forwards and backwards in a smooth motion to maintain that distance. Think of it as an automatic distance following cruise control. 


Problem I'm having: 

With the project fully assembled I'm having trouble getting the compiled output file to load fully onto the board. It appears to, but once loaded nothing works at all. The system won't even get started. Also, some things are just slightly amiss, LED's that were grounded are still slightly lit up when they shouldn't be, that leads me to believe something about my design is creating an internal conflict. As I mentioned before, each of the modules individually loads and tests just fine. One thing I noticed is that with everything else removed from the project except the range finding module and the PWM controller module they won't work together even through they work separately so I believe an issue with how I'm implementing input and output through the GPIO pins is still the central problem.  


I know it's too much to ask for anyone to completely troubleshoot my project, but I need to find a way to at least get the project to load properly on the board for testing. Right now I can't get anywhere. Will someone look at this and please tell me if something jumps out at them which I'm doing wrong and give me some direction? Do I need to implement some sort of tri-state or bi-directional buffers with the bidirectional ports? 


Please see the attached project archive, and thanks in advance for any help rendered.
0 Kudos
1 Reply
Honored Contributor II

Okay, I think I got everything to load and assign properly. For some reason the pins weren't assigning properly for a number of inputs and outputs, including some of the LED's. Removing all the pin assignments and importing them again a couple of times, while eliminating the grounded unused LEDs seemed to do the trick. Everything is loading and I have partial functionality, and more importantly I can actually start troubleshooting. Feel free to chime in still with any suggestions on how I can improve my design. Thanks.

0 Kudos