Is there a way to track if the garage door is opened or closed? Can I make a DIY garage door sensor myself? The answer to both of these questions is YES.
Before you dive in too deep into your first home automation project which is what we will be going through in this tutorial series, please understand that if you have trouble installing Wi-Fi in your home, you may have similar trouble installing a wireless home automation system.
There is no getting around that issue which is wireless technology can be hard to manage. If the Wi-Fi or LTE service in your home is less than stellar then you know what I mean.
The wireless technology used for sensor networks are typically different – using ZigBee, Z-Wave and other sub – 1 GHz frequencies. These different radio technologies trade off high throughput for longer distance and lower power requirements. This makes them more ideal for battery powered, install-it and forget-it sensors which we will be using in this tutorial. Enough of the tech talk. Let’s get to it.
NOTE: We will be attaching a device in between the garage door the the push button. If you do not have a push button wired to your garage door you may need to investigate on your own how to connect through a wireless clip on.
SYSTEM COMPONENTS
You need 3 components to setup your smart garage door opener
1 – Controller
Think of the controller as the control center for your home automation system. The controller can be a computer, mobile device like a smartphone or a Raspberry Pi with an installed home automation APP that you download and setup. If you have a computer or smartphone you already have the hardware necessary to create a Controller. You will have 1 Controller in each network. In our example we will use a computer.
- 1 Computer (Windows)
- or 1 Raspberry Pi (option)
2 – Gateway
This is what allows your Controller to talk with your connected things. The Gateway is a digital traffic cop that directs data traffic between the Controller and the rest of your connected things (nodes) – like your garage door. Assuming you have a Wi-Fi network installed at home, you already know what a gateway looks like. A gateway for a wireless sensor network is just like a Wi-Fi router. It works as a hub for all your connected sensor nodes. The Gateway in a NODii network is a NODii 2 with a radio. You can connect the Gateway to the Controller simply using a USB cable to connect a computer to a NODii. You will have 1 Gateway in each network. In our example we will use the NODii as a Gateway.
- 1 NODii 2 with 433 MHz radio
- or 1 Arduino Pro Mini + 1 nRF24L01 (option)
3 – Nodes
This is a small wireless, battery powered device which will be connected to the device which you wish to monitor and control – like your garage door. The Node(s) in a NODii network is the NODii 2 just like the Gateway but with an additional add-on board for your sensor. Our NODii Relay Kit is an example of such as bunch which includes the Node and Sensor board. The Node(s) in a sensor network are typically used to collect data. In our example – the Gateway will connect to multiple Nodes – one being your smart garage door opener. Once you have the Controller and Gateway installed, you can connect all types of Nodes to your network. You will have MANY Nodes – one for each device you wish to control and monitor. In our example we will sue the NODii as a Gateway.
- 1 NODii 2 Relay Kit
- or 1 Arduino Pro Mini + 1 nRF24L01 + 1 Relay Add-On board (option)
BASIC SOFTWARE SETUP
We can now begin installing the required software. First download and install a software package called the Arduino IDE. Arduino is an extremely popular open hardware platform and you can find more information online. You can follow the instructions on the Arduino website if this is your first time working with this software.
You can go here as well for a short how to tutorial.
Next, connect your NODii Gateway to your computer using a USB cable. We will first install Blink on the NODii to make sure it is working. We will use the Adafruit Feather ATMega32u4 settings to program the NODii. Make sure to select the following settings in the Arduino IDE user interface.
Tools > Board > Adafruit Feather ATMega32u4
Tools > Port: > Port X (X will depend on your computer)
Both of these settings are important. To test if the NODii is connected properly we will run a basic blink program called a sketch. First open the program by doing the following.
File > Examples > 01.Basics > Blink
Next click on the Upload button within the Arduino IDE to program your NODii.
If everything is connected correctly your NODii will begin to blink. Follow these same instructions for your NODii Relay Node.
DOWNLOAD SOFTWARE LIBRARIES
We will now move on to installing the Gateway and Node programs.
Begin by installing the sensor libraries by going to Sketch -> Include Library -> Manage Libraries.
Type “MySensors” into the search field and you should see the following. Click Install.
Next download the Autonomii libraries by going here. You will be brought to Autonomii’s GitHub page where we have test scripts for you to download. Click on the Clone or download button as seen here.
Download ZIP file and extract (unzip) these files. You may need to download WINZIP to extract these files.
GATEWAY TEST SKETCH INSTALLATION
Next we will install the Gateway test sketch. This is an important part of the installation and usually the hardest because with wireless technology it is not always clear why something does not work and this process will make it clear that you have 2 working NODiis that can talk to each other wirelessly.
- Open the GW32u4-433.ino sketch using your Arduino IDE.
- Make sure your NODii Gateway is plugged into your computer and that the Board and Port settings are configured properly.
- IMPORTANT: You will need to modify the CODE if you purchased a NODii using different frequencies such as 868MHz or 915MHz. How to do this is documented in the sketch.
- Now upload the GW32u4-433 sketch to your NODii gateway the same way you uploaded the Blink sketch earlier.
- Open the Serial Monitor within the Arduino IDE
-
Tools > Serial Monitor
You should see the following in the pop-up window.
NODE TEST SKETCH INSTALLATION
Next we will install the Node sketch.
- Open the ND32u4-433.ino sketch using your Arduino IDE.
- Unplug your NODii Gateway from the computer and plugin your NODii Relay Node into your computer. Make sure that the Board and Port settings are configured properly.
- IMPORTANT: You will need to modify the CODE if you purchased a NODii using different frequencies such as 868MHz or 915MHz. How to do this is documented in the sketch.
- Now upload the ND32u4-433 sketch to your NODii Relay Node the same way you uploaded the Blink sketch earlier.
- Open the Serial Monitor within the Arduino IDE
-
Tools > Serial Monitor
You should see the following in the pop-up window.
- Unplug your NODii Relay Node from your computer.
- Plug in your NODii Gateway. Please note the Port Number the computer assigns your Gateway.
- Now plug in your NODii Relay Node. Please note the Port number the computer assigns to your Node.
- Now go to Tools > Ports settings. You should see 2 Ports assigned. One for the Gateway and one for the Node.
- Select the NODii Relay Node Port Number.
- Now open the Serial Monitor by going to Tools > Serial Monitor
If everything is working you should see the following in your pop-up window. This is one of the biggest hurdles so if you see this congratulations. Both NODiis are now talking to each other.
In our next tutorial, we will go through how to install your working NODiis to your garage door.