Ultimate IoT streaming Demo with Node-Red and TigerGraph

Mohamed Zrouga
5 min readFeb 11, 2021

According to Gartner IoT market size will rise to 5.3 billion by 2025. And given the variety of devices out there, getting started with IoT can appear daunting. Setting up communication with or between these devices is often non-trivial. Further challenges arise if you want to integrate machine learning! Solutions need to pull together different device APIs, services, and sometimes protocols.

Node-RED and TigerGraph combined can store data easily analyze them and bring a whole new level of Machine Learning to IoT in an easy, No-code way. Today’s topic is the TigerGraph storage Node connector and its creative approach in storing data, and enabling the Internet of Things with TigerGraph’s ML toolkit power to do Customer 360, Tweets sentiment analysis, etc.

TL;DR .. Node Red + TigerGraph : empowers you with the no-code solution experiment at its best. Just link’em !

Node-Red: A visual tool for wiring everything

Node-RED is a programming tool created by two IBM Engineers, as a visual tool for wiring together hardware devices, APIs, and online services without writing code.

The project has recently become popular as it is the quickest way to prototype web services inside a business during a hackathon or an experiment. Developers who attach it to IoT devices enjoy it very well.

Node-RED runs on local workstations, the cloud, and edge devices. It has become an ideal tool for the Raspberry Pi and other low-cost hardware.

The Node-RED runtime is lightweight and built on top of Node.js. It takes full advantage of Node.js’ event-driven, non-blocking I/O model. There is also the added benefit of tapping into the most used programming language — JavaScript!

With all the Node-RED community resources and vast NPM ecosystem, you can create IoT flows in a user-friendly manner.

TigerGraph: A graph database to link Data

A graph database is a data management system software. The building blocks are vertices and edges. To put it in a more familiar context, a relational database is also a data management software in which the building blocks are tables. Both require loading data into the software and using a query language or APIs to access the data.

TigerGraph is known as the fastest native graph database. It provides you with its unique query language (GSQL) and a GraphStudio which is a streamlined graphical user interface built on top of the database engine.

It offers an easy-to-use, no-code platform that allows anyone, regardless of their experience in database technologies, to learn about graphs.

Pre-requirements :

How to Install

To install node-red you can use npm, docker, or package manager from your distro.

$ npm install -g --unsafe-perm node-red

after that, you should install the TigerGraph storage node

$ npm install -g  node-red-node-tigergraph

and then run node-red instance:

$ node-red

The node-red will be at this address by default “http://127.0.0.1:1880”

TigerGraph Node In Action:

To add the TigerGraph Node to your flow, go to the left side panel scroll down to the storage section :

Side Panel Storage Section

Grab the TigerGraph node to the flow and double click on it then click the pen next to “Add new TigerGraphDatabse” :

Configure the database

Add a TigerGraph Connection :

Fill the form according to your configuration you will need a server, port (default:9000), the user (default:tigergraph), the password (default:tigergraph), the graph name, and a secret. Once done with that Click Add.

Now click done.

In our first demo (stay tuned for Part2 and Part3 !), we will be subscribing to three MQTT Brokers and loading all the messages to the database with no coding off course.

Hive MQ public broker :

Subscribing to all testtopic subtopics

Mosquitto public broker:

Subscribing to all mosquito topics

We will be subscribing to all topics (#) on the mosquitto broker and all testtopic sub topics (/testtopic/#) on the HiveMQ broker

Before the deployment, you can see that the node displays “not yet connected”

TigerGraph Database Not connected, double-check config

Once deployed and if you’ve successfully provided all the credentials for your TigerGraph instance, the node displays “OK” as follows :

TigerGraph Database connected

Schema Installation :

to initialize the schema for this ioT demo we have prepared this DDL Script written in python.

download the script from here

$wget https://raw.githubusercontent.com/zrougamed/medium/main/iot.py

and then execute it

$ pip install pyTigerGraphBeta
$ python3 ioT.py <your_solutiontag>.i.tgcloud.io tigergraph password

What’s Next?

  • Build a dashboard ( Article Soon to be published )
  • Build a Customer 360 using Node-Red and TigerGraph ( Article Soon to be published )

Any question or inquiry regarding this blog, come talk to the community.

Stay tuned and see you on our community discord server

--

--