IOT/M2M is easier with Node-RED!!

Node-RED – A visual tool for wiring the Internet of Things.

Node-RED is an application that allows for the simplicity of creating, and wiring hardware devices, developing API’s in a Graphical User Interface that is amazing and FUN!!

I will start out by showing how to install the Node-RED application on Mac OSX  and then give some examples of how to get this up and running.

First we will install io.js on our Mac by visiting the io.js site here.

From that link you will see this image below and you will need to select the version of io.js you need for your operating system you will be installing this on.

I will show you for a Mac OSX which is the link shown by the green arrow below:

image

The advantage of io.js I have discovered is that on Mac and Linux I don’t even have to uninstall the version you have, so far the previous version is just updated to the current version. If however you want to have multiple version you need to run NVM shown in a blog post I have done here.

Once you select the Mac Download you will need to track where you download and then install it by clicking the icon shown below:

image

This will start the installation of the io.js application installer shown below you will just need follow the screen shots below press the button shown by the green arrow.

image

image

image

On this screen you will need to select the “Install for all users of this computer” shown by the red arrow and then again press Continue shown by the green arrow.

image

image

image

This will successfully install io.js on your system to really start diving in to the cool Node-RED.

The next thing we need to do is press the Command Key shown by the Red Arrow and then hit the Space Bar shown below by the Green Arrow:

image

Next type in “terminal” in the Spotlight Search as shown by the Green Arrow and press enter to open a terminal window.

image

After the terminal window opens up type in the following:

cd /

Then we will need to make a directory so that we can download the Node-Red application in.

sudo mkdir Development

Then we need to create a Node-Red Folder in the Development Folder shown below:

cd /Development

Once in the Development folder type the following shown below:

sudo mkdir NodeRed

Then we need to download the Node-RED application here by finding the red button shown below:

image

Make sure you download the application to the folder NodeRed we created above.

From the terminal window you will need to change to the NodeRed folder by typing the following:

cd /Development/NodeRed

Next we need to unzip the Node-RED zip file with the command shown below:

unzip node-red-0.10.1.zip

Once you have the Node-RED file unzipped it will create a folder and we will need to change directory in to that folder to do the install instructions for the  (npm) Packages.

This will change to the new directory that where we will be able to complete our install of the necessary packages.

cd /node-red-0.10.1

Once we are in the folder we need to now do the Package install shown below:

sudo npm install --production

I did however have an issue with the install with this issue:  “Failed at the serialport@1.4.10” I am not sure what is happening there and will try to investigate this soon and do a update soon.

I also did an install of the mongo dB package so that it was there when needed once I start using the database nodes later.

The mongo dB package can be installed with the following command shown below:

sudo npm install mongodb

Now that this is all complete we can start using Node-RED and begin to start having fun using a “Visual tool for wiring the Internet of Things”!!

Now we need to start Node-RED by using the following command shown below:

iojs red.js

This will give you a address the server is running the “Default” is the following:

Server now running at http://127.0.0.1:1880/

Now all you have to do is go to the link in your browser window as shown below:

image

If everything goes well you should see the following in the browser window:

image

A quick tutorial with Node-RED is to drag on a “inject” node from the input section, a “debug” node from the Output node, and finally a “http request” node from the function section and align them as shown in the picture below:

image      image     image

image

Now if you click on the connection dots that are on each one you will be able to drag and visually connect each one of them to one another such as shown below:

image

Next we will double click the http request block and you will see a edit window shown below and you will need to fill the block out the same way as I have it or something very similar:

image

Next we need to double click the debug node and edit that as shown below:

image

When complete you should see the following shown below:

image

Now click on the box that is in front of the inject node shown below:

image

Once you have clicked the inject button you should see the process flow through the nodes and finally on the right hand side in the debug tab you will see the following:

image

This is a very simple example but I hope you can see the complete power that is able to be developed. This is really powerful and amazingly simple development visually!!

I hope you all enjoyed this blog post and remember to please follow my blog @ http://allangagnon.nettryx.net.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: