
{"id":7576,"date":"2024-06-26T07:18:22","date_gmt":"2024-06-26T07:18:22","guid":{"rendered":"https:\/\/dyor.webs.upv.es\/?p=7576"},"modified":"2024-06-26T07:18:22","modified_gmt":"2024-06-26T07:18:22","slug":"english-dyor-pasta-python","status":"publish","type":"post","link":"https:\/\/dyor.webs.upv.es\/en\/english-dyor-pasta-python\/","title":{"rendered":"DYOR Pasta &#8211; Python"},"content":{"rendered":"<p>This post describes designing and building of Python controlled DYOR Pasta.<\/p>\n<p><!--more--><\/p>\n<p>In this post, we will explain the design and programming process of our DYOR named <strong>Pasta<\/strong>. This work was carried out as a part of the Mobile Robotics class.<\/p>\n<h2>The Design<\/h2>\n<p>The template used for the robot design was a standart &#8220;<em>DYOR Corte L\u00e1ser Madera FDM 3mm (Pinzas)<\/em>&#8221; available on websites of Rob\u00f3tica F\u00e1cil (<a href=\"https:\/\/roboticafacil.es\/?product=dyor-corte-laser1\">DYOR Corte L\u00e1ser Madera FDM 3mm (Pinzas) \u2013 Rob\u00f3tica F\u00e1cil (roboticafacil.es)<\/a>).<\/p>\n<p>Below, you can see the <strong>list of parts<\/strong> we used to build our robot:<\/p>\n<ul>\n<li>Wooden Base for DYOR<\/li>\n<li>Arduino Nano v3.0 Board<\/li>\n<li>Extension Shield for Arduino Nano<\/li>\n<li>Micro Servo FS90R (2x)<\/li>\n<li>Wheels Rueda FS90R (2x)<\/li>\n<li>Castor Wheel Rueda Loca<\/li>\n<li>Ultrasonic Sensor HC-SR04<\/li>\n<li>IR Sensor TCRT5000<\/li>\n<li>LED Matrix 8&#215;8<\/li>\n<li>Bluetooth Module HC-06<\/li>\n<li>Battery Holder with power switch and cable<\/li>\n<li>9V Battery<\/li>\n<li>2&#215;10 DuPont Cables Female-Female<\/li>\n<li>USB-mini cable (capable of power and data transfer)<\/li>\n<\/ul>\n<p>To put all the parts together and build the robot, we used basic glue gun. All the electronic were connected using guide on DYOR websites. You can see the all set for action <strong>Pasta<\/strong> on pictures below. You can notice, that our <strong>Pasta<\/strong> is wearing some kind of scarf from a black sticky tape. This is not only a fashion accessory, but we needed to lift up a bit the IR sensor, because it was sending irrelevant data.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7578 aligncenter\" src=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-225x300.jpg\" alt=\"\" width=\"259\" height=\"345\" srcset=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-225x300.jpg 225w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-768x1024.jpg 768w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-1152x1536.jpg 1152w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-1536x2048.jpg 1536w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-scaled.jpg 1920w\" sizes=\"auto, (max-width: 259px) 100vw, 259px\" \/><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7579 aligncenter\" src=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0338-225x300.jpg\" alt=\"\" width=\"259\" height=\"345\" srcset=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0338-225x300.jpg 225w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0338-768x1024.jpg 768w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0338-1152x1536.jpg 1152w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0338-1536x2048.jpg 1536w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0338-scaled.jpg 1920w\" sizes=\"auto, (max-width: 259px) 100vw, 259px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Main Functions<\/h2>\n<ul>\n<li><strong>Manual Remote Control<\/strong> of robot movement &#8211; we can control where Pasta goes through our GUI or just simply using our keyboard (W,A,S,D). There is also a button &#8220;Do a 360\u00b0&#8221; for Pasta to celebrate :-).<\/li>\n<li><strong>Remote Control of robot emotions<\/strong> &#8211; through GUI we can set if Pasta is sad or happy<\/li>\n<li><strong>Line Following with Obstacle Detection<\/strong> &#8211; using IR sensor, Pasta can follow black line and if he detects any obstacle in front of him (closer than 5 cm), he stops. This feature can be activated with pressing &#8220;l&#8221; on the keyboard or &#8220;Line Follow&#8221; button in GUI.<\/li>\n<li><strong>Graphical User Interface<\/strong> with all the controls<\/li>\n<\/ul>\n<h2>Programming<\/h2>\n<p><strong>Python<\/strong> is used for both, robot programming and creating a Graphical User Interface to control the robot.<\/p>\n<p>In case of programming, we decided to take different approach and use Python to do all the work in. To our Arduino Nano board, we simply uploaded the <strong>Telemetrix\u00a0<\/strong>library (can be downloaded in Arduino IDE &#8211; Telemetrix4Arduino &#8211; v5.4.0, <a href=\"https:\/\/github.com\/MrYsLab\/Telemetrix4Arduino\">GitHub &#8211; MrYsLab\/Telemetrix4Arduino: The Telemetrix Project Server For Arduino-Core<\/a>). This library will make sure, that Pasta understands all the commands send to him through Bluetooth.<\/p>\n<p>Also, we had to install the Telemetrix into our python (by just simply writing &#8220;<em>-m pip install Telemetrix&#8221;<\/em> into our opened terminal in python). After these two major steps, we were all set to start programming Pasta.<\/p>\n<p>We created all the functions for robot movements, sensing, etc. in Python as well as the GUI (we provided the code in attachments). When we run the code, it connects to Pasta&#8217;s bluetooth module using serial port of our laptop (it is necessary to find out which COM port is your laptop using for communication with robot and specify it in the code). Arduino Nano board then receives commands from Python and translates it through Telemetrix.<\/p>\n<p><strong>Main bottleneck of this solution is the fact that line following is remote, which basically means, that all the computing is done in python on laptop and not in robot itself. This causes that the line following process is slow, because the data from sensor need firstly go to laptop through Bluetooth, then there is the computation in Python and according to the result, corresponding commands are sent to the robot.\u00a0<\/strong><\/p>\n<h2>Graphical User Interface Description<\/h2>\n<p>On the picture below you can see the Pasta&#8217;s GUI. There is a section which shows data from the Ultrasonic sensor, saying how far Pasta is from obstacle in front of him and also showing it on a simple graph. By dragging the slider left or right, we can adjust the distance scale (how big is the distance shown on the graph).<\/p>\n<p>In the bottom left part, there is an emotion control and also celebration button. More to the right, we can also adjust the manual speed our robot. In the bottom right part, there is a control of the robot direction and also line following and stop button.<\/p>\n<p>Robot direction can be also controlled by using keyboard (w,s,a,d), &#8220;l&#8221; will start the line following process and &#8220;escape&#8221; will end it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-7580 aligncenter\" src=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/GUI.jpg\" alt=\"\" width=\"792\" height=\"411\" srcset=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/GUI.jpg 1920w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/GUI-300x156.jpg 300w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/GUI-1024x531.jpg 1024w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/GUI-768x398.jpg 768w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/GUI-1536x797.jpg 1536w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/p>\n<h2>Video with Description<\/h2>\n<p>You can see <strong>Pasta\u00a0<\/strong>in action on the video. Below the video, you can also find a description of control.<\/p>\n<p><iframe loading=\"lazy\" title=\"DYOR Pasta - python\" width=\"600\" height=\"338\" src=\"https:\/\/www.youtube.com\/embed\/u9cFT5pKiM0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>In the first 10 seconds of the video, we can see how our GUI for <strong>Pasta<\/strong> is being launched with python code, which was already described. Then the camera fixes its view on the already initialized robot. In the following 5 seconds we can see how robot is remotely controlled with preset keys (as usual w for movement forward, a \u2013 left, s \u2013 backwards, d \u2013 right).<\/p>\n<p>From the 18<sup>th<\/sup> second to the 34<sup>th<\/sup> second we can see how our <strong>Pasta<\/strong> is reacting with just simple clicking on the buttons in the GUI. Firstly, <strong>Pasta<\/strong> starts being Happy, then Sad, and after that we can clear the LED matrix with \u201cclean\u201d button. We can also see how our <strong>Pasta<\/strong> does the 360 \u00b0.<\/p>\n<p>Starting from 44<sup>th<\/sup> second <strong>Pasta<\/strong> start Line Following, with a simple pushing of \u201cL\u201d key (or another possibility by clicking on the Line Following button in the GUI). We can see that our <strong>Pasta<\/strong> is reacting slowly, it is because of slow data sending between Bluetooth computer and Bluetooth module of <strong>Pasta<\/strong>. When the TCRT 5000 sends a signal via Bluetooth to our computer, it is subsequently calculated and then sent back to the<strong> Pasta<\/strong>, creating a delay.<\/p>\n<p>At the 59<sup>th<\/sup> second we can see how <strong>Pasta<\/strong> stopped because of obstacle in his way. We can see that also in the GUI with the \u201cDistance from the sensor\u201d and also with blue lines that are coming closer to our <strong>Pasta<\/strong>.\u00a0 With that <strong>Pasta<\/strong> is not hitting any obstacle in his way and we can easily move with him manually with key to avoid the obstacle.\u00a0 After that we find a way back and finish with the Line Following.<\/p>\n<p>Finally,<strong> Pasta<\/strong> celebrates with 360\u00b0. After the celebration (90<sup>th<\/sup> second) we can see that it is also possible to put more speed into his wheels.<\/p>\n<p>Thanks for reading! We hope this post will help with your project.<\/p>\n<p>Pavel and Jakub<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>This post describes designing and building of Python controlled DYOR Pasta.<\/p>\n","protected":false},"author":957,"featured_media":7578,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[81],"tags":[],"class_list":["post-7576","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/IMG_0337-scaled.jpg","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":7676,"url":"https:\/\/dyor.webs.upv.es\/en\/english-dyor-mobile-robotics-report-colorbot\/","url_meta":{"origin":7576,"position":0},"title":"DYOR: Mobile Robotics Report &#8211; ColorBot","author":"JosefKhedri","date":"Wednesday June 26th, 2024","format":false,"excerpt":"This report presents our work behind the ColorBot, made for the main assignment in the course Mobile Robotics at the UPV. Design of the Robot: Parts: Arduino Nano with Extension Shield Color Sensor (TCS3200) Bluetooth Module (HC-06) 8x8 LED-matrix Infrared Sensor (TCRT5000) 2x FS90R servos with 60mm wheels Castor Wheel\u2026","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/dyor.webs.upv.es\/en\/category\/blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/WhatsApp-Bild-2024-06-15-kl.-12.49.27_386e7423-225x300.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2923,"url":"https:\/\/dyor.webs.upv.es\/en\/ensamblaje-dyor-standard\/","url_meta":{"origin":7576,"position":1},"title":"Assembly of DYOR Standard","author":"soporte","date":"Wednesday April  4th, 2018","format":false,"excerpt":"In this entry, we show the assembly of DYOR Standard with TinkerCAD and make with laser cutting. \u00a0 Components: Arduino Nano + Shield Arduino Nano I\/O (red) Powerbank (yellow) Ultrasound HC-SR04 (light grey) Buzzer (black) Servos SG90 ( blue) in the base Servos FS90R (blue) in the base Bluetooth (grey)\u2026","rel":"","context":"In &quot;ensamblaje&quot;","block_context":{"text":"ensamblaje","link":"https:\/\/dyor.webs.upv.es\/en\/category\/fabricacion\/ensamblaje\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/DYOR_Standard_assembly10.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5862,"url":"https:\/\/dyor.webs.upv.es\/en\/dyor-iron-man\/","url_meta":{"origin":7576,"position":2},"title":"DYOR Iron Man","author":"Nestor Romero Llop","date":"Saturday June 10th, 2023","format":false,"excerpt":"In this blog entry we will show you the design of the robot DYOR Iron Man. It is controlled by an Arduino Nano and an Android app. DYOR Iron Man Design The DYOR Iron Man's design is original, and the appearence has been designed in AutoCAD as it can be\u2026","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/dyor.webs.upv.es\/en\/category\/blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2021\/06\/IronMan_square-scaled.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2021\/06\/IronMan_square-scaled.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2021\/06\/IronMan_square-scaled.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2021\/06\/IronMan_square-scaled.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2021\/06\/IronMan_square-scaled.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2021\/06\/IronMan_square-scaled.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":5026,"url":"https:\/\/dyor.webs.upv.es\/en\/dyor-christian\/","url_meta":{"origin":7576,"position":3},"title":"DYOR &#8211; Christian","author":"Enea","date":"Wednesday June  5th, 2019","format":false,"excerpt":"In this entry, I\u2019ll describe Christian, my robot made with an Arduino Nano, sensors and actuators and the mobile app I developed to control it. DYOR-Christian Design The robot design was made using Solidworks and the whole block that defines the robot structure was obtained from an aluminium sheet by\u2026","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/dyor.webs.upv.es\/en\/category\/blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2019\/06\/robot_square.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2019\/06\/robot_square.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2019\/06\/robot_square.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2019\/06\/robot_square.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2019\/06\/robot_square.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2019\/06\/robot_square.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7349,"url":"https:\/\/dyor.webs.upv.es\/en\/english-frogbot3000\/","url_meta":{"origin":7576,"position":4},"title":"FrogBot3000","author":"leoharling","date":"Friday June 30th, 2023","format":false,"excerpt":"This post presents FrogBot 3000 a low-cost Arduino-based mobile robot DYOR: FrogBot3000 mobile robot build GOAL The goal is to build a mobile robot based on a frog. It will be able to raise and lower its arms, move in any direction, display a plethora of emotions, follow a black\u2026","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/dyor.webs.upv.es\/en\/category\/blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2023\/06\/IMG_0431-scaled.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2023\/06\/IMG_0431-scaled.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2023\/06\/IMG_0431-scaled.jpeg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2023\/06\/IMG_0431-scaled.jpeg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2023\/06\/IMG_0431-scaled.jpeg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2023\/06\/IMG_0431-scaled.jpeg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7599,"url":"https:\/\/dyor.webs.upv.es\/en\/dyor-senorita-cafe-con-leche\/","url_meta":{"origin":7576,"position":5},"title":"DYOR: Ms Cafe con Leche","author":"linninja","date":"Wednesday June 26th, 2024","format":false,"excerpt":"Made by: CTO (Chief Technical Officer) : Anja V\u00e5ge Burtonwood CHO (Chief Hardware Officer) : Linn H\u00e5berg Dimmen Design Components: Arduino nano I\/O Extension Shield para Arduino Nano SPP-C Bluetooth (compatible HC-06) Caster wheel 9V battery 8x8 LED Matrix, max7219 Two FS90R servos 360\u00b0 Two 60mm wheels for the FS90R\u2026","rel":"","context":"In &quot;Blog&quot;","block_context":{"text":"Blog","link":"https:\/\/dyor.webs.upv.es\/en\/category\/blog\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/profile-pic-square.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/profile-pic-square.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/profile-pic-square.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/profile-pic-square.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2024\/06\/profile-pic-square.jpg?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/7576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/users\/957"}],"replies":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/comments?post=7576"}],"version-history":[{"count":2,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/7576\/revisions"}],"predecessor-version":[{"id":7594,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/7576\/revisions\/7594"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/media\/7578"}],"wp:attachment":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/media?parent=7576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/categories?post=7576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/tags?post=7576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}