{"id":376,"date":"2022-08-05T10:28:33","date_gmt":"2022-08-05T10:28:33","guid":{"rendered":"https:\/\/vegaprocessors.in\/blog\/?p=376"},"modified":"2022-12-22T09:24:57","modified_gmt":"2022-12-22T09:24:57","slug":"hw-504-joystick-with-aries-v2-0-board","status":"publish","type":"post","link":"https:\/\/vegaprocessors.in\/blog\/hw-504-joystick-with-aries-v2-0-board\/","title":{"rendered":"HW-504 Joystick with ARIES v2.0 Board"},"content":{"rendered":"\n<p>In this tutorial, we will see how we can interface HW-504 Joystick with Aries v2.0 Board.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Joystick<\/h2>\n\n\n\n<p>A&nbsp;<strong>joystick<\/strong>, sometimes called a&nbsp;<strong>flight stick<\/strong>, is an&nbsp;input device&nbsp;consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. A joystick, also known as the&nbsp;<strong>control column<\/strong>, is the principal control device in the&nbsp;cockpit&nbsp;of many civilian and military aircraft, either as a&nbsp;center stick&nbsp;or&nbsp;side stick. It often has supplementary switches to control various aspects of the aircraft&#8217;s flight.<\/p>\n\n\n\n<p>Joysticks are often used to control video games, and usually have one or more push buttons whose state can also be read by the computer. Joysticks are also used for controlling machines such as cranes, trucks, underwater unmanned vehicles, wheelchairs, surveillance cameras, and&nbsp;zero-turning radius lawn mowers.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/image-5.png\" alt=\"\" class=\"wp-image-1974\" width=\"292\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/image-5.png 387w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/image-5-300x167.png 300w\" sizes=\"(max-width: 387px) 100vw, 387px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Circuit Diagram:<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/joystick_updated-1024x768.webp\" alt=\"\" class=\"wp-image-2045\" height=\"576\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/joystick_updated-1024x768.webp 1024w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/joystick_updated-300x225.webp 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/joystick_updated-768x576.webp 768w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/joystick_updated-1536x1152.webp 1536w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/joystick_updated.webp 2000w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Connections:<\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><strong>Joystick<\/strong><\/td><td><strong>ARIES v2 Board<\/strong><\/td><\/tr><tr><td>VCC<\/td><td>+3.3V<\/td><\/tr><tr><td>VRx<\/td><td>A0<\/td><\/tr><tr><td>VRy<\/td><td>A1<\/td><\/tr><tr><td>SW<\/td><td>GPIO2<\/td><\/tr><tr><td>GND<\/td><td>GND<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><strong><em>Connection pins of Joystick &amp; Aries v2.0 Board<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>Now, for powering up the ARIES v2 board via the USB port of a Laptop\/Desktop\/PC and burning the code into the ARIES v2 board, we have to use a micro USB type B to USB type A cable. The cable should be connected to the <strong>UART0<\/strong> port of the ARIES v2 board, and the Laptop\/Desktop\/PC should be preinstalled with VEGA SDK and Toolchain.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-32cb08e5-87b9-4300-9e46-a29be4436adc\"><strong>Procedure<\/strong><\/h2>\n\n\n\n<p id=\"block-fe352b07-a674-4754-b285-bafd33106df7\">After setting up the toolchain and SDK path environments are ready, build the example program for the Joystick  module by:<\/p>\n\n\n\n<pre id=\"block-98c3408c-130d-4e1c-9247-614ed2ea2608\" class=\"wp-block-code\"><code>cd vega-sdk\/examples\/adc\/joystick_demo<\/code><\/pre>\n\n\n\n<p>clean command to clean the executable :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make clean<\/code><\/pre>\n\n\n\n<p>then use make command to build it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make<\/code><\/pre>\n\n\n\n<p>Now, we can transfer the built program to the board, before transfer please ensure that you have connected the board UART connector to the PC.<\/p>\n\n\n\n<p id=\"block-09fbc4ed-2d51-4916-86e3-5e9d9fc312e3\">Open a new terminal and execute the following command.<\/p>\n\n\n\n<pre id=\"block-42a9557f-d0e9-4acf-badc-ec94ff360de9\" class=\"wp-block-code\"><code>sudo minicom aries<\/code><\/pre>\n\n\n\n<p id=\"block-1ce27174-d8f5-4c2b-b17d-683db89940be\">Now you can see the minicom terminal opened and the board uart terminal is ready.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\" id=\"block-1353a31a-4d2d-4bd7-ac98-7d65cae80fc3\"><img loading=\"lazy\" decoding=\"async\" width=\"820\" height=\"689\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2021\/05\/minicom-6.png\" alt=\"\" class=\"wp-image-602\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2021\/05\/minicom-6.png 820w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2021\/05\/minicom-6-300x252.png 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2021\/05\/minicom-6-768x645.png 768w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><\/figure>\n\n\n\n<p id=\"block-cd6a17a4-c39e-456a-bd13-46a767c681b1\">Use <strong>CTRL+A  S<\/strong>  to enter the file sending menu and select <strong>xmodem<\/strong> by pressing Enter.<\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"block-09ca85fc-b896-45b0-b7c3-7325f27c48e7\"><img decoding=\"async\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2021\/05\/Screenshot-from-2021-04-30-16-14-03.png\" alt=\"This image has an empty alt attribute; its file name is Screenshot-from-2021-04-30-16-14-03.png\"\/><\/figure>\n\n\n\n<p id=\"block-0493bb63-b7da-4838-b324-03dc3e63853a\">In the next window, with the <strong>space bar<\/strong> select the <strong>joystick_pgm.bin<\/strong> file to be transferred, by pressing <strong>Enter<\/strong>, the transfer process starts.<\/p>\n\n\n\n<p id=\"block-c0f4d3e2-615d-46dc-b456-17b196e9c263\">Wait until the process is completed. The screen should display how much data has been transferred.<\/p>\n\n\n\n<p id=\"block-cf92dbc8-fa97-4bed-aa6d-e08e48e7877e\">After completing the transfer the Program will start to execute.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Output:<\/h2>\n\n\n\n<p id=\"block-c0d91f20-0043-4ee4-9abc-95d51109316b\">The output is displayed in the minicom UART terminal:<\/p>\n\n\n\n<p>We get an different analog values as we move joystick in different direction.<\/p>\n\n\n\n<p>Steady state (i.e. At centre position) :  Xvalue = 810 , Yvalue = 810 &amp; bval = 1(when unpressed) and bval = 0(when presss).<\/p>\n\n\n\n<p>when we move joystick in a different direction we get an different analog values of i.e Xvalue and Yvalue w.r.t. direction in which it is moving as shown as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1518\" height=\"853\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-34-59-edited.png\" alt=\"\" class=\"wp-image-1981\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-34-59-edited.png 1518w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-34-59-edited-300x169.png 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-34-59-edited-1024x575.png 1024w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-34-59-edited-768x432.png 768w\" sizes=\"auto, (max-width: 1518px) 100vw, 1518px\" \/><figcaption class=\"wp-element-caption\"><em><strong>Joystick is <\/strong><\/em><strong><em>at centre position : Xvalue= 810 , Yvalue = 812<\/em><\/strong>  <strong><em>&amp; bval = 1<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1518\" height=\"853\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-40-edited.png\" alt=\"\" class=\"wp-image-1985\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-40-edited.png 1518w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-40-edited-300x169.png 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-40-edited-1024x575.png 1024w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-40-edited-768x432.png 768w\" sizes=\"auto, (max-width: 1518px) 100vw, 1518px\" \/><figcaption class=\"wp-element-caption\"><strong><em><em><strong>Joystick is <\/strong><\/em><strong><em>at<\/em><\/strong><\/em><\/strong> <strong><em>up direction : Xvalue = 810 &amp; Yvalue = 1<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1518\" height=\"853\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-44-edited.png\" alt=\"\" class=\"wp-image-1987\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-44-edited.png 1518w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-44-edited-300x169.png 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-44-edited-1024x575.png 1024w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-44-edited-768x432.png 768w\" sizes=\"auto, (max-width: 1518px) 100vw, 1518px\" \/><figcaption class=\"wp-element-caption\"><strong><em><em><strong>Joystick is <\/strong><\/em><strong><em>at<\/em><\/strong><\/em><\/strong> <strong><em>down direction : Xvalue = 810 &amp; Yvalue = 1639<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1518\" height=\"853\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-50-edited.png\" alt=\"\" class=\"wp-image-1989\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-50-edited.png 1518w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-50-edited-300x169.png 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-50-edited-1024x575.png 1024w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/Screenshot-from-2022-08-05-17-36-50-edited-768x432.png 768w\" sizes=\"auto, (max-width: 1518px) 100vw, 1518px\" \/><figcaption class=\"wp-element-caption\"><em><strong>Joystick is<\/strong><\/em> <strong><em>at Right direction : Xvalue = 1639 &amp; Yvalue = 811<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/left_dir-1024x576.png\" alt=\"\" class=\"wp-image-2021\" srcset=\"https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/left_dir-1024x576.png 1024w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/left_dir-300x169.png 300w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/left_dir-768x432.png 768w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/left_dir-1536x864.png 1536w, https:\/\/vegaprocessors.in\/blog\/wp-content\/uploads\/2022\/08\/left_dir.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><em><strong>Joystick is<\/strong><\/em> <strong><em>at Left direction : Xvalue = 1 &amp; Yvalue = 811<\/em><\/strong><\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will see how we can interface HW-504 Joystick with Aries v2.0 Board. Joystick A&nbsp;joystick, sometimes called a&nbsp;flight stick, is an&nbsp;input device&nbsp;consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. A joystick, also known as the&nbsp;control column, is the principal [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,14,1],"tags":[75,7,68,92,26,31,24],"class_list":["post-376","post","type-post","status-publish","format-standard","hentry","category-getting-started","category-tutorials","category-uncategorized","tag-aries-v2-board","tag-cdac","tag-gpio","tag-joystick","tag-thejas-64","tag-thejas32","tag-vegaprocessor"],"_links":{"self":[{"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/posts\/376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/comments?post=376"}],"version-history":[{"count":40,"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/posts\/376\/revisions"}],"predecessor-version":[{"id":2255,"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/posts\/376\/revisions\/2255"}],"wp:attachment":[{"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/media?parent=376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/categories?post=376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vegaprocessors.in\/blog\/wp-json\/wp\/v2\/tags?post=376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}