Close

Setting Up Node Red

A project log for Clouds Happen

This is a versatile system of hardware and software to evaluate outside weather conditions vs inside weather conditions.

brenda-armourBrenda Armour 05/22/2016 at 18:330 Comments

The hardware I used includes the Raspberry Pi B+ and Texas Instruments Sensor Tag (CC2650). I have a Wi-Pi wireless dongle and IOGEAR blue tooth dongle. I was very happy at the end of the day (okay many days) and finished the build with a nice dashboard from Freeboard.IO.

There are plenty of Tutorials on how to flash an image for the Raspberry Pi. I'm using Jessie that includes Node Red for the project. I ran into issues with version control when trying to install the Sensor Tag Node and had to remove the older version of Node Red. I also had some weird issues with my screen going Blue when booting up Jessie to the Screen. I switched to another SD card (32GB) and the issue was resolved.

Sensor Tag

This is a cool device and includes 10 onboard sensors. The setup is simple. You pull the plastic tab to activate the sensors and download eitherthe free Android or Iphone App to visualize the data. I brought the sensor tag for other projects and was interested in the tag's ability to switch to a mode that is compatible with Zigbee and build a mesh network to send sensor data over a long distance using two Bee's. This is another project . The Tag has a battery life of a year. I also brought the development kit for an additional $15.00.

Raspberry Pi B+

This Pi has 4 USB ports so there was room for a Wifi dongle, Blue Tooth dongle and the Dongle for my wireless keyboard and mouse. Jessie has a nice feature to scan wireless connections and allow you to connect to one with the password. Once I had the wireless connection I wanted to setup the Bluetooth dongle. It is always a good idea to perform an update and upgrade to ensure your Pi is up to date:

sudo apt-get update 

sudo apt-get upgrade 

sudo apt-get install bluetooth bluez blueman 

Note: If you install the most uptodate version of Jessie. Then BlueTooth should be installed in the most recent version.

Now I want to test to ensure I can connect to the sensor tag.

sudo hcitoollescan 

Now I'm connected to the Sensor Tag I moved on to using Node-Red

Node-Red

This is already available in Jessie and includes a number of "Nodes" that can be dragged and dropped on a canvas and wired together. It was developed by IBM and very easy to use. I wanted to install the Sensor Tag node but received multiple errors that Node-Red was not the most recent version. After some troubleshooting , I had to remove the older version and reinstall the most recent version of Node-Red. After several attempts to get everything up and running these are the steps that worked.

Step 1: Remove the preinstalled version of Node Red

sudo apt-get remove nodered 

sudo apt-get remove nodejsnodejs-legacy 

sudo apt-get remove npm   # if you installed npm 

Step 2: Install Node.js on Raspberry Pi B+ (will also work on Pi (version 1, Pi Zero , Pi A+ but not Pi 2)

wget http://node-arm.herokuapp.com/node_archive_armhf.deb 

sudo dpkg -i node_archive_armhf.deb 

sudo apt-get install build-essential python-rpi.gpio 

Step 3: Install Node-red

sudo npm cache clean 
sudo npm install -g --unsafe-perm  node-red 

Step 4: Code to install Additional Nodes and check version

sudo apt-get install npm 
sudo npm install -g npm@2.x 

hash –r 

Check for version control ! Your sensor tag will not install if you are not upgraded

Make sure you are in:

cd ~/.node-red 

node –v 

My version shows V0.12.6

npm –v 

My version show 2.15.6

So if you get through all of this with warnings but not errors there is a good chance Node Red will run. So now I want to install additional nodes. But you may have to tell Raspberry Pi to show hidden files. Go to

cd ~/.node-red 

Step 5: Install that elusive SensorTag node. Oh I fought with this install. But after completing the above steps above it worked liked a charm.

npm i node-red-node-sensortag

Step 6: Install Freeboard for a Dashboard. I had no issues with this install.

npm install node-red-contrib-freeboard 

Step 7 : Install Open Weather Map. This will install two nodes. Two nodes that get the weather report and forecast from OpenWeatherMap. An API key is required to use these nodes. To obtain an API key go to OpenWeatherMap.You must register. Copy the key to Notepad and then copy the key to the node info. I entered my current latitude and longitude to get a current location where I live.

npm install node-red-node-openweathermap 

Done ! Well maybe. Where is the script to run node red ? Everything has changed and I found the script under :

cd \usr\bin 

Now run:

node-red-pi 

Once you have it started you can view it at http://Your-Pi-IP:1880 .

Discussions