{"id":325,"date":"2016-10-28T22:35:04","date_gmt":"2016-10-28T22:35:04","guid":{"rendered":"https:\/\/zhutarduino.wordpress.com\/?page_id=325"},"modified":"2020-10-12T16:25:02","modified_gmt":"2020-10-12T16:25:02","slug":"arduino-how-to-bluetooth-control-up-to-12-relays-with-my-free-app","status":"publish","type":"page","link":"https:\/\/thezhut.com\/?page_id=325","title":{"rendered":"ARDUINO, How To Bluetooth Control Up To 12 Relays With My Free APP"},"content":{"rendered":"<p>There are thousands of uses for relays and this free app I\u00a0wrote will let you control up to 12 of them with a ARDUINO board and an ANDROID phone or tablet.<\/p>\n<p>Use this app to control your greenhouse, hydroponics or even your sprinkler systems .<\/p>\n<h2><\/h2>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/irelay1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-326\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/irelay1.jpg?w=300\" alt=\"irelay1\" width=\"597\" height=\"398\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/irelay1.jpg 5184w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/irelay1-300x200.jpg 300w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/irelay1-768x512.jpg 768w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/irelay1-1024x683.jpg 1024w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/a><\/p>\n<h1><a href=\"https:\/\/www.facebook.com\/zarduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">Check us out on Facebook!\u00a0<\/a><\/h1>\n<h1>Disclamer:<\/h1>\n<h2>All the info in this tutorial is for educational purpuses, if you chose to build and use this project we are not responsible for any damage, injuries or DEATH !!!!!!!!!!!!!!!!!!!!!!! Build at your own RISK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<\/h2>\n<h1>Click below\u00a0for a\u00a0video tutorial for this project.<\/h1>\n<p><iframe loading=\"lazy\" title=\"ARDUINO, How To Bluetooth Control Up To 12 Relays With My Free APP\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/rfpPJK3Cx-c?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<h1><\/h1>\n<h1>THE APP:<\/h1>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/screenshot_2016-10-28-15-41-25.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-327\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/screenshot_2016-10-28-15-41-25.png?w=169\" alt=\"screenshot_2016-10-28-15-41-25\" width=\"397\" height=\"707\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/screenshot_2016-10-28-15-41-25.png 480w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/screenshot_2016-10-28-15-41-25-169x300.png 169w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/a><\/p>\n<p>I wrote this APP to be\u00a0straight forward and easy to use.<\/p>\n<p>You can download the APP at this link for free: \u00a0<a href=\"https:\/\/drive.google.com\/open?id=0B0ZYw2jO5Q3DWjBoeE5RaFhNZzA\" target=\"_blank\" rel=\"noopener noreferrer\">GET THE FREE RELAY APP<\/a><\/p>\n<h1>BUILDING THE CIRCUIT:<\/h1>\n<p>This circuit is easy to build and not a lot of parts will be needed. Now if you&#8217;re not using a self-powered optically isolated relays please\u00a0go to the following link to learn how to use optocoupler&#8217;s with relays, you may also need to use transistors to activate the relays.<\/p>\n<p>If you are using the easy to use\u00a0powered relays like the one in the picture\u00a0at the top of this page you wont have to add anything. Make sure the relays you use will be activated by 5 volts and can handle the amps &amp; voltage you are going to use them at.<\/p>\n<h2>Parts List:<\/h2>\n<p>#affiliate links#<\/p>\n<p><a href=\"https:\/\/www.amazon.com\/gp\/search\/ref=as_li_qf_sp_sr_il_tl?ie=UTF8&amp;tag=zhut01-20&amp;keywords=arduino relay&amp;index=aps&amp;camp=1789&amp;creative=9325&amp;linkCode=xm2&amp;linkId=dd259afa412f49e67fb0ba464beb4864\">Relay<\/a><\/p>\n<p><a href=\"https:\/\/www.amazon.com\/gp\/search\/ref=as_li_qf_sp_sr_il_tl?ie=UTF8&amp;tag=zhut01-20&amp;keywords=hc-06&amp;index=aps&amp;camp=1789&amp;creative=9325&amp;linkCode=xm2&amp;linkId=4e7e689701e3a00f4562a029e94e97eb\" target=\"_blank\" rel=\"noopener noreferrer\">HC-06 Bluetooth\u00a0module\u00a0<\/a><\/p>\n<p><a href=\"https:\/\/www.amazon.com\/gp\/search\/ref=as_li_qf_sp_sr_il_tl?ie=UTF8&amp;tag=zhut01-20&amp;keywords=arduino board&amp;index=aps&amp;camp=1789&amp;creative=9325&amp;linkCode=xm2&amp;linkId=e645a0e20679b20bec54ca0b371732b7\" target=\"_blank\" rel=\"noopener noreferrer\">ARDUINO Board<\/a>\u00a0(I used a nano but most ARDUINO boards will work)<\/p>\n<p><a href=\"https:\/\/www.amazon.com\/gp\/search\/ref=as_li_qf_sp_sr_il_tl?ie=UTF8&amp;tag=zhut01-20&amp;keywords=resistors&amp;index=aps&amp;camp=1789&amp;creative=9325&amp;linkCode=xm2&amp;linkId=689525835262d6262a84adc348b61734\" target=\"_blank\" rel=\"noopener noreferrer\">5K &amp; 10K resistor\u00a0<\/a><\/p>\n<p><a href=\"https:\/\/www.amazon.com\/gp\/search\/ref=as_li_qf_sp_sr_il_tl?ie=UTF8&amp;tag=zhut01-20&amp;keywords=arduino breadboard&amp;index=aps&amp;camp=1789&amp;creative=9325&amp;linkCode=xm2&amp;linkId=ceacbe7ac746da4cfc2b02698c49a60d\" target=\"_blank\" rel=\"noopener noreferrer\">BreadBoard<\/a><\/p>\n<p><a href=\"https:\/\/www.amazon.com\/gp\/search\/ref=as_li_qf_sp_sr_il_tl?ie=UTF8&amp;tag=zhut01-20&amp;keywords=arduino jumper wires&amp;index=aps&amp;camp=1789&amp;creative=9325&amp;linkCode=xm2&amp;linkId=f3fad19610cad8047683052c5660b396\" target=\"_blank\" rel=\"noopener noreferrer\">Jumper Wires<\/a><\/p>\n<h2>The Circuit:<\/h2>\n<p>Modify to your needs. relay 1 is on pin 2, relay 2 is on pin 3 , relay 3 is on pin 4 and so on. If you use all 12 relays the last one relay 12 on pin 13 will turn on and of a few times when you first power it up.. You can use 1\u00a0or all 12 relays, the app and arduino will work fine if they are not all connected..<\/p>\n<p>The LED connected to the relay is just a example for how it can be used&#8230;&#8230;.<\/p>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/relay_schem.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-331\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/relay_schem.jpg?w=300\" alt=\"relay_schem\" width=\"663\" height=\"440\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/relay_schem.jpg 1275w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/relay_schem-300x199.jpg 300w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/relay_schem-768x510.jpg 768w, https:\/\/thezhut.com\/wp-content\/uploads\/2016\/10\/relay_schem-1024x679.jpg 1024w\" sizes=\"auto, (max-width: 663px) 100vw, 663px\" \/><\/a><\/p>\n<h1>The ARDUINO Code:<\/h1>\n<p>Just copy and past this code into your arduino IDE, Dont change any thing&#8230;.!!!!!!!!!!<br \/>\nint relay1 = 2;<br \/>\nint relay2 = 3;<br \/>\nint relay3 = 4;<br \/>\nint relay4 = 5;<br \/>\nint relay5 = 6;<br \/>\nint relay6 = 7;<br \/>\nint relay7 = 8;<br \/>\nint relay8 = 9;<br \/>\nint relay9 = 10;<br \/>\nint relay10 = 11;<br \/>\nint relay11 = 12;<br \/>\nint relay12 = 13;<br \/>\nvoid setup() {<br \/>\nSerial.begin(9600);<br \/>\npinMode(relay1, OUTPUT);<br \/>\npinMode(relay2, OUTPUT);<br \/>\npinMode(relay3, OUTPUT);<br \/>\npinMode(relay4, OUTPUT);<br \/>\npinMode(relay5, OUTPUT);<br \/>\npinMode(relay6, OUTPUT);<br \/>\npinMode(relay7, OUTPUT);<br \/>\npinMode(relay8, OUTPUT);<br \/>\npinMode(relay9, OUTPUT);<br \/>\npinMode(relay10, OUTPUT);<br \/>\npinMode(relay11, OUTPUT);<br \/>\npinMode(relay12, OUTPUT);<br \/>\n}<br \/>\nvoid loop() {<br \/>\nif (Serial.available() &gt;= 2 )<br \/>\n{<br \/>\nunsigned int a = Serial.read();<br \/>\nunsigned int b = Serial.read();<br \/>\nunsigned int val = (b * 256) + a;<br \/>\nif (val == 100) \/\/ relay #1 on<br \/>\n{<br \/>\ndigitalWrite(relay1, HIGH);<br \/>\n}<br \/>\nelse if (val == 200) \/\/ relay #1 off<br \/>\n{<br \/>\ndigitalWrite(relay1, LOW);<br \/>\n}<br \/>\nelse if (val == 300) \/\/ relay #2 on<br \/>\n{<br \/>\ndigitalWrite(relay2, HIGH);<br \/>\n}<br \/>\nelse if (val == 400) \/\/ relay #2 off<br \/>\n{<br \/>\ndigitalWrite(relay2, LOW);<br \/>\n}<br \/>\nelse if (val == 500) \/\/ relay #3 on<br \/>\n{<br \/>\ndigitalWrite(relay3, HIGH);<br \/>\n}<br \/>\nelse if (val == 600) \/\/ relay #3 off<br \/>\n{<br \/>\ndigitalWrite(relay3, LOW);<br \/>\n}<br \/>\nelse if (val == 700) \/\/ relay #4 on<br \/>\n{<br \/>\ndigitalWrite(relay4, HIGH);<br \/>\n}<br \/>\nelse if (val == 800) \/\/ relay #4 off<br \/>\n{<br \/>\ndigitalWrite(relay4, LOW);<br \/>\n}<br \/>\nelse if (val == 900) \/\/ relay #5 on<br \/>\n{<br \/>\ndigitalWrite(relay5, HIGH);<br \/>\n}<br \/>\nelse if (val == 1000) \/\/ relay #5 off<br \/>\n{<br \/>\ndigitalWrite(relay5, LOW);<br \/>\n}<br \/>\nelse if (val == 1100) \/\/ relay #6 on<br \/>\n{<br \/>\ndigitalWrite(relay6, HIGH);<br \/>\n}<br \/>\nelse if (val == 1200) \/\/ relay #6 off<br \/>\n{<br \/>\ndigitalWrite(relay6, LOW);<br \/>\n}<br \/>\nelse if (val == 1300) \/\/ relay #7 on<br \/>\n{<br \/>\ndigitalWrite(relay7, HIGH);<br \/>\n}<br \/>\nelse if (val == 1400) \/\/ relay #7 off<br \/>\n{<br \/>\ndigitalWrite(relay7, LOW);<br \/>\n}<br \/>\nelse if (val == 1500) \/\/ relay #8 on<br \/>\n{<br \/>\ndigitalWrite(relay8, HIGH);<br \/>\n}<br \/>\nelse if (val == 1600) \/\/ relay #8 off<br \/>\n{<br \/>\ndigitalWrite(relay8, LOW);<br \/>\n}<br \/>\nelse if (val == 1700) \/\/ relay #9 on<br \/>\n{<br \/>\ndigitalWrite(relay9, HIGH);<br \/>\n}<br \/>\nelse if (val == 1800) \/\/ relay #9 off<br \/>\n{<br \/>\ndigitalWrite(relay9, LOW);<br \/>\n}<br \/>\nelse if (val == 1900) \/\/ relay #10 on<br \/>\n{<br \/>\ndigitalWrite(relay10, HIGH);<br \/>\n}<br \/>\nelse if (val == 2000) \/\/ relay #10 off<br \/>\n{<br \/>\ndigitalWrite(relay10, LOW);<br \/>\n}<br \/>\nelse if (val == 2100) \/\/ relay #11 on<br \/>\n{<br \/>\ndigitalWrite(relay11, HIGH);<br \/>\n}<br \/>\nelse if (val == 2200) \/\/ relay #11 off<br \/>\n{<br \/>\ndigitalWrite(relay11, LOW);<br \/>\n}<br \/>\nelse if (val == 2300) \/\/ relay #12 on<br \/>\n{<br \/>\ndigitalWrite(relay12, HIGH);<br \/>\n}<br \/>\nelse if (val == 2400) \/\/ relay #12 off<br \/>\n{<br \/>\ndigitalWrite(relay12, LOW);<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<hr \/>\n<h2>IF you have any questions or just want to be notified when new tutorials are added please go to our <a href=\"https:\/\/www.facebook.com\/zarduino\/\" target=\"_blank\" rel=\"noopener noreferrer\">FaceBook<\/a> page and follow us&#8230;.<\/h2>\n<h3>Also don&#8217;t forget to check out our other tutorials, these can be found at the top of the page or <a href=\"https:\/\/zhutarduino.wordpress.com\/arduino-projects\/\" target=\"_blank\" rel=\"noopener noreferrer\">just use this link.<\/a><\/h3>\n<h1>Disclamer:<\/h1>\n<h2>All the info in this tutorial is for educational purpuses, if you chose to build and use this project we are not responsible for any damage, injuries or DEATH !!!!!!!!!!!!!!!!!!!!!!! Build at your own RISK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>There are thousands of uses for relays and this free app I\u00a0wrote will let you control up to 12 of them with a ARDUINO board and an ANDROID phone or tablet. Use this app to control your greenhouse, hydroponics or &hellip; <a href=\"https:\/\/thezhut.com\/?page_id=325\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":10,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-325","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=325"}],"version-history":[{"count":3,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/325\/revisions"}],"predecessor-version":[{"id":1588,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/325\/revisions\/1588"}],"up":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/10"}],"wp:attachment":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}