In this IBLE, we’ll take a quick tour of an IoT-powered model of a Desktop Garage Door Opener. The model simulates the workings of an actual garage door opener and I use it as a rig to test changes to the entire IoT system before I deploy them to the application that controls the garage door in my house.
Step 1: The Design
Step 2: The Aerial View and Electronics
Left to Right:
This is the aerial view of the assembled model. The WeMos D1 mini on the top-left is the heart of the model . The WeMos runs the Micro Web Server application that I can access via my cell phone or tablet to control the tiny door on the model.
The Servo motor on the bottom-right is powered by a separate 9V battery and moves the door to the open or closed position based on the user command received by the Web Server over local WiFi.
An LM2596 DC-to-DC Adjustable Step-down voltage regulator, or Buck converter has been used to step down the 9V input voltage from the battery into the 5V required by the SG-90 Servo.
A small switch soldered in line with the power wire from the battery turns the power to the voltage regulator on or off. When not in use, this switch is in the off position.
The core electronics have been set up on small bread board mounted on to the top-side Cross Brace of the model.
Step 3: The Servo Drive System
Left to Right:
The little SG-90 Servo motor is mounted on the Servo Mount Post . One of the screws that holds the servo mounting bracket to the mount post also holds up the Buck converter.
The Servo horn is attached to the Servo on one end, and the drive shaft on the other end.
A double-ended horn locks into both the slots of the Drive Lock Ring to better transmit power from the Servo to the door. This horn also comes as part of the SG-90 package.
The door is mounted between two slotted flanges on either end . One of them is screwed on to the drive pin driven by the Servo motor.
5. Why the Relay?
The little SG-90 servo does not require a relay and can be driven directly by the WeMos D1 mini. But the real garage door opener is triggered by the WeMos via a Relay!
Therefore, I’ve opted to wire the servo power line from the output of the Buck converter through a Relay. The WeMos turns the power on to the servo before moving the door and then cuts power soon after the door moves to the required position. This arrangement is similar to how the real garage door is wired to the IoT Server.
Step 4: The Desktop Model
Here’s a shot of the model with the garage door swiveled to the Open position.
The two side walls of the model have been held on to the base with four L-angled brackets as shown . The separation distance between the inside faces of the walls is 115 mm.
The entire model is mounted on to three pieces of scrap wood. These sections of wood couldn’t be glued together as I did not have clamps wide enough. Therefore, three 3D printed brackets (in Black, third image) were used to hold the wood in formation and screwed in place to these brackets.
However, this is purely an optional arrangement because the base you might be using may be one solid piece of wood.
Step 5: Smart System - Sensing Door Position in Real Time
From Left to Right:
A KY-025 Reed Switch Module is mounted above the door senses the door position in real time. A magnet mounted on the door moves closer or away from the switch. The switch is triggered by the magnetic field and sends this information to the Web Server.
This second image shows the KY-025 triggered by the little Black magnet on the door in the closed position . Both on-board LEDs are On indicating that the switch was activated when the door closed.
In contrast, the KY-025 is deactivated when the door swings to the open position in the third image.
To see this in action, check out this video short on my channel!
Ignoring Repeat User Requests
The KY-025 switch helps in making the door control a bit more than a simple open/close affair. The server uses the feedback from the switch to take no action if the user repeats a request.
In this example, the close button is hit twice, but the door is already closed as shown by the first browser screen shot.
When the Close button is hit the second time, the user gets an informational message stating that no action was taken by the Server because the request was repeated. Consequently, the door remains closed.
A similar thing happens when the Open button is hit twice.
Step 6: Regulating Access to the IoT Server
The IoT Server maintains a White list of device IPs that are allowed access to the IoT Web Server.
This way, when users outside the household get on to local WiFi they're by default not on the White list and therefore will not have access to the IoT Web Server. Therefore, all users not on the White list will get an Unauthorized page if they try to access the IoT Web Server.
This is one line of defense applied to the system because it does not control a table lamp, but a Garage Door that opens up your house to the world!
Step 7: The Onsite Installation Tour
In the order of images posted in this step:
A 4-foot view of the actual set up in my garage. The forward right of the image shows the WeMos D1 mini and the Relay mounted in proximity of the Craftsman Garage Door Opener. The wires from the mini are routed across the ceiling to the KY-025 positioned atop the garage door on the far-left very close to a magnet. The magnet is stuck to the door with double-sided tape and rolls in and out from under the KY-025 turning it ON or OFF in the process.
A closeup of the WeMos D1 and relay installation . The rubber strap is there to hold a few wires down and as an added measure to hold the WeMos down in its case.
A pre-installation closeup of how the 3D printed Ceiling Bracket and the WeMos case come together. The Relay is mounted to the Ceiling Bracket and is wired to the mini. Note that the male headers pins are accessible on the WeMos board even after it’s closed inside the case.
A close up of the KY-025 set up. The donut magnet is taped on to the top face of the garage door with double-sided tape. Note that the Reed switch hovers on top of the magnet and stays clear of the garage door so that the door does not crash into the KY-025 Reed switch and damage it or its mount!
5. and 6.
The Reed switch is passive as the door remains closed most of the time.
The switch is activated when the door is open. As seen, the magnet on the door is in close proximity to the switch.
Arrows in the design sketch of the KY-025 Reed mount indicate various ways in which the Reed switch could be adjusted to be in proximity of the magnet when the door rolls up to the ceiling and comes to a stop. Based on the location, a longer arm (in Blue) could be used to extend the Reed switch closer to the magnet.
Step 8: Get the Book!
This entire project is detailed in my Book titled Give Yourself IoT Super Powers available in the Amazon Kindle Store.
In this book I discuss how this project has been put together by assembling small units of functionality (requiring the most fundamental knowledge) into a larger application. The code covered in this book can be downloaded along with the parts required to put the Desktop model together.
In addition, there is a document that illustrates the steps required to assemble the Desktop model.
The last Chapter of this book will explore more ideas and enhancements that readers can take on to better fine tune their project and make it more advanced.
I hope you have fun reading my book and building the project!