Introduction: Garage Door Monitor
This IoT project is designed to create a useful device and also a framework for other devices.
Why do you want this?
- Does your family ever leave the garage door open?
- Do you want to create something interesting and learn about IoT devices?
- Capturing data is always interesting.
So, here's an overview of how this was created. Additional details can be found at:
- www.heath-solutions.com (Blog about this stuff)
http://www.thingiverse.com/thing:1462892 (STL Files)
- https://github.com/Peterh226/GarageDoorMonitor
- Solidworks CAD files
- Source Code for NodeMCU firmware
- Various other documents that might help
Step 1: What You Will Learn From This Project
This IoT project is designed to create a useful device and also a framework for other devices.
There are several disciplines involved to make this work:
Mechanical
- Box to hold completed circuit
- Brackets to mount magnetic reed switches
- Test fixture for benchtop test and debug
Electrical
- Power Supply
- NodeMCU Sensor, LED’s, Relay
IOT
- Connect to persistent data storage
- Notifications
- Update parameters of firmware
Software/Firmware
- Develop code for NodeMCU using Arduino IDE
Step 2: What It Does
This project uses the NodeMCU module. It has an ESP8266-12 as well as power and communications for programming built in. This saves a lot of hassle and is still very cheap.
Input:
- Magnetic reed switches located on the garage door rails to monitor door open and closed. The Magnet is on the door.
Output:
- Communicate with Thinger.IO to send when the door opened, closed, auto-closed, or the module rebooted
- Uses IFTTT to update a Google Sheet when the status of the door changes.
- Uses IFTTT to send a notification on a reboot or if the door auto-closed (letting me know someone forgot)
Step 3: Electrical Circuit
The circuit is pretty simple, but getting the right things to all work is educational.
- LED's to indicate status and provide verification when testing.
- Relay to activate the garage door.
- Connectors to the real world.
- Mounted all on a perfboard and tested before installation in the garage.
- Has been running for over 3 months with no problems (V1.0)
Step 4: NodeMCU (ESP8266) Firmware and Testing
The Firmware is made a lot easier by using the NodeMCU and Arduino IDE.
- Get the Thinger.IO library and set up the device and other stuff here https:\\thinger.io
- Set the network info and thinger.io parmaters in the code
- You'll need to connect at least the switches to see much happen
- There is a lot of information that comes to the Serial Monitor to help you figure out what is going on
- Create a way to easily simulate the door going through the motions, Open, Closed, and Operating.
- See blog post for discussion of state transitions
- You can power all but the Relay from the USB if you have a pretty good source. There is an LED that indicates the Relay is being activated so you don't really need the relay for testing.
- The Heartbeat just helps the system to let you know it is running and also to reduce the frequency of communications. The 5 second check interval seems to work fine.
Attachments
Step 5: Simple 5V Power Supply
The NodeMCU can step the power down from 5v to the 3.3v needed by the ESP8266. This 5V also powers the relay.
A simple USB block is a cheap and easy source.
In this case, a 2 conductor wire was run from the Power Supply board to the circuit board. You can use a USB cable of course.
Step 6: Design and 3D Print the Mechanical Parts
All of the mechanical parts were designed with Solidworks and printed on a SeeMeCNC Rostock Max V2.
The door open bracket clips onto the door rail.
The door closed bracket clamps onto the brackets that hold the door spring and front rails to the wall.
The Circuit box has holes for LED's and the sensor wires to feed through. It is sized so you can plug in the USB cable as it is mounted for update (or just take of the top and swap NodeMCU modules)
STL files are in http://www.thingiverse.com/thing:1462892
Step 7: Records and Information
There are several places where you can see how this is working.
- Thinger.IO dashboard
- Google Sheet
- IFTTT logs