{"id":3867,"date":"2015-06-11T09:49:34","date_gmt":"2015-06-11T14:49:34","guid":{"rendered":"http:\/\/www.plastibots.com\/?p=3867"},"modified":"2017-05-27T06:28:16","modified_gmt":"2017-05-27T11:28:16","slug":"iot-garage-monitor-with-finger-print-sensor","status":"publish","type":"post","link":"https:\/\/www.plastibots.com\/index.php\/2015\/06\/11\/iot-garage-monitor-with-finger-print-sensor\/","title":{"rendered":"IoT Garage Door Monitor\/Opener with Finger Print Scanner"},"content":{"rendered":"<p>I&#8217;ve got a lot of stuff in my garage, and having\u00a03 kids (one of them being me!) with forgetful minds,<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-thumbnail wp-image-3896 alignright\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions-150x150.jpg\" alt=\"garageMonDescriptions\" width=\"150\" height=\"150\" \/><\/a> the garage door is sometimes left open over night. \u00a0I don&#8217;t really like that\u00a0sinking feeling after waking up the next day to find the door was left open. \u00a0Between loosing valuables\u00a0and critters that make a mess of garbage, I finally decided it&#8217;s time to take a stance! \u00a0I have an IP Cam mounted inside the garage and, for the past few years, have used it as a means to monitor valuables. \u00a0I wanted to take it to the next step by getting notifications of door status\u00a0both inside my house (blinking LED in the hallway I could check before bed time) and on my various smart devices (iOs\/Android). \u00a0I also wanted to be able to remotely open\/close the doors as well as do away with the keycode entry system I have, and instead use a fingerprint scanner to open\/close the doors. \u00a0(I&#8217;m good at scope creep). \u00a0During my daytime job I spend much\u00a0of my time\u00a0managing it, and, in my hobbies, loosing control of it! It&#8217;s my style, what can I say. \u00a0This is now integrated into my <a href=\"http:\/\/www.plastibots.com\/index.php\/2017\/01\/03\/wiot-2-weather-station-nextion-tft-with-esp8266\/\" target=\"_blank\">WIoT-2<\/a> master unit.<\/p>\n<p>&lt;!&#8211;more&#8211;&gt;<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>What it Does:\u00a0<\/strong><\/p>\n<ul>\n<li>Monitors both garage doors identifies status via:\n<ul>\n<li>LED that blinks inside the house (to alert us before we go to bed)<\/li>\n<li>iOS \/ Android\u00a0<a href=\"http:\/\/www.blynk.cc\/\" target=\"_blank\">Blynk <\/a>App for notifications and remote control of doors.<\/li>\n<\/ul>\n<\/li>\n<li>Allow open \/ closing of either garage door by:\n<ul>\n<li>Simple buttons on the controller itself inside the garage (Allows the garage to be closed from inside without needing to enter a code).<\/li>\n<li>Fingerprint sensor mounted on the outside of the garage.<\/li>\n<li>Remotely using the Blynk app on Android or iOS devices.<\/li>\n<li>Includes Patented <em>MeagerSecure<\/em> password encryption. \ud83d\ude09<\/li>\n<\/ul>\n<\/li>\n<li>Uses Arduino and IOT connected components to web-enable the hardware.<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>How it works:<\/strong><\/p>\n<p>The project takes a number of features of the garage openers that are already in place. \u00a0 I pulled additional lines from each opener that are uses for the manual opener buttons already located in the garage. \u00a0 These are connected to 2 relays in the controller and triggerd by Blynk or the fingerprint scanner. \u00a0I also added to limit switches to each door. \u00a0The circuit is\u00a0<em><span style=\"text-decoration: underline;\">closed<\/span><\/em> when a door is fully open and <em>open<\/em> when the door closes. \u00a0These are used to feed status to the Open? LED&#8217;s in Blynk. \u00a0Wires for the open\/close, limit switches and remote LED monitors all run into the enclosure.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3934 size-full aligncenter\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/connections1.png\" alt=\"\" width=\"879\" height=\"348\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/connections1.png 879w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/connections1-300x119.png 300w\" sizes=\"auto, (max-width: 879px) 100vw, 879px\" \/><\/p>\n<p>&nbsp;<br \/>\n<center><a href=\"http:\/\/www.banggood.com\/collection-3161.html?utmid=1540&#038;utm_campaign=b69407&#038;utm_content=Klaus&#038;p=R90804949020201412E4&#038;bid=33840&#038;utm_design=32\" target=\"_blank\"><img decoding=\"async\" src=\"http:\/\/img.banggood.com\/deals\/affiliate_member_banner\/6ffad86b9a8dd4a3e98df1b0830d1c8c44.jpg\" \/><\/a><\/center><br \/>\n<iframe loading=\"lazy\" title=\"IoT Garage Door Monitor\/Opener with Finger Print Scanner\" width=\"500\" height=\"375\" src=\"https:\/\/www.youtube.com\/embed\/D-zcTDeq6Yc?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<table>\n<tbody>\n<tr>\n<td><strong>Key Components:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.adafruit.com\/products\/1510\" target=\"_blank\">Adafruit CC3000<\/a> WiFi Module w\/UFL antenna<\/li>\n<li><a href=\"https:\/\/www.sparkfun.com\/products\/11792\" target=\"_blank\">Sparkfun\u00a0Fingerprint Scanner<\/a> &#8211; TTL (GT-511C3) &#8211;\u00a0<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/GT-511C3_datasheet_V1-1_20130411.pdf\" target=\"_blank\">Datasheet<\/a><\/li>\n<li><a href=\"http:\/\/www.banggood.com\/ATmega328P-Nano-V3-Controller-Board-Compatible-Arduino-p-940937.html?p=R90804949020201412E4\" target=\"_blank\">Arduino Nano<\/a> (with Optiboot bootloader)<\/li>\n<li>TTL Level Shifter (for the FPS)<\/li>\n<li>2 Relays (1 per door). \u00a0<a href=\"http:\/\/www.banggood.com\/Wholesale-5V-2-Channel-Relay-Module-Shield-for-Arduino-ARM-PIC-AVR-DSP-Electronic-10A-p-48610.html?p=R90804949020201412E4\" target=\"_blank\">Here<\/a> or go with SSR&#8217;s\u00a0<a href=\"http:\/\/www.banggood.com\/G3MB-202P-DC-5V-Solid-State-Relay-Module-p-980027.html?p=R90804949020201412E4\">here<\/a>\u00a0.<\/li>\n<li>2.x mm <a href=\"http:\/\/www.banggood.com\/buy\/Dc-jack.html?p=R90804949020201412E4\">DC jack<\/a> and DC plug.<\/li>\n<li>Various switches \/ resistors \/ LEDs \/ connectors \/ wire<\/li>\n<li><a href=\"http:\/\/www.blynk.cc\/\" target=\"_blank\">Blynk <\/a>Connected App.<\/li>\n<li>Custom milled \u00a0CNC enclosure with acrylic cover.<\/li>\n<li>3D printed enclosure for the fingerprint scanner module and remote LED monitor.<\/li>\n<li>5V 1A power supply<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3883 size-full alignleft\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonCC3000-e1433061043746.jpg\" alt=\"garageMonCC3000\" width=\"107\" height=\"95\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3885 alignleft\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonLogicLevel-e1433060962561-150x150.jpg\" alt=\"garageMonLogicLevel\" width=\"110\" height=\"96\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3884 alignleft\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonFPS-e1433061006305-150x150.jpg\" alt=\"garageMonFPS\" width=\"122\" height=\"95\" \/><img loading=\"lazy\" decoding=\"async\" class=\" alignleft wp-image-3893\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonNanoClone-150x150.jpg\" alt=\"garageMonNanoClone\" width=\"109\" height=\"107\" \/><\/p>\n<p>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Fingerprint Scanner:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>The fingerprint scanner is going to be mounted outside in the elements. \u00a0<img loading=\"lazy\" decoding=\"async\" class=\" size-thumbnail wp-image-3899 alignright\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonFPS3D-150x150.jpg\" alt=\"garageMonFPS3D\" width=\"150\" height=\"150\" \/><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-3902 size-thumbnail alignright\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonFPSMount-150x150.jpg\" alt=\"garageMonFPSMount\" width=\"150\" height=\"150\" \/>Many hours were spent on Tinkercad designing an enclosure that would shelter the unit from the elements while still providing ease of access. \u00a0I also decided to take a gamble and try waterproofing the fingerprint scanner board. \u00a0After doing some research I came across <a href=\"http:\/\/www.homedepot.ca\/product\/neverwet-liquid-repellant-kit\/837883\">NeverWet<\/a>. \u00a0Although Rustoleum does not recommend it be used on electronics, it seems many people have tried with success, so I decided to roll the dice. \u00a0I decided to first try it on a spare Nano I had laying around. \u00a0After it was complete, I did the water dunk test and it worked fine. \u00a0 It leaves a milky residue layer over everything. \u00a0I did some testing to see if the layer provided any conductivity which would be bad news &#8211; but did not detect any. \u00a0 Afterwards, I took a chance on the Fingerprint Scanner, which also worked. \u00a0 I&#8217;m still toying around with designs on the enclosure. Primarily to come up with something that provides better shelter from the elements. \u00a0 As for functionality, the FPS allows for enrolment of up to 200 finger scans, so I can do the whole family.Latest Design: \u00a0Allows for a cover to protect the unit and will open\/close on its own:<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_0118.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-thumbnail wp-image-3969 alignnone\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_0118-150x150.jpg\" alt=\"IMG_0118\" width=\"150\" height=\"150\" \/><\/a> <a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_0117.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-thumbnail wp-image-3968 alignnone\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IMG_0117-150x150.jpg\" alt=\"IMG_0117\" width=\"150\" height=\"150\" \/><\/a><a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/FPS1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-thumbnail wp-image-3965\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/FPS1-150x150.png\" alt=\"FPS1\" width=\"150\" height=\"150\" \/><\/a> <a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/FPS2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-thumbnail wp-image-3966\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/FPS2-150x150.png\" alt=\"FPS2\" width=\"150\" height=\"150\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Remote Control via iOS \/ Android:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>I am using <a href=\"http:\/\/www.blynk.cc\/\" target=\"_blank\">Blynk <\/a>to remotely monitor and control the garage doors. \u00a0The picture over there&gt;&gt; is the iOS version. \u00a0It&#8217;s a pretty slick app and approach. \u00a0 You can create<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonBlynk.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-3929 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonBlynk-150x150.png\" alt=\"\" width=\"150\" height=\"150\" \/><\/a> buttons, sliders, graphs, LEDs and tag them to Analog, Digital or Virtual Pins on your Arduino. \u00a0They can \u00a0be on the sending or receiving end of state changes. \u00a0The Analog\u00a0and Digital pins match those pins on your Duino directly. \u00a0The real benefit is in the Virtual pins. \u00a0Blynk needs a method to assign actions to react, and uses Virtual Pins for this. \u00a0The idea is you assign a Blynk button to a virtual pin, then use a subroutine within your sketch to intercept the state change (i.e from 0 to 1) and then write whatever code you want to react. \u00a0In my case, when one of the door buttons are pressed, the function catches that, and triggers a door to open. \u00a0 \u00a0I added a password-like feature by using 4 sliders. \u00a0The concept is that you use each slider to identify a digit of a 4-digit password, then the app unlocks the buttons to open \/ close the doors for a period of time. \u00a0The Arduino sketch actually takes care of this. \u00a0The sliders will reset to 0 after a period of time. \u00a0Additionally, a LED illuminates when the correct password was entered. \u00a0Although it&#8217;s obvious that this whole approach is limited in security, it adds an additional level of obfuscation that does the trick for what I am trying to achieve here. \u00a0As they say, it keeps the honest people honest.Blynk is relatively new and \u00a0the developers are adding new functionality all the time. \u00a0I have high hopes for the upcoming LCD widget. \u00a0As my sketch ha<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonBlynkExplained.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-3951 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonBlynkExplained-150x150.jpg\" alt=\"garageMonBlynkExplained\" width=\"150\" height=\"150\" \/><\/a>s quickly approached the 32K limit, I will be looking to the LCD widget to offload some code responsibility to allow me to use the Blynk app to enrol new fingerprints to the scanner (amongst other things). \u00a0I&#8217;ll be using the LCD widget to relay next step text while enrolling.<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Pebble Time Notification:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>Just got the latest iOS\u00a0<a href=\"http:\/\/www.blynk.cc\" target=\"_blank\">Blynk <\/a>update and now can receive notifications on my <a href=\"https:\/\/getpebble.com\" target=\"_blank\">Pebble Time<\/a>\u00a0when the hardware goes offline! \u00a0Will also be adding open\/closing notifications shortly.\u00a0<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IoTGarageMonitorBlynkPebble.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-4153 size-medium\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IoTGarageMonitorBlynkPebble-273x300.jpg\" alt=\"IoTGarageMonitorBlynkPebble\" width=\"273\" height=\"300\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IoTGarageMonitorBlynkPebble-273x300.jpg 273w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/IoTGarageMonitorBlynkPebble.jpg 800w\" sizes=\"auto, (max-width: 273px) 100vw, 273px\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Prototyping phase:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>Showing components hooked up via breadboard and the Blynk app customized with a few buttons and status LEDs. \u00a0<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/gmon1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-medium wp-image-3866\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/gmon1-300x169.jpg\" alt=\"gmon1\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/gmon1-300x169.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/gmon1.jpg 800w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>If you are looking for an easy way to get our device into the IOT world, you have to check out Blynk. \u00a0It&#8217;s easy to setup and use. \u00a0Took me less than 5 minutes to get it integrated into this project! \u00a0The great thing about the app is that you simply download it, generate an Authorize token, open a sample Blynk app, add in the auth token and fire up the connection. Done. \u00a0The sample apps provide enough examples to get you started with building your project.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Final Control Board &amp; Custom Enclosure with FPS ready for install:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>This was one of my bigger projects as it contained many components and spanned both local control and the Internet via smartphone.\u00a0<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-3896 size-medium\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions-300x157.jpg\" alt=\"garageMonDescriptions\" width=\"300\" height=\"157\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions-300x157.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions-1024x534.jpg 1024w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions.jpg 1173w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>\u00a0The enclosure was custom milled out of a single cutting board. \u00a0One of the biggest challenges I had was issues with the Nano \/ CC3000 freezing and locking up. \u00a0This not good as it required a physical power cycle. \u00a0This thing sat mostly complete on my desk for 2 weeks while I tried to figure out how to solve the issue. \u00a0I also used this as debugging time to see how long it would remain running. \u00a0Now that I have fixed the crashing issue, it has been running non-stope for days now. \u00a0More on that below.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Items of Interest:<\/strong><\/p>\n<figure id=\"attachment_3979\" aria-describedby=\"caption-attachment-3979\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/UNO-R3-ATmega328P-Board-2_4-Inch-TFT-LCD-Screen-Module-For-Arduino-p-945755.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3979 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture-150x150.jpg\" alt=\"UNO R3 ATmega328P Board + 2.4 Inch TFT LCD Touch Screen\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture-150x150.jpg 150w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture-300x297.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture.jpg 305w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><figcaption id=\"caption-attachment-3979\" class=\"wp-caption-text\">UNO R3 + Touch Screen<\/figcaption><\/figure>\n<figure id=\"attachment_3980\" aria-describedby=\"caption-attachment-3980\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/UNO-Basic-Starter-Learning-Kit-Upgrade-Version-For-Arduino-p-970714.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3980 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture1-150x150.jpg\" alt=\"Starter Kit\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture1-150x150.jpg 150w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture1-298x300.jpg 298w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture1.jpg 328w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><figcaption id=\"caption-attachment-3980\" class=\"wp-caption-text\">Starter Kit<\/figcaption><\/figure>\n<figure id=\"attachment_3981\" aria-describedby=\"caption-attachment-3981\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/37-In-1-Sensor-Module-Board-Set-Kit-For-Arduino-p-89734.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3981 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture2-150x150.jpg\" alt=\"Sensor Kit\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture2-150x150.jpg 150w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture2-300x300.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture2.jpg 327w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><figcaption id=\"caption-attachment-3981\" class=\"wp-caption-text\">37 In 1 Sensor Kit<\/figcaption><\/figure>\n<figure id=\"attachment_3982\" aria-describedby=\"caption-attachment-3982\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/ATmega328P-Arduino-Compatible-Nano-V3-Improved-Version-With-USB-Cable-p-933647.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3982 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture3-150x150.jpg\" alt=\"Nano (ATmega328P)\" width=\"150\" height=\"150\" \/><\/a><figcaption id=\"caption-attachment-3982\" class=\"wp-caption-text\">Nano (ATmega328P)<\/figcaption><\/figure>\n<figure id=\"attachment_3983\" aria-describedby=\"caption-attachment-3983\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/Wholesale-Arduino-Compatible-R3-UNO-ATmega16U2-AVR-USB-Board-p-68537.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3983 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture4-150x150.jpg\" alt=\"Uno ATmega16U2 \" width=\"150\" height=\"150\" \/><\/a><figcaption id=\"caption-attachment-3983\" class=\"wp-caption-text\">Uno ATmega16U2<\/figcaption><\/figure>\n<figure id=\"attachment_3984\" aria-describedby=\"caption-attachment-3984\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/Arduino-UNO-R3-Advanced-Module-Kit-Electronic-Learning-For-Arduino-p-965085.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3984 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture5-150x150.jpg\" alt=\"Uno R3 Advanced Kit\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture5-150x150.jpg 150w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture5-320x320.jpg 320w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a><figcaption id=\"caption-attachment-3984\" class=\"wp-caption-text\">Uno R3 Advanced Kit<\/figcaption><\/figure>\n<figure id=\"attachment_3985\" aria-describedby=\"caption-attachment-3985\" style=\"width: 150px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/www.banggood.com\/HC-06-Wireless-Bluetooth-Transceiver-RF-Main-Module-Serial-For-Arduino-p-80364.html?p=R90804949020201412E4\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3985 size-thumbnail\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/Capture6-150x150.jpg\" alt=\"HC-06 Bluetooth\" width=\"150\" height=\"150\" \/><\/a><figcaption id=\"caption-attachment-3985\" class=\"wp-caption-text\">HC-06 Bluetooth<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Final Mounting:<\/strong><a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonMounted1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-thumbnail wp-image-3957 alignleft\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonMounted1-150x150.jpg\" alt=\"Installed\" width=\"150\" height=\"150\" \/><\/a> <a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonMounted2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-thumbnail wp-image-3956 alignleft\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/garageMonMounted2-150x150.jpg\" alt=\"garageMonMounted2\" width=\"150\" height=\"150\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Arduino Sketch: \u00a0<a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/06\/GarageMonitorBlynk.ino\" target=\"_blank\">GarageMonitorBlynk.ino<\/a><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Challenges:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>The Nano\/CC3000 crashed about once per day. The controller would lock up and could not be recovered without physically powering cycling\u00a0the controller. \u00a0 To deal with the issue I tried a few different methods:<\/p>\n<ol>\n<li>CC3000 Catch:Catch the CC3000 by checking it&#8217;s connection state and re-initiating it. \u00a0This did not work as the crash was at the Nano level (I used a blinking LED for a heartbeat &#8211; which always stopped.<\/li>\n<li>Software Reset:Added\u00a0a software reset routing based on a timer (about every 5 minutes) and a digital pin wired to RESET. \u00a0This did work to reset the Duino, but it did not catch the issue when the controller crashed. The loop simply stopped running.<\/li>\n<li>Watchdog Timer:I then stumbled across the built-in Watchdog timer (AVR WDT) \u00a0 I landed on <a href=\"https:\/\/tushev.org\/articles\/arduino\/5\/arduino-and-watchdog-timer\" target=\"_blank\">this<\/a> simple method (other options\u00a0<a href=\"http:\/\/playground.arduino.cc\/Main\/ArduinoReset\" target=\"_blank\">here<\/a>). \u00a0However, using a Nano clone, I ran into some snags. \u00a0 Turns out that these clones use some base bootloader that has certain default features. Namely, when the Watchdog catches a fault and triggers the Nano to restart, it goes into an endless bootloop (see tips below how to fix this). \u00a0The fix. \u00a0I stumbled across <a href=\"https:\/\/github.com\/Optiboot\/optiboot\" target=\"_blank\">Optiboot\u00a0<\/a>\u00a0and followed the steps to install it. \u00a0However, I ran across another issue &#8211; the boards did not show up in Arduino IDE 1.6.4, so I opened 1.0.5, followed the steps to add the Optiboot there. \u00a0Then, selected the Nano \/ Due&#8230; \u00a0328p Optiboot in the Boards menu. \u00a0 re-complied the code with the WDT settings added, downloaded and voila! It works. \u00a0I left the controller on overnight and it&#8217;s still ticking along. \u00a0I presume it has done at least 1 restart since. \u00a0 \u00a0The code is as simple as:\n<ul>\n<li><strong>#include &lt;avr\/wdt.h&gt;<\/strong> &#8211; add this to the include section.<\/li>\n<li><strong>wdt_enable(WDTO_8S);<\/strong> \u00a0 &#8211; I used the 8 second option, but there are many <a href=\"https:\/\/tushev.org\/articles\/arduino\/5\/arduino-and-watchdog-timer\" target=\"_blank\">choices<\/a>. \u00a0You will want to make sure that the WDT is only enabled after any start-up routines are done. Mine weas placed at the end of Setup(). \u00a0For example, I am using the Adafruit CC3000 which needs to establish a connection to WiFi in the Setup routine. \u00a0I added this after that call completes.<\/li>\n<li><strong>wdt_reset(); &#8211;<\/strong> \u00a0Then, all you have to do is put the reset call in your main loop. \u00a0A good idea is to put it at the beginning. \u00a0If you have sub-routines that may take more than 8 seconds to complete their task, you will also want to add this call within them. \u00a0The idea here is that these are normal operations for your code, and all you are doing is telling the Watchdog Timer to NOT restart the Arduino by resetting the timer back to 0 seconds. \u00a0 \u00a0If your Duino should crash, the Watchdog Timer is running as a separate process and continues running. \u00a0It will no longer see the reset call and trigger the Duino to restart. \u00a0Also it is important to note that this does not trigger the reset of peripherals connected to your Duino. \u00a0If you need that, you may want to use a digital pin that goes HIGH to trigger some sort of relay or transistor to turn on the peripherals. \u00a0That way, when the Nano resets, you can bring that pin LOW, then HIGH when the code restarts.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><strong>Reality vs Prototyping:<\/strong><\/p>\n<p>It never fails&#8230; \u00a0Try as best as possible to re-create a similar environment to what it would be like in the garage, I ran into a few issues.<\/p>\n<ol>\n<li><strong>WiFi Signal:<\/strong> \u00a0I suspected this would be an issue and it was. \u00a0The controller is mounted at the front of the garage interior. \u00a0It has to go through a fair bit of concrete to reach my router in the basement. \u00a0I had started with a stubby antenna and, although it connected, it seems the signal was too weak. Luckily I had a longer antenna and swapped them out. \u00a0I still have some concerns as the connection is more flaky as \u00a0my kids get on their iPads and eat up some of the bandwidth.<\/li>\n<li><strong>Door Limits:<\/strong> \u00a0This one completely caught me off guard. \u00a0It was one of the simpler components of the system. \u00a0Each door has a limit switch attached to it. \u00a0If a door is open, the switch is closed and thus I can do a simple continuity check on the pins for each door. \u00a0In code, \u00a0I had a simple check for 4 states. \u00a0When one door is open, I check as follows (\u00a0<em>if ((d1LimVal &gt;= 1000) &amp;&amp; (d2LimVal == 0))<\/em>). \u00a0\u00a0What I found was that although the open door (&gt; 1000) evaluate to be true, the open door did not. \u00a0During testing, with the limit NOT tripped, the value was 0. \u00a0However, when wires were all connected, I the 2nd value was seeing numbers between 2-6. \u00a0 A simple adjustment to the sketched fixed it, but I was not expecting this.<\/li>\n<li>Something else to keep in mind. \u00a0No matter how well you plan, you are likely to screw up pin or variable assignments. \u00a0What I am getting at here is I have 2 doors. \u00a0They both need to be monitored, they both need to have a physical switch, and also be connected to relays. \u00a0That&#8217;s 6 places to screw up. \u00a0The great advantage of the config this can be easily remedied during installation by swapping variables or pin assignments after everything is hooked up. \u00a0The only (minor) glitch I ran into is the 2 physical door opener switches had no software component and I wired them up wrong to the 2 relays. \u00a0A simple swap of the pins in the connector did the trick.<\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Other Thoughts:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<ul>\n<li>Could use an ESP8266 or similar WiFi-enabled device. \u00a0I have an Adafruit Huzzah that I wanted to try, but it came too late in the project phase. \u00a0Given the CC3000 is a bit flaky, I may switch out to the Huzzah at some point in the future. \u00a0Unless of course there&#8217;s code out there to detect and reset the CC3000 when it freezes.<\/li>\n<li>Pebble Time integration &#8211; Now that I have my Pebble Time, \u00a0I&#8217;d like to see the Blynk app send notificaitons to it, and be able to trigger responses (i.e. Open \/ Close a door). \u00a0If I get more free time, I might venture to develop an app for this myself.<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><strong>Tips:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<ol>\n<li>Watchdog Bootloop: \u00a0If you were toying around with the AVR Watchdog and discovered (as I did) that you have a Duino who&#8217;s bootloader does not play well with the Watchdog, you will want to follow the steps I noted above to install the Optiboot bootloader. \u00a0Here&#8217;s a tip to\u00a0get your Duino working again. Remove all power from the Nano \/ project. \u00a0Plug the USB into your PC, comment out the offending watchdog lines of code (namely the\u00a0wdt_enable(xxxxxx) statement), re-download the sketch. \u00a0Note, in some Nano&#8217;s, you have to click the reset button the moment the IDE starts uploading.<\/li>\n<li>I also have an IP Cam in the garage. \u00a0I&#8217;m hopeful the Blynk folks will consider adding a viewer widget to allow me to plop timed stills of my IPCam in the app. \u00a0The concept here is the status LED&#8217;s would tell me if doors are opened and when they are closing, but it is always nice to see that I&#8217;m not going to close the door on a car that is half parked in the garage. Worst case situation, I can open my IP Cam app separately and look at the IP view before triggering a door to close.<\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve got a lot of stuff in my garage, and having\u00a03 kids (one of them being me!) with forgetful minds, the garage door is sometimes left open over night. \u00a0I don&#8217;t really like that\u00a0sinking feeling after waking up the next day to find the door was left open. \u00a0Between loosing valuables\u00a0and critters that make a mess of garbage, I finally decided it&#8217;s time to take a stance! \u00a0I have an IP Cam mounted inside the &hellip; <a href=\"https:\/\/www.plastibots.com\/index.php\/2015\/06\/11\/iot-garage-monitor-with-finger-print-sensor\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":3896,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[65,78,6,57,119],"tags":[132,120,123,121,122],"class_list":["post-3867","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-electronics","category-bluetooth","category-dyihacks","category-electronics","category-iot","tag-android","tag-cc3000","tag-garage-monitor","tag-ios","tag-nano","has_thumb"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/05\/garageMonDescriptions.jpg","jetpack_shortlink":"https:\/\/wp.me\/pK41j-10n","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts\/3867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/comments?post=3867"}],"version-history":[{"count":0,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts\/3867\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/media\/3896"}],"wp:attachment":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/media?parent=3867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/categories?post=3867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/tags?post=3867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}