If everything is working from Part 1 you should have a working Gateway that communicates wirelessly to your first Node. We will now work through how to connect this Node to your garage door. Part 1 is difficult so if everything is working congratulations. It will get easier from here on.
Before we move on, be sure to have the following hardware ready. You should have these components from Part 1.
You will need to make sure you have properly connected hardware before you continue. This tutorial assumes you have a NODii Extender soldered correctly to your NODii 2. We also assume you have purchased a NODii Relay Switch separately or with our NODii 2 Relay Switch Kit.
Now plug in your NODii Relay Switch into the USB port of the NODii Extender.
We will now test this relay switch to make sure everything is working properly. You can download the relay test code from our NODii Github account or go here and copy and paste the code into a new sketch. Before you upload this sketch to your NODii Relay Switch make sure it’s connected to the computer using your USB cable. Now upload this sketch to your NODii Relay Node.
If everything is working the relay should start to make a clicking sound every 10 seconds. This is a good sign. It means your switch is working. The code is pretty straight forward – turning ON (ie’ HIGH) for 10 seconds and turning OFF (ie; LOW) for 10 seconds before starting all over again.
We will now install the program that will run on your Gateway to talk to your NODii Relay Switch.
We now move on to programming the Relay Node.
Congratulations. I have a Relay Switch which is operating with your Gateway. The last part is to wire up the Relay node to your garage door.
We will now begin the final installation process for wiring up and install your Smart Garage Door Opener. As noted at the beginning of this tutorial series. You need to have a wired garage door button for this to work.
IMPORTANT: Turn off the power to your garage door opener.
Next – remove your garage door button. The button looks like this.
Now unscrew the 2 wires that are connected to the underside of your garage door.
Take these 2 wires and insert them into the Terminal Block (blue connector) of your NODii Relay Switch. If you have 3 screw holes – connect one wire to the middle terminal and one wire to the N.O. terminal. Once you are done, it should look like this.
Now attach a battery source to your NODii Relay node. There are 2 battery options on the backside. We are using a Li-Po battery given the NODii includes a Li-Po battery recharger onboard.
Now attached the Relay Switch to your Relay NODii with the attached battery. Now plug in your Gateway to your computer. Your garage door should start to open and close automatically. Congratulations! You now have a smart garage door opener that is being controlled by a software program that you can change and enhance.
Now go make something.
]]>
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.
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.
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.
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.
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.
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.
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.
Tools > Serial Monitor
You should see the following in the pop-up window.
Next we will install the Node sketch.
Tools > Serial Monitor
You should see the following in the pop-up window.
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.
]]>In future tutorials we will take each example and work through what is needed to turn your average garage into a smart garage.
]]>Most Arduino and Arduino compatible boards will have a 2×3 pin ICSP header on them such as the 6 pin connector on the NODii 2.
Some may even have more than one of these connections depending on the number of MCUs that need to be programmed. The signals running through these pins are super important if you need to reflash your bootloader on your board. However for most makers programming their Arduino through a simple USB cable is usually all that is needed.
But for anyone else that needs to work with the low-level bootloader you need to purchase an AVR Programmer. These programmers come with a cable that connects directly to the ICSP pins on your Arduino board so the exact pin assignments is not so important, but if you cannot use the ICSP pin header for programming or your version of the board does not have these PINs – this table will come in very handle.
| ICSP | ATMega32u4 (SPI) | ATMega328 (SPI) |
| Pin 1 / MISO | D14 | D12 |
| Pin 2 / VCC | VCC | VCC |
| Pin 3 / SCK | D15 | D13 |
| Pin 4 / MOSI | D16 | D11 |
| Pin 5 / RESET | RESET | RESET |
| Pin 6 / GND | GND | GND |
Now go make something.
]]>
Once you have your first component on your schematic it is time to wire up your whole circuit. Start by searching for a resistor. Again go to the parts library.
and type in ‘resistor’ in the Search field at the bottom of the popup window. You will notice a huge number of available parts. Please find a 1206 part. 0402, 0603, 0805, 1206 reference the size of SMD components and applies to resistors, capacitors and more.
Click OK and now place the resistor symbol on your schematic. You can rotate this component just by clicking your RIGHT mouse button.
Next we will find an LED. Again there are a huge number of options for an LED in the library. To simplify things type into the Search field ‘1206’ instead of ‘led’. Find a part that says LED1206 from the list of options. If you are using Eagle CAD version 7.6 you should see a SparkFun-LED library. Pick the LED1206 component and place this into your schematic. Your schematic should look something like this.
We will now wire up this circuit which will complete your schematic. Now click on the WIRE BUTTON on the left menu bar.
We will now connect all of these components. This part is a little tricky. Click on the right end of the resistor. This will create a light green wire that you can now pull to your next component.
Please click on the anode side (top) of the LED component. Notice how the wire turns from a light green color to a dark green color. Once you have done this you should see the diagram above.
You will also notice that as you drag around your mouse the EAGLE CAD software is expecting you to connect the next component. We want to stop this by clicking on the round STOP BUTTON at the top of the schematic window.
We will now wire up the rest of this circuit. Again, click the WIRE BUTTON on the left side of the schematic window and click on the bottom side of the LED component and then click on the bottom of the BATTERY component. You will notice during this process that the wire lines do not allows follow a way we want it to go. Try clicking the RIGHT mouse button. This changes the orientation of how the wire is being drawn by the software.
To help learn the user controls, please create a U shape connection that connects the cathode side (bottom) of the LED to the negative terminal (bottom) of the battery. While in the WIRE mode, you will need to click on a location underneath the battery terminal like the diagram below before you connect to the negative terminal of the BATTERY component.
Because the user interface can be difficult to use you will make mistakes. You can always UNDO and start over by going to Edit -> Undo.
Now connect up the positive terminal (top) of the battery to the resistor and we are done. Again. You need to click the STOP BUTTON and then the WIRE BUTTON each time you start connecting a wire from a new location. This is what you should see.
Congratulations! You’ve just finished wiring up your first PCB schematic. Now go make something.
]]>
You can think of PCBs as the framing inside of a house. Without the frame, you would not have a place to put your furniture. In electronics we use PCBs to connect together various components like the screen of a laptop to everything else. The PCB is what glues all these components together. Therefore you can imagine if you wanted to change the kitchen or the bathroom – you may need to change the framing of your house. Similar when you change components used in a PCB – your PCB may need to change.
Each unique piece of hardware like a smartphone requires usually without exception unique PCB which makes learning how to design one all the more important. There are a ton of amazing resources on the web and we will not cover every detail in this tutorial. Instead we will focus on the mechanics of designing a PCB in this tutorial series.
Step 1 – Pick a PCB design tool.
Today, the most popular FREE PCB design tool is called EAGLE PCB. Go here to download a copy. Certainly there are many other tools in the marketplace, including those that are online requiring no downloads – each with unique strengths – but like it or not, EAGLE is used extensively in the maker community and so this is the tool we will teach.
WARNING. This is a tool that is difficult to learn. Even readers that understand how to work with CAD software will have a step hill to climb. But for all those that aspire to maker-dom please follow along. We will design a simple LED PCB.
Step 2 – Make a Schematic
What is a schematic? It is the blueprint of our PCB. Without a blueprint, it is hard to make a house. Without a schematic, it is impossible to make a PCB. So let’s get started. Once you have installed Eagle, open up the software and you should see this.
Let’s start by creating a new schematic.
File -> New -> Schematic
You will be greeted by an uninviting blank, white screen. Next click on the ADD icon as indicated below.
You will be greeted withe the following popup window.
Type in the Search field at the bottom of this window ‘battery’ and pick from the selection AB9V or anything that resembles a normal battery you normally use. Click OK. The ADD popup window will now disappear and you will be staring at that white, blank window. Your mouse has turned into the image of a battery (this is a schematic symbol for your battery and not a real picture of one). Click on the schematic screen multiple times and you will notice many copies of this battery symbol being placed all over the schematic window. You can also RIGHT CLICK to turn your battery symbol 90 degrees.
We won’t need all those batteries so UNDO until you only have 1 on your schematic. Congratulations. You have placed your first component on your way to creating your first PCB. In the next part of our How To Make A PCB tutorial series we will connect up the rest of this schematic.
Now go make something.
]]>
Be sure to complete the following How to connect to the ESP8266 using a FTDI adapter before beginning this article.In order to connect your ESP8266 to your W-Fi router or AP you can follow these simple steps.
To do this you need to issue the command AT+CWJAP=”your_network_SSID”,”Password”. Use your network SSID and password that is used for your network. The ESP8266 will return OK if successful.
To further check if your ESP8266 radio has successfully made a connection, type AT+CIFSR in your serial monitor to get the IP address your router issued to the radio module. You should see something like the following if you have successfully connected to your router!
]]>
Once you have one the next step is to connect to it. It’s not breadboard friendly and so you’ll need jumper wires to hook things up. You will also need either an Arduino or FTDI adapter. This tutorial is about connecting the ESP8266 through a FTDI adapter. I had tried connecting it with a standard Arduino Uno but everything I read suggested the need for another adapter with a serial interface to communicate with it. I’m sure there is a simple way to hook up an Arduino Uno so if someone wants to let me know, I’ll be happy to try it out.
I had a simple FTDI Basic 5V adapter from Sparkfun so took a chance this could work. The ESP8266 is a 3.3V device so the key is to convert the input power going to the Wi-Fi module to 3.3V. It is also wise to make sure your inputs driving the GPIO pins are also 3.3V. This is not the case with Arduino Uno which outputs 5V signals from its IO pins (another reason to use this FTDI adapter). To be on the safe side you should either level shift your GPIO input signals to 3.3V or use a FTDI 3.3V adapter as a source.
Take a look at the diagram to see how to hookup the power lines and Tx/Rx pins. Note that in addition to power and IO pins, you need to drive the CH-PD pin HIGH for you to talk to the Wi-Fi module through a serial monitor.
Once this is wired up, connect the USB cable between the FTDI adapter and your PC or MAC and open up your favorite serial monitor app. I just use the Arduino IDE for this which is free and I’m sure already installed on your computer if you are a maker.
Open up the Tools -> Serial Monitor and make sure the settings are fixed to Both NL & CR and 9600 baud at the bottom of the popup window.
Type AT within the input window at the top and you should see OK! Success!
To configure your ESP8266 you will need to learn a few AT commands which is the way you communicate with the module. Here is a set of AT commands.
]]>Once you have installed Node.js open up your text editor and create a file called server.js and fill it with the following code:
[codeblocks name=’codeblock_0′]
That’s it! You just create a Hello world application in Node.js. But what is special about this application is that it is also a web application. To test this first execute your Node.js script by typing in the following command in a terminal.
[codeblocks name=’codeblock_1′]
Then open up a browser and type the following address.
[codeblocks name=’codeblock_2′]
You should see a web page that displays “Hello World”!
What is special about this little script is that you have created not only a little program that run in a browser (a web application) but it also the web server (HTTP server) to support this application. A web server is the engine that powers all websites on the Internet. Now you have one powering your program!
]]>