Example Code

Control of a Model Servo on a myRIO FPGA - with Video.

Code and Documents

Attachment

A commonly met problem is how to control a hobby servo for robotic applications. An FPGA is a good choice because you can control as many as you like all running in parallel!! Here it is shown how to control just one using the myRIO. Nothing that new as others have done this on the RIO, but the myRIO is popular for students and I thought I would show the method. A video is available

https://www.youtube.com/watch?v=i9aXqFvRcLw&feature=youtu.be

Instructions

unzip the file.

You will need to change the target to the IP address of your  myRIO device. Copy all the files to the new target. There are two files, servo.vi which is the FPGA code and Servo host.vi which is run on the processor. The processor has a control which varies the width of the PWM pulse. Nomially the repitition rate is 50Hz (20,000 us period) and the width of the pulse is varied from 1000-2000us (you can experiment a bit with this and widen it).

Compile the FPGA code (may take a little while)

after setting the Servo host file to point to the FPFA target you can run the host file and there it is!

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
zhxu
Member
Member
on

Thanks a lot for sharing the video and the project.

ravinath94
Member
Member
on

hye..can anyone help me on how to run a g15 servo motor with g15 driver by using ni myrio??thanks

Contributors