rpiarduinomusings

Raspberry Pi, Arduino, Sensors and the data they produce

On the 8266 Road, More Tools to Learn

Moving forward into the 8266 world, I found a variety of tools that people proposed for use, but the ones that came up most were the following: MQTT, Node-RED, and the small-DB of your choice if you want to save any of the data you are sending through from your sensors (maybe to data mine, and track).

MQTT  is a light-weight message transport system that works as a client server publish / subscribe environment.  It is easy to implement, and offers a lot of capabilities.

Node-RED is  a software tool that is used to “wire” up hardware devices, and is a good tool for working on an IoT project. It is described as a browser-based flow editor, (going to have to learn what that means) and if you have a Raspberry Pi with a recent version of the OS, it is already installed.

I know that I will want to data-mine  several of the sensors I have envisioned, so I will add a mysql database to the mix, so let’s get started installing and setting these up.

Since  the Raspberry Pi’s are one of my favorites, I am using the RPi 3, and the latest version of Jessie.  Node-RED is installed, so we will install MQTT first.

I referenced this link to install and test the MQTT environment: Random Nerd Tutorials

It literally took minutes, and I will recap here.

This reference uses Mosquitto, which is an Open Source MQTT Broker. The function of the broker  in this case is to take  the message packet from the sensors and get them to a dashboard, and to record them in mysql for later data mining.

First step is to update the repository, and we need a key to do so:

wget http//:repo.mosquitto.org/debian/mosquitto-repo.gpg.key

Now we will add the key to allow us to authenticate the package:

sudo apt-key add mosquitto-repo.gpg.key

Next we need to get to the directory to update the sources list:

cd /etc/apt/sources.list.d/

Run this command: 
/etc/apt/sources.list.d $ sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

Return to the root directory:

cd

Now you can run the update:

sudo apt-get update

Finally, install the Mosquitto Broker:

sudo apt-get install mosquitto

You can test to make sure the broker is running:

mosquitto -v

You will get a feedback showing the version, and validation of the port the broker is listening on (1800 or 1883) which should be the default, if you are not already using that port.

The next post will build the sensor, and get the 8266 code updated to be able to publish to the broker with temperature and humidity data packets.

 

 

 

 

 

 

Leave a comment