{"id":566,"date":"2022-12-14T22:32:31","date_gmt":"2022-12-14T22:32:31","guid":{"rendered":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/?p=566"},"modified":"2022-12-30T05:18:07","modified_gmt":"2022-12-30T05:18:07","slug":"fire-fighting-robot","status":"publish","type":"post","link":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/2022\/12\/14\/fire-fighting-robot\/","title":{"rendered":"Fire-Fighting Robot"},"content":{"rendered":"<p>For the final project in my first-year engineering class, we were tasked with building a robot capable of solving a short maze, sensing a flame, and then putting it out. I worked with <u><a href=\"https:\/\/portfolio.wcu.edu\/jaharris13\/\">Josh Harris<\/a><\/u>\u00a0on this project. We were expected to each design and 3D-print wheels and mounts for the stepper motors. We printed out a <u><a href=\"https:\/\/www.thingiverse.com\/thing:636967\/comments\">ping-pong wheel<\/a><\/u>\u00a0for the back using a premade design from CudaEngineering. We used ultrasonic sensors and a flame sensor. Check out my previous posts to learn more about the 3D-printed parts and the sensors. The robot had to complete a short track of turns before putting out the flame. The track could be set up with both turns left and right.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-600\" src=\"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-content\/uploads\/sites\/1702\/2022\/12\/Picture2-300x280.png\" alt=\"\" width=\"300\" height=\"280\" \/><\/p>\n<p>The robot only had to be able to solve one of the versions. When it came time to build the robot, I ensured all the individual pieces worked before trying to connect them all. Then I worked on making the robot drive and turn correctly. After that, we then began connecting everything together. We went through a couple of iterations before our final design. The first design was about 50% longer than the first design. We had to make it shorter so the robot could turn without hitting the track&#8217;s walls. We added a second ultrasonic sensor to the robot&#8217;s right side in the final iteration. We wanted to do more than meet the requirements. By adding the additional sensor, the robot can solve both versions of the track without changing the code. I gained a better understanding of programming from this project. I learned how more about how to go about gluing different pieces of code together. I learned how to visualize better how the code should work. Creating a flow chart for the robot helped me see how to connect the different bits of code.<\/p>\n<p><a href=\"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-content\/uploads\/sites\/1702\/2022\/12\/FFR-Flow-chart.png\"><strong><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-605\" src=\"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-content\/uploads\/sites\/1702\/2022\/12\/FFR-Flow-chart-300x169.png\" alt=\"\" width=\"300\" height=\"169\" \/><\/strong><\/a><\/p>\n<p>Our robot follows the flow chart with some differences. When the robot senses a wall in front of it, it checks to see if there is a wall on its right side. If the path is clear, it turns right; if not, the robot turns left.<\/p>\n<pre> \u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">if<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">cm<\/span> <span style=\"color: #434f54;\">&lt;<\/span> <span style=\"color: #000000;\">20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/wall in front<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">if<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">cmRight<\/span> <span style=\"color: #434f54;\">&lt;<\/span> <span style=\"color: #000000;\">20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/wall on the right<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">turnLeftByDegrees<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">90<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \u00a0\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"turning left\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end if turn left<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">cmRight<\/span> <span style=\"color: #434f54;\">&gt;<\/span> <span style=\"color: #000000;\">20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/no wall on the right<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">turnRightByDegrees<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">90<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"turning right\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end if turn right<\/span>\r\n \u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end if<\/span>\r\n\r\n<\/pre>\n<p>Another alteration is when the flame is sensed but has not been extinguished. If the flame has not been put out, the robot will drive forward until the fire is extinguished.<\/p>\n<pre> \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">while<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">sensorValue<\/span> <span style=\"color: #434f54;\">&lt;<\/span> <span style=\"color: #000000;\">700<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/fire is still detected<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">sensorValue<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #d35400;\">analogRead<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">A0<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d35400;\">digitalWrite<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">13<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">HIGH<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">driveForwardDistance<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">5<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d35400;\">delay<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">500<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">sensorValue<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"Flame is still there\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end while<\/span>\r\n<\/pre>\n<p>Here is the completed project.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-593\" src=\"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-content\/uploads\/sites\/1702\/2022\/12\/Fire-fighting-robot-247x300.jpg\" alt=\"\" width=\"247\" height=\"300\" \/><\/p>\n<p><iframe loading=\"lazy\" title=\"Fire-Fighting Robot\" width=\"1080\" height=\"608\" src=\"https:\/\/www.youtube.com\/embed\/K4-J9IwD7wU?feature=oembed\"  allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>We were able to accomplish solving the problem. Our robot worked how we wanted it. If I had more time to work on the fire-fighting robot, I would make it able to sense walls on both sides of it. I would do that by either adding another ultrasonic sensor or attaching the sensor to a motor so it could rotate to check both sides. Then I would program in additional code so it could drive backward and turn around 180 degrees.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the final project in my first-year engineering class, we were tasked with building a robot capable of solving a short maze, sensing a flame, and then putting it out. I worked with Josh Harris\u00a0on this project. We were expected to each design and 3D-print wheels and mounts for the stepper motors. We printed out [&hellip;]<\/p>\n","protected":false},"author":1821,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"<p>For the final project in my first-year engineering class, we were tasked with building a robot capable of solving a short maze, sensing a flame, and then putting it out. I worked with Josh Harris on this project. <a href=\"https:\/\/portfolio.wcu.edu\/jaharris13\/\">Here is the link to his blog.<\/a> We were expected to each design and 3D-print wheels and mounts for the stepper motors. We printed out a <a href=\"https:\/\/www.thingiverse.com\/thing:636967\/comments\">ping-pong wheel<\/a> for the back using a premade design from CudaEngineering. We used ultrasonic sensors and a flame sensor. Check out my previous posts to learn more about the 3D-printed parts and the sensors. The robot had to complete a short track of turns before putting out the flame. The track could be set up with both turns left and right. The robot only had to be able to solve one of the versions. When it came time to build the robot, I ensured all the individual pieces worked before trying to connect them all. Then I worked on making the robot drive and turn correctly. After that, we then began connecting everything together. We went through a couple of iterations before our final design. The first design was about 50% longer than the first design. We had to make it shorter so the robot could turn without hitting the track's walls. We added a second ultrasonic sensor to the robot's right side in the final iteration. We wanted to do more than meet the requirements. By adding the additional sensor, the robot can solve both versions of the track without changing the code. I gained a better understanding of programming from this project. I learned how more about how to go about gluing different pieces of code together. I learned how to visualize better how the code should work. Creating a flow chart for the robot helped me see how to connect the different bits of code.<\/p><p><strong><img class=\"alignnone size-medium wp-image-592\" src=\"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-content\/uploads\/sites\/1702\/2022\/12\/Flow-chart-279x300.jpg\" alt=\"\" width=\"279\" height=\"300\" \/><\/strong><\/p><p>Our robot follows the flow chart with some differences. When the robot senses a wall in front of it, it checks to see if there is a wall on its right side. If the path is clear, it turns right; if not, the robot turns left.<\/p><pre> \u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">if<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">cm<\/span> <span style=\"color: #434f54;\"><<\/span> <span style=\"color: #000000;\">20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/wall in front<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">if<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">cmRight<\/span> <span style=\"color: #434f54;\"><<\/span> <span style=\"color: #000000;\">20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/wall on the right<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">turnLeftByDegrees<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">90<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \u00a0\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"turning left\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end if turn left<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">cmRight<\/span> <span style=\"color: #434f54;\">><\/span> <span style=\"color: #000000;\">20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/no wall on the right<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">turnRightByDegrees<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">90<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"turning right\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end if turn right<\/span>\r\n \u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end if<\/span>\r\n\r\n<\/pre><p>Another alteration is when the flame is sensed but has not been extinguished. If the flame has not been put out, the robot will drive forward until the fire is extinguished.<\/p><pre> \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5e6d03;\">while<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">sensorValue<\/span> <span style=\"color: #434f54;\"><<\/span> <span style=\"color: #000000;\">700<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span><span style=\"color: #434f54;\">\/\/fire is still detected<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">sensorValue<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #d35400;\">analogRead<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">A0<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d35400;\">digitalWrite<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">13<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">HIGH<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">driveForwardDistance<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">5<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #d35400;\">delay<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">500<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">sensorValue<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"Flame is still there\"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #000000;\">}<\/span><span style=\"color: #434f54;\">\/\/end while<\/span>\r\n<\/pre><p>Here is the completed project.<\/p><p><img class=\"alignnone size-medium wp-image-593\" src=\"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-content\/uploads\/sites\/1702\/2022\/12\/Fire-fighting-robot-247x300.jpg\" alt=\"\" width=\"247\" height=\"300\" \/><\/p><p>[embed]https:\/\/www.youtube.com\/watch?v=K4-J9IwD7wU[\/embed]<\/p><p>\u00a0<\/p><p>We were able to accomplish solving the problem. Our robot worked how we wanted it. If I had more time to work on the fire-fighting robot, I would make it able to sense walls on both sides of it. I would do that by either adding another ultrasonic sensor or attaching the sensor to a motor so it could rotate to check both sides. Then I would program in additional code so it could drive backward and turn around 180 degrees.<\/p>","_et_gb_content_width":"","footnotes":""},"categories":[8,10,9],"tags":[],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-engr-199","category-final-project","category-fire-fighting-robot"],"_links":{"self":[{"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/users\/1821"}],"replies":[{"embeddable":true,"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/comments?post=566"}],"version-history":[{"count":13,"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":606,"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/posts\/566\/revisions\/606"}],"wp:attachment":[{"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/media?parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/categories?post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/portfolio.wcu.edu\/jclay2-engr\/wp-json\/wp\/v2\/tags?post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}