{"id":12369,"date":"2016-02-16T20:00:29","date_gmt":"2016-02-17T04:00:29","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=12369"},"modified":"2021-06-16T14:24:24","modified_gmt":"2021-06-16T21:24:24","slug":"how-to-control-a-servo-with-fpga","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/how-to-control-a-servo-with-fpga\/","title":{"rendered":"How to Control A Servo with The Basys 3 (FPGA)"},"content":{"rendered":"<p>As\u00a0you may be aware if you follow the blog closely, I&#8217;ve been working on building the claw machine. The claw machine is one of those infuriating devices that camps in front of various places of business\u00a0to lure you into paying a dollar to discover that you likely do not in fact, have the skills required to maneuver said claw in a successful toy-picking up manner. However, in an effort to show that I&#8217;m not bitter, I&#8217;m making one of my own.<\/p>\n<p>So far in the process I have <a href=\"https:\/\/digilent.com\/blog\/index.php\/controlling-a-stepper-motor-with-an-fpga\/\">controlled a stepper motor with the FPGA<\/a>, and <a href=\"https:\/\/digilent.com\/blog\/index.php\/using-the-pmodjstk-to-control-a-stepper-motor-with-the-basys-3\/\">used a Joystick to control the stepper motor with FPGA<\/a>. Now I have gotten control of a servo with FPGA. More specifically I&#8217;m using the <a href=\"https:\/\/digilent.com\/shop\/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users\/\">Basys 3 <\/a>to send signals through the <a href=\"https:\/\/digilent.com\/shop\/pmodcon3-r-c-servo-connectors\/\">PmodCON3<\/a>, to a <a href=\"https:\/\/digilent.com\/shop\/gws-servo-s03txf-std\/\">GWS servo<\/a>. I even wrote<a href=\"http:\/\/www.instructables.com\/preview\/E7P8TIZIK5PWGUD\/\"> an Instructable<\/a>.<\/p>\n<p>Here is the project in action:<\/p>\n<p><iframe loading=\"lazy\" width=\"735\" height=\"413\" src=\"https:\/\/www.youtube.com\/embed\/lxr9mz7sPGY?feature=oembed\" frameborder=\"0\" allow=\"autoplay; encrypted-media\" allowfullscreen><\/iframe><\/p>\n<p>Each switch corresponds to sending the servo to a different positions, starting at 0 degrees and adding 24 degrees with each switch.<\/p>\n<p>In my Instructable I go through the details of why I wrote this and how the project works.<\/p>\n<figure id=\"attachment_12372\" aria-describedby=\"caption-attachment-12372\" style=\"width: 622px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.instructables.com\/preview\/E7P8TIZIK5PWGUD\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-12372 size-full\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/1.jpg\" alt=\"Background knowledge on controlling a servo with FPGA. \" width=\"622\" height=\"440\" data-wp-pid=\"12372\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/1.jpg 622w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/1-600x424.jpg 600w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/a><figcaption id=\"caption-attachment-12372\" class=\"wp-caption-text\">Background knowledge on controlling a servo with FPGA.<\/figcaption><\/figure>\n<p>Some background info on how servos work.<\/p>\n<figure id=\"attachment_12373\" aria-describedby=\"caption-attachment-12373\" style=\"width: 667px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.instructables.com\/preview\/E7P8TIZIK5PWGUD\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-12373 size-full\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/2.jpg\" alt=\"A step explaining how servos work.\" width=\"667\" height=\"807\" data-wp-pid=\"12373\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/2.jpg 667w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/2-496x600.jpg 496w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/a><figcaption id=\"caption-attachment-12373\" class=\"wp-caption-text\">A step explaining how servos work.<\/figcaption><\/figure>\n<p>How my code works&#8230;.<\/p>\n<figure id=\"attachment_12374\" aria-describedby=\"caption-attachment-12374\" style=\"width: 672px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.instructables.com\/preview\/E7P8TIZIK5PWGUD\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-12374 size-full\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/3.jpg\" alt=\"The block diagram of my code, and explanation of how it works on a waveform.\" width=\"672\" height=\"838\" data-wp-pid=\"12374\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/3.jpg 672w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/3-481x600.jpg 481w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/a><figcaption id=\"caption-attachment-12374\" class=\"wp-caption-text\">The block diagram of my code, and explanation of how it works on a waveform.<\/figcaption><\/figure>\n<p>&#8230;and lastly, the Instructable details how to integrate my project into your designs!<\/p>\n<p>Check it out<a href=\"http:\/\/www.instructables.com\/preview\/E7P8TIZIK5PWGUD\/\">\u00a0here.<\/a><\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-12369 jlk' data-task='like' data-post_id='12369' data-nonce='47b5a45c13' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-12369 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-12369 jlk' data-task='unlike' data-post_id='12369' data-nonce='47b5a45c13' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-12369 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-12369 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>As\u00a0you may be aware if you follow the blog closely, I&#8217;ve been working on building the claw machine. The claw machine is one of those infuriating devices that camps in &hellip; <\/p>\n","protected":false},"author":18,"featured_media":12373,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4327,35,1563],"tags":[1662],"ppma_author":[4466],"class_list":["post-12369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","category-fpga","category-guide","tag-fpga"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/02\/2.jpg","authors":[{"term_id":4466,"user_id":18,"is_guest":0,"slug":"kaitlyn","display_name":"Kaitlyn Franz","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/9276021eaa44781ce19f364cfca46ada25e1500769cf4803a095a5bae83c912a?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/12369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=12369"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/12369\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/12373"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=12369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=12369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=12369"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=12369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}