Hey Google, Control My Stuff!
The objective of this project is to control two garage doors that are connected via IOT. The basis of the project is built around Particle Industries’ RF WiFi evaluation board, the Photon. The Photon is controlled by a cell phone widget to open and close the door. Two-way communication to verify the door is truly shut will be added also. This inexpensive solution will feature different levels of complexity to suit multiple users’ needs.
3VDC SPST Signal Relay Z1226-ND (1 per garage door)
5V Wall Wart USB 993-1394-ND
Micro USB B cable 993-1294-ND
12pos Female Header S6100-ND Qty 2
Terminal Blocks 2 pos ED10561-ND (1 per garage door)
Terminal Blocks 3 pos ED10562-ND (1 per garage door)
Diode 1N4007-TPMSCT-ND (1 per garage door)
Reed switch 59145-030-ND (1 per garage door)
Magnet 469-1047-ND (1 per garage door)
Cable Clips RPC1111-ND (Approx 10)
Jumper Wire BKWK-3-ND
Two Conductor Cable C1356-21-50-ND
The Photon development board utilizes a 120Mhz ARM Cortex M3 microcontroller with a Broadcom Wi-Fi chip for easy connection. It only needs a 5VDC supply to provide a 3.3VDC logic level. The user interface elements and onboard regulator allow the user to start prototyping promptly while the open source design allows for immediate integration.
There are two antenna options available on the development board: internal and external. The internal is a ceramic chip antenna that is set as the default. The external option has a u.FL connector for user ease if necessary. One line of code can be used to switch between the two or select automatic mode which will opt for the antenna with the stronger signal. This project will be using an external antenna. Interfaces include Digital I/O, Analog I/O, and various communication I/O. See the diagrams for each pin and function definition.
There are two separate schematics in this document. The first one will show a setup for two garage doors with no feedback. They are powered with a 5V, 1A AC to DC wall adapter power supply with a USB Micro B output. Two 3VDC SPST signal relays will be connected to pins D7 and D5 (any digital pins are fine). When prompted, a signal will be sent to the relays to close the circuit to each garage door, commanding them to open or close. Each relay’s coil has been placed in parallel with a diode to prevent collapsing coil reverse current from damaging the board. See the schematic below.
Above is the original, functioning design. However, it was decided to add a feedback option to the design so that if no one is home, the status of the door can be verified. To achieve this, a reed switch will be placed next to the garage door in correspondence to a magnet on the door. The original thought was to use IR sensors to detect if the door was up or down. This would work, but is slightly more challenging due to voltage drop concerns and the viewing angle breadth.
Below is the final schematic with the reed switches in place. Pin numbers of the terminal blocks correlate with the pin numbers on the reed switch. These are tied to digital inputs so the status of the doors can be determined.
For Photon configuration, press and hold the Setup button on the photon until the RGB LED is blinking blue – this means it’s in listening mode. Particle recommends using the mobile app, however this did not work for us. It appears to be an issue with the WiFi connection between the phone and the Photon. We instead configured it via USB with Particle’s CLI (Command Line Interface) which worked well. The docs portion of their website is very helpful for troubleshooting. It can be found here: https://docs.particle.io/faq/particle-devices/led-troubleshooting/photon/ . To configure with USB, download and install the Windows CLI Installer . Open the command prompt by clicking the windows start menu and type “cmd” in the search box and click on Command Prompt. Once that’s open, verify your device is plugged in, type “particle setup”. Log in with your Particle account and follow the instructions to finish setting up your device. If you have already completed this step and are trying to connect it to WiFi, type “particle serial wifi” instead of particle setup. You will need the SSID (name of your network) and password if applicable. After this was done, our Photon required a firmware update with the command “particle doctor”, it then functioned as expected. The screenshot below shows a successful configuration screen.
Using IDE from the Particle website https://build.particle.io/build/new , our code, located here: https://goo.gl/eU4zNv was created. There are separate functions for the garage door control and garage door status. There is one widget for each garage door that will toggle the state of them. The code is setup to check the status of the door before engaging the relays if voice command was utilized. This way, it will only close the door if the door was already open, and vice versa. If using the widget to toggle, the door status will not be checked first.
The widget to control the garage door was created on IFTTT as an applet. Once the widget is pushed, that triggers the relay of the garage door to engage (if applicable), thus closing or opening it. To provide feedback, five different applets were set up. A widget is created to trigger a function from the program, then the function triggers what is called a particle.publish. Each different particle.publish will then trigger IFTTT to send the corresponding status via text message to the user’s cell phone.
IFTTT and Particle are integrated together in the background, making this process very user friendly. An account will need to be created on IFTTT, then you will need to download the app on your phone. Our applets are shared publicly for easy download and use. *See end of document.
All of our code is accessible for you to download with the links provided. Feel free to modify as you see fit. If you plan to modify the IFTTT portions, you will need to create new applets.
Once everything is complete, it’s time to mount all the pieces in place and put it to use. Start by attaching wires to the two position terminal block that’s wired to each relay (pin 7 for door 1, pin 5 for door 2). Then, connect those wires to the door switch screw terminals on the garage door opener. Next, you’ll need to find a place to mount the reed switch and magnet - they will need to be relatively close to each other. Measure the amount of wire needed to connect the reed switch leads to the three position terminal block on the board that is connected to pin 3 (door 1 sensor). Once that is done, plug the wall wart in to the closest outlet, giving power to the Photon. Now it’s time to test the circuit. As long as the Photon is connected to WiFi, everything should function as expected. Use the voice command or the widgets you created to successfully open and close the garage door.
Now that you can control your garage door from anywhere in the world, think of all the other possibilities. With just a few modifications and additions you can have a house full of smart objects connected to IOT.
This setup is for two garage doors, but can be done for just one.
The two-way setup with the reed switches is not necessary if a more simplified circuit is desired.
For the reed switch, white is Common (digital input), blue is normally closed (positive), black is normally open (ground).
IFTTT Applet Links: