II. InfluxDB & Node-RED & MQTT Tutorial: Sending data to InfluxDB

Store data from Node-RED to InfluxDB with a Raspberry PLC
September 23, 2021 by
II. InfluxDB & Node-RED & MQTT Tutorial: Sending data to InfluxDB
Boot & Work Corp. S.L., Fernandez Queralt Martinez

Introduction

As InfluxDB is an open-source time series database (TSDB), it is designed so that it is easy to store and access information. A good database is crucial to any company or organization. This is because the database stores all the pertinent details about what the company wants to store, like salaries, transactional records or any valuable information.

In this post, we will continue this post  Go >>> and we will learn how to send data to the database, only installing an InfluxDB node on Node-RED.

Related Links


How to install
Mosquitto

Read >>>


How to connect Raspberry PLC to WiFi

Read >>>


Raspberry PLC configurable

See >>>


MQTT & Raspberry PLC & Node-RED

Read >>>


How to find your perfect industrial PLC

Read >>>


Raspberry Pi based Panel PC products

See >>>


Node-red-contrib-influxdb

Now, we are going to  open Node-RED >>>  and install node-red-contrib-influxdb nodes from InfluxDB.

1. So, go to the Menu > Manage Palette > Install > Type: node-red-contrib-influxdb and click on Install.

2. Then, go to the nodes sections, filter your search by influx, and drop an Influx out node to the flow.

3. Then configure your Influx out node with a server, organisation, bucket and measurement. We did it like this:

[{"id":"0e17644c4b3628b4","type":"influxdb out","z":"b716fdc48724e610","influxdb":"bc4ab5cb2a050021","name":"","measurement":"test","precision":"","retentionPolicy":"","database":"","retentionPolicyV18Flux":"","org":"Industrial Shields","bucket":"test","x":340,"y":100,"wires":[]},{"id":"bc4ab5cb2a050021","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"test","usetls":true,"tls":"d50d0c9f.31e858","influxdbVersion":"2.0","url":"http://localhost:8086","rejectUnauthorized":false,"credentials":{}},{"id":"d50d0c9f.31e858","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]

Note: In order to import this json file, go to Node-RED > Menu > Import > Paste this JSON file, and click on Import.

4. Finally, add an inject node with a number to run this example.

Node-red-contrib-influxdb - II. InfluxDB & Node-RED & MQTT Tutorial: Sending data to InfluxDB

Get data form InfluxDB

Now, deploy your application and click on the button from the inject node to send the data to the database.

So, let's see what we got in the database now!

Get data form InfluxDB - II. InfluxDB & Node-RED & MQTT Tutorial: Sending data to InfluxDB

As you can see, we have stored the information in InfluxDB! But, what if the information would not come from an inject node, but from MQTT data?


Want to learn how?

Continue >>>

​Search in our Blog

II. InfluxDB & Node-RED & MQTT Tutorial: Sending data to InfluxDB
Boot & Work Corp. S.L., Fernandez Queralt Martinez September 23, 2021
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>