








{"id":253,"date":"2020-10-18T20:07:33","date_gmt":"2020-10-18T20:07:33","guid":{"rendered":"https:\/\/osoyoo.info\/?p=253"},"modified":"2020-10-19T19:08:24","modified_gmt":"2020-10-19T19:08:24","slug":"253","status":"publish","type":"post","link":"https:\/\/osoyoo.info\/index.php\/2020\/10\/18\/253\/","title":{"rendered":"Hardware Programming with Arduino IDE &#8211; Lesson 25: PIR motion sensor and Active buzzer"},"content":{"rendered":"<p><a href=\"https:\/\/osoyoo.info\/index.php\/2020\/10\/12\/arduino-basic-lesson-24-sound-detection-sensor\/\"><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Previous.png\" alt=\"\" width=\"206\" height=\"59\" \/><\/a> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <a href=\"https:\/\/osoyoo.info\/index.php\/2020\/10\/11\/arduino-basic-tutorial-directory\/\"><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Tutorial.png\" alt=\"\" width=\"206\" height=\"59\" \/><\/a> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <a href=\"https:\/\/osoyoo.info\/index.php\/2020\/10\/19\/arduino-basic-lesson-26-basic-car\/\"><img loading=\"lazy\" class=\"alignright\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Next.png\" alt=\"\" width=\"206\" height=\"59\" \/><\/a><\/p>\n<div align=\"center\"><img loading=\"lazy\" class=\"aligncenter size-full\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Authorized_Online_Retailers.png\" width=\"1150\" height=\"56\" \/><\/div>\n<div align=\"center\"><\/div>\n<div align=\"center\">\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td>Buy from US<\/td>\n<td>Buy from UK<\/td>\n<td>Buy from DE<\/td>\n<td>Buy from IT<\/td>\n<td>Buy from FR<\/td>\n<td>Buy from ES<\/td>\n<td>Buy from JP<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.amazon.com\/dp\/B08163QYLB\"><img loading=\"lazy\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_com.jpg\" alt=\"\" width=\"135\" height=\"30\" \/><\/a><\/td>\n<td><a href=\"https:\/\/www.amazon.dco.uk\/dp\/B08163QYLB\"><img loading=\"lazy\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_co_uk.jpg\" alt=\"\" width=\"135\" height=\"30\" \/><\/a><\/td>\n<td><a href=\"https:\/\/www.amazon.de\/dp\/B08163QYLB\"><img loading=\"lazy\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_de.jpg\" alt=\"\" width=\"135\" height=\"30\" \/><\/a><\/td>\n<td><a href=\"https:\/\/www.amazon.it\/dp\/B08163QYLB\"><img loading=\"lazy\" title=\"\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_it.jpg\" alt=\"\" width=\"135\" height=\"30\" align=\"\" \/><\/a><\/td>\n<td><a href=\"https:\/\/www.amazon.fr\/dp\/B08163QYLB\"><img loading=\"lazy\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_fr.jpg\" alt=\"\" width=\"135\" height=\"30\" \/><\/a><\/td>\n<td><a href=\"https:\/\/www.amazon.es\/dp\/B08163QYLB\"><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_es.jpg\" alt=\"\" width=\"131\" height=\"29\" \/><\/a><\/td>\n<td><a href=\"https:\/\/www.amazon.co.jp\/OSOYOO-UNO%E7%94%A8%E3%83%A2%E3%83%87%E3%83%AB3%E3%83%AD%E3%83%9C%E3%83%83%E3%83%88%E3%82%AB%E3%83%BCDIY%E3%82%B9%E3%82%BF%E3%83%BC%E3%82%BF%E3%83%BC%E3%82%AD%E3%83%83%E3%83%88-%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E3%82%92%E6%A7%8B%E7%AF%89%E3%81%99%E3%82%8B%E3%81%9F%E3%82%81%E3%81%AE%E3%83%AA%E3%83%A2%E3%83%BC%E3%83%88%E5%88%B6%E5%BE%A1%E3%82%A2%E3%83%97%E3%83%AA%E6%95%99%E8%82%B2%E7%94%A8%E9%9B%BB%E5%8B%95%E3%83%AD%E3%83%9C%E3%83%86%E3%82%A3%E3%82%AF%E3%82%B9-%E3%82%B3%E3%83%BC%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%E6%96%B9%E6%B3%95%E3%81%AE%E5%AD%A6%E7%BF%92-%E5%AD%90%E4%BE%9B%E3%80%81%E5%AD%A6%E7%94%9F%E3%80%81%E5%A4%A7%E4%BA%BA%E5%90%91%E3%81%91%E3%81%AEIoT%E6%A9%9F%E6%A2%B0%E7%9A%84%E3%82%B3%E3%83%BC%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0\/dp\/B081484STG\/ref=sr_1_107?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;keywords=Arduino+%E3%83%AD%E3%83%9C%E3%83%83%E3%83%88%E3%82%AB%E3%83%BC&amp;qid=1574040887&amp;sr=8-107\"><img loading=\"lazy\" class=\"\" src=\"https:\/\/osoyoo.com\/wp-content\/uploads\/2018\/01\/amazon_jp.jpg\" width=\"130\" height=\"29\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><img loading=\"lazy\" class=\"left aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/objective.png\" alt=\"\" width=\"1150\" height=\"56\" \/><br \/>\nIn this lesson, we will show how to use Arduino to control an active buzzer module and make beep alarm.<\/p>\n<p><img loading=\"lazy\" class=\"left aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/about_module.png\" alt=\"\" width=\"1150\" height=\"56\" \/><\/p>\n<p><img class=\"size-large aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/lesson18\/modules-PIR.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><b>\u00a0<\/b><\/p>\n<p><img class=\"size-full wp-image-7875 aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/lesson7\/modules-buzzer.png\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>In this lesson, we use a motion sensor to detect your hand motion. Once motion is detected,\u00a0 active buzzer will beep.<\/p>\n<p>&nbsp;<\/p>\n<p><img src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Parts-&amp;-Devices-min.png\" \/><\/p>\n<ul>\n<li>Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1<\/li>\n<li>OSOYOO Magic I\/O Shield for Arduino x 1<\/li>\n<li>OSOYOO PIR Motion Sensor x 1<\/li>\n<li>OSOYOO Active Buzzer x 1<\/li>\n<li>OSOYOO 3-Pin PNP Cable x 1<\/li>\n<li>USB Cable x 1<\/li>\n<li>PC x 1<\/li>\n<\/ul>\n<h1 id=\"4\"><img loading=\"lazy\" class=\"left aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/how_to_make.png\" alt=\"\" width=\"1150\" height=\"56\" \/><\/h1>\n<p>Please plug OSOYOO magic I\/O board onto UNO board First. Then \u00a0connect PIR module to Port 2 ,\u00a0 \u00a0buzzer module to Port 8\u00a0 in Osoyoo Magic I\/O board with a 3-pin PNP cable. \u00a0 Circuit connection picture as below:<\/p>\n<p><img class=\"left aligncenter\" src=\"\/upload\/pir-sensor.png\" \/><\/p>\n<p><img loading=\"lazy\" class=\"left aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/how_to_code.png\" alt=\"\" width=\"1150\" height=\"56\" \/><\/p>\n<h4><span style=\"color: #ff0000;\"><strong>Notice: Shut off your battery or Unplug your power adapter when upload sketch code to Arduino.<\/strong><\/span><\/h4>\n<p><b>Please download the sketch code from following link:<\/b><\/p>\n<h3><a href=\"https:\/\/osoyoo.info\/upload\/lesson25.zip\"><strong>https:\/\/osoyoo.info\/upload\/lesson25.zip<\/strong> <\/a><\/h3>\n<p>Unzip lesson25.zip, open the lesson25.ino sketch code and upload the code to Arduino IDE.\u00a0 Then put your hand close the PIR sensor, then the buzzer will beep. After the hand left PIR sensor, the buzzer\u00a0 will top beep.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" class=\"left aligncenter\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/how_to_play.png\" alt=\"\" width=\"1150\" height=\"56\" \/><\/p>\n<p>A few seconds after the upload finishes, you should hear the buzzer beep.<\/p>\n<div align=\"center\">\n<div align=\"center\"><iframe src=\"https:\/\/www.youtube.com\/embed\/ivPNYkuvDFI\" width=\"853\" height=\"480\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<p><strong>Note again:<\/strong><\/p>\n<p>The active buzzer has built-in oscillating source, so it will beep as long as it is electrified, but it can only beep with a fixed frequency.<\/p>\n<p><a href=\"https:\/\/osoyoo.info\/index.php\/2020\/10\/12\/arduino-basic-lesson-24-sound-detection-sensor\/\"><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Previous.png\" alt=\"\" width=\"206\" height=\"59\" \/><\/a> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <a href=\"https:\/\/osoyoo.info\/index.php\/2020\/10\/11\/arduino-basic-tutorial-directory\/\"><img loading=\"lazy\" class=\"alignnone\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Tutorial.png\" alt=\"\" width=\"206\" height=\"59\" \/><\/a> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <a href=\"https:\/\/osoyoo.info\/index.php\/2020\/10\/19\/arduino-basic-lesson-26-basic-car\/\"><img loading=\"lazy\" class=\"alignright\" src=\"https:\/\/osoyoo.com\/picture\/Arduino_Graphical_Programming_Kit\/Next.png\" alt=\"\" width=\"206\" height=\"59\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP In this lesson, we will show [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":270,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/posts\/253"}],"collection":[{"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/comments?post=253"}],"version-history":[{"count":13,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/posts\/253\/revisions"}],"predecessor-version":[{"id":274,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/posts\/253\/revisions\/274"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/media\/270"}],"wp:attachment":[{"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/media?parent=253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/categories?post=253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osoyoo.info\/index.php\/wp-json\/wp\/v2\/tags?post=253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}