Control a Servo Motor with Your FPGA
Hello FPGA lovers! Great stuff here today. I have come across an article that gives you great details about how to control a RC Servo with a FPGA.
There many versions for RC servos but basically all of them use a Pulse Width Modulation (PWM) signal to control their position. Servos should receive 5 V logic signals but many models will work with 3.3 V signals. We cover how to take the most out of the PWM outputs of your Papilio on a previous post. This would be a great opportunity to adapt the design of a servo controller to your Papilio FPGA.
According to the author, the servo should not be waiting a pulse for more than 20 ms. Otherwise the servo would enter standby, risking to lose its position if there is a load on the arm. Typical widths of the pulses are within the 1000-2000 µs range.
All the code for this project is written in VHDL. One of the main advantages of this approach is that the author has chunked the whole project into different parts, so they can be used for many different controls. There are 4 parts: Servo Driver, Button Controller, Top Module and UCF file. The code is given for each one of these modules but as always, you should only use it to check your own code.
Have fun and build your own fan for the coming summer!
By T. Flummer