Control Servo Motors with FPGA to Build Something Big

— by

Hi FPGA enthusiasts! Today’s project is a crucial one since it can play a pivotal role in building any major project with FPGAs. The exercise under question is controlling servo motors with FPGA, and this can be of great use on any project that involves servo motors and FPGA. Once you get comfortable with this, you can build anything from claw cranes to terrain rovers using your FPGA.

The hardware you will need is, obviously, your FPGA board, a GWS servo, a PMOD CON3 and a USB A to B micro cable. The FPGA board is incapable of providing the current that will be needed to energize the Servo. This is the reason why the PMOD CON3 is used.  While you are free to choose a Servo of your own, you will have to design the code and timing/rotation degrees for it yourself.

The author has done a great job in describing how relevant PWM is in controlling servos. While 10ms refresh periods has been declared a safe bet for most servos, it would be best if you consult the data sheet of the servo you are using. The logic implemented simply consists of a switch to angle converter and a counter which acts as the inputs for a comparator. If the counter value is high, the servo position is held, and if not, the servo switches in 24 degree steps till the condition is met. The interconnections with the FPGA have been shown by the author, and the principle of working has been explained well in step 2 and step 3.

The code for the project has been given in step 4 in a zip file. The code has been implemented in VHDL (.vhd) and broken down to modules. Each module has been implemented with simple logic that will walk you through the entire operation. You can simply generate the bitstream version of the code and upload it to your board once the connections are done as shown in step 6.

Let´s get hands on it!

By Kaitlyn1franz

,

Newsletter

Our latest updates in your e-mail.


Leave a Reply