Ultimate IoT streaming Demo with Node-Red and TigerGraph

by Mohamed Zrouga, Developer Advocate, TigerGraph

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-topivial. Further challenges arise if you want to integrate machine learning! Solutions need to pull together different device APIs, services, and sometimes protocols.

Image for post

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 !

Image for post

Image for post

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.

Image for post

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 :

Image for post

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

Image for post

Add a TigerGraph Connection :

Image for post

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.

Image for post

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 :

Image for post

Image for post

Mosquitto public broker:

Image for post

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”

Image for post

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

Image for post

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.

You Might Also Like