{"id":81,"date":"2023-02-19T03:26:34","date_gmt":"2023-02-19T03:26:34","guid":{"rendered":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/?p=81"},"modified":"2023-02-19T03:36:32","modified_gmt":"2023-02-19T03:36:32","slug":"shiyi-zhangs-status-report-for-2-18-2023","status":"publish","type":"post","link":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/2023\/02\/19\/shiyi-zhangs-status-report-for-2-18-2023\/","title":{"rendered":"Shiyi Zhang\u2019s Status Report for 02\/18\/2023"},"content":{"rendered":"<h3><b>Related ECE Courses<\/b><\/h3>\n<p><span style=\"font-weight: 400\">I learned about modularity and ethics in 15-440 Distributed Systems, 17-214 Principles of Software Construction, and 17-437 Web Application Development. An example of using the modularity principle would be that, when designing a distributed system that involves clients, proxies, and servers, it is important to divide the system into separate, independent components or modules. For our project, we have divided the system into speech recognition (backend), motion detection (backend), database (backend), user interfaces (frontend), and hardware components such as microphones and infrared sensors. Each person in our team is responsible for one or more of these modules.<\/span><\/p>\n<h3><strong>Personal Accomplishments<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">One of the tasks assigned to me was to make the infrared sensor work with the rest of the system. The sensor should signal the Raspberry Pi when a customer is within 0.3 &#8211; 1m away from the kiosk.<\/span><\/p>\n<p><span style=\"font-weight: 400\">HC-SR501 PIR sensor (front &amp; back)<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-89\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/Screenshot-2023-02-18-at-10.21.31-PM-300x139.png\" alt=\"\" width=\"300\" height=\"139\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/Screenshot-2023-02-18-at-10.21.31-PM-300x139.png 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/Screenshot-2023-02-18-at-10.21.31-PM.png 716w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">After doing some research, I made a list of hardware components I needed:<\/span><\/p>\n<p><span style=\"font-weight: 400\">1 x\u00a0HC-SR501 PIR sensor<\/span><\/p>\n<p><span style=\"font-weight: 400\">1 x 830-point solderless breadboard<\/span><\/p>\n<p><span style=\"font-weight: 400\">1 x Raspberry Pi holder compatible with Raspberry Pi 4B<\/span><\/p>\n<p><span style=\"font-weight: 400\">1 x <\/span><span style=\"font-weight: 400\">T-shape GPIO Extension Board<\/span><\/p>\n<p><span style=\"font-weight: 400\">1 x 20cm 40-pin Flat Ribbon Cable<\/span><\/p>\n<p><span style=\"font-weight: 400\">5 x <\/span><span style=\"font-weight: 400\">HC-SR501 Motion PIR sensor<\/span><\/p>\n<p><span style=\"font-weight: 400\">Resistors<\/span><\/p>\n<p><span style=\"font-weight: 400\">Jumper wires<\/span><\/p>\n<p><span style=\"font-weight: 400\">I ordered them online, and they arrived this past week. I brought the Raspberry Pi home with me from the class inventory and spent Friday assembling them. <\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-88\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/IMG_8793-300x217.jpg\" alt=\"\" width=\"300\" height=\"217\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/IMG_8793-300x217.jpg 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/IMG_8793-768x556.jpg 768w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/IMG_8793-1024x741.jpg 1024w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/IMG_8793-1200x869.jpg 1200w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">The next step was to write a Python script that would allow us to visualize when motion is detected. I downloaded the Thonny IDE and used it to write the code because of its vanilla-like interface.<\/span><\/p>\n<pre>import RPi.GPIO as GPIO \r\nimport time\r\n\r\nGPIO.setmode(GPIO.BCM)\r\nGPIO.setwarnings(False)\r\nPIR_PIN = 23\r\n\r\nGPIO.setup(PIR_PIN, GPIO.IN)\r\nprint('Starting up the PIR Module (click on STOP to exit)')\r\ntime.sleep(1)\r\nprint ('Ready')\r\n\r\nwhile True:\r\n    if GPIO.input(PIR_PIN):\r\n        print('Motion Detected')\r\n    time.sleep(2)\r\n<\/pre>\n<p><span style=\"font-weight: 400\">It prints \u201cMotion detected\u201d when the sensor detects movement (condition applied). Along the way I discovered a few places that caused bugs and fixed them by:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Giving a 1-sec sleep to settle the sensor before entering the infinite loop.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Giving a 2-sec sleep in each iteration to avoid multiple motion detections.\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">After running this code, the shell should look like:<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-90\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/Screenshot-2023-02-18-at-10.24.20-PM-300x126.png\" alt=\"\" width=\"300\" height=\"126\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/Screenshot-2023-02-18-at-10.24.20-PM-300x126.png 300w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-content\/uploads\/sites\/248\/2023\/02\/Screenshot-2023-02-18-at-10.24.20-PM.png 612w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n<h3><strong>On schedule?<\/strong><\/h3>\n<p>Yes, my progress is on schedule.<\/p>\n<h3><strong>Deliverables for next week<\/strong><\/h3>\n<p><span style=\"font-weight: 400\">It doesn\u2019t make sense to add more code for the sensor until the backend is a bit more developed (currently at the design stage). Therefore, I will move on to working on the frontend (customer UI &amp; staff UI). I will be discussing with Lisa, who is responsible for the speech recognition part, about what to display on the web pages as this is semi dependent on how &amp; how fast speech is parsed.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Related ECE Courses I learned about modularity and ethics in 15-440 Distributed Systems, 17-214 Principles of Software Construction, and 17-437 Web Application Development. An example of using the modularity principle would be that, when designing a distributed system that involves clients, proxies, and servers, it is important to divide the system into separate, independent components &hellip; <a href=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/2023\/02\/19\/shiyi-zhangs-status-report-for-2-18-2023\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Shiyi Zhang\u2019s Status Report for 02\/18\/2023&#8221;<\/span><\/a><\/p>\n","protected":false},"author":711,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[11],"_links":{"self":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/posts\/81"}],"collection":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/users\/711"}],"replies":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":13,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":97,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/posts\/81\/revisions\/97"}],"wp:attachment":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s23-teamd3\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}