1. Getting Started with Arduino Uno

To run NodeWire, all you need is a node, a gateway and an account on the cloud-based dashboard. You can use an Arduino board to make a node, as we will cover in a later section.

_images/arduino.jpg

There are many versions of the gateway,

  1. Arduino + Ethernet Shield
  2. Arduino + Sim800 modem
  3. ESP8266 wifi module
  4. The Python gateway which comes with the NodeWire python package.

In this section, we will use the python gateway, as it does not require any additional hardware. This gateway is compatible with all major operating systems including Windows, MacOS and Linux and can also run on single board computers such as Raspberry Pi. The python gateway expects a node to be connected to one of the serial ports of the host computer. The port is detected automatically.

The python gateway, like other gateways, also supports multiple devices when it is used with ZigBee or RS485.

The python gateway is only compatible with python 3.6 and above.

1.1. Creating an account on the NodeWire Dashboard

Visit the dashboard and create a new account. Remember your account name and password as you will need it to configure the gateway in the next step.

1.2. Installing NodeWire

Make sure python and pip are installed on your computer (or raspberry pi). Then run the following from your shell or command prompt:

$ pip install nodewire

This installs NodeWire which includes:

  1. The python module for creating NodeWire nodes
  2. A version of the NodeWire gateway (nw_gateway.py) that can run on computers and and on Raspberry Pi.
  3. A NodeWire client (nw_client.py) that can be used to test PlainTalk protocol. It allows you to connect to a NodeWire server and send and to receive Plaintalk messages
  4. A script client that allows you to interact with the NodeWire server using NodeWire script, a reactive version of Python designed for programming connected devices.

1.3. Upgrading NodeWire

If you already have a previous version of nodewire, make sure you upgrade to the latest version. You can upgrade by using:

$ pip install --upgrade nodewire

1.4. Running NodeWire

It is as simple as that. NodeWire is installed as a command you can invoke from anywhere by typing:

$ nw_gateway.py

But before you do that, lets do some configurations.

1.5. Configuring and running the gateway

Create a directory where you settings for NodeWire will be stored:

$ mkdir nodewire
$ cd nodewire

Create a text file and save it as ‘nw.cfg’ with the following content:

[user]
account_name = test@nodewire.org
password = aB01@

You should replace the account_name and password with the one you registered.

Now you can execute the gateway:

$ nw_gateway.py

Note that you must run the gateway from the same directory as the nw.cfg file

1.6. Download and install Arduino NodeWire library

Install the NodeWire Arduino library

  1. Download the library from here.
  2. Launch the Arduino IDE
  3. On the Sketch menu select ‘Include Library’ then ‘Add .ZIP Library...’
_images/addlibrary.png
  1. Browse and select the zip file you downloaded in step 1
  2. Check the File - Examples menu to see the library is correctly installed
_images/arduinolib.png

1.7. Create Arduino node

  1. Create a new Arduino sketch by selecting the ‘Uno Board’ NodeWire sample in the Examples menu. This sample converts the Arduino Uno board into a NodeWire node with 18 ports.
  2. Connect your Arduino board to your computer’s usb port and then upload the sketch to your board.
  3. Start the NodeWire gateway. If it is already running, you should terminate and start it again. You may have to wait a few minutes before restarting.

1.8. Use the NodeWire Dashboard to control the node

Log-in to the NodeWire Dashboard. using the same account you used to configure the gateway. Wait for about 10 seconds for the auto-layout to load.