Toggle your home's garage door through the internet really has no practical value since we all have remotes anyway. My dad leaves his garage door open every so often, and I started off making a device that can detect if it's open and send an alert. Sending an e-mail through the ESP8266 proved difficult, as well as finding an SMTP server that would accept an email request from a random IP.
Using the HC-SR04 sonic sensor, you can measure the distance to an object by sound (at 40kHz) and is accurate from 2cm to 4 m (as stated). I used the sonic sensor to detect the garage door, and placed the device about half a foot off the garage floor.
Instead of an email/text alert, I set up an Auto-close feature, where if it detects the door open for 30 mins (can be changed) it will automatically close. This timer resets when it sees the door is closed already, so all manual functions still work.
The device connects to your home's Wi-Fi and contains its own web server that you can connect to through LAN, or through the internet if port forwarded. You interface with this device through the internet page only, so it can be a standalone item by your garage door. (No computer connection required)What it's good for:
- Checking your garage after you've left
- Automatically closing if you're prone to forgetting
- Part of a larger home automation system
- Make a case for rain protection and ease of transporting
- Making a user friendly GUI (maybe through an app like Blynk, but I really like the self-contained quality of the device)
- Set up an alert somehow, email is best if it doesn't require the use of an online server, but I am open to how to implement that
You don't want one false measurement when your door is open (like walking in front of the sensor to make it think your garage is closed so it resets the 30 minute timer. To reset it requires 6 (can be changed) measurements but not necessary in order. A variable is increased by 1 if it reads the door closed, and decreased (with a minimum of 0) if it sees it open. This way, when it gets to 6, the 30 minute timer is reset.Example
Garage is closed
- Check 1 (0 sec) - Correct measurement of 23 cm -Closed (1 out of 6 to reset)
- Check 2 (10 sec) - Correct measurement of 23 cm -Closed (2 out of 6)
- Check 3 (20 sec) - Correct measurement of 23 cm -Closed (3 out of 6)
- Check 4 (30 sec) - Erroneous measurement of 1548cm -Open (2 out of 6)
- Check 5 (40 sec) - Correct measurement of 23 cm -Closed (3 out of 6)
- Check 6 (50 sec) - Correct measurement of 23 cm -Closed (4 out of 6)
- Check 7 (60 sec) - Correct measurement of 23 cm -Closed (5 out of 6)
- Check 8 (70 sec) - Correct measurement of 23 cm -Closed (6 out of 6) resets timer to 0