Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

Oversampled array.png

IIoT - Push oversampled arrays to InfluxDB

MauroRiboniMX
Contributor
Disclaimer

The goal is to use ctrlX CORE or a ctrlX OS installation in order to store and monitor High Frequency signals for condition monitoring. Let's go. 

Oversample ArrayOversample Array

Requirements:
  • ctrlX CORE - x3 or x7 or a ctrlX OS installation
  • PLC app
  • Node-Red just 
  • PLC app + ctrlX WORKS
  • Jupyter app (coming soon)
STEP0: install Node-RED, InfluxDB, PLC app, and Jupyter (to come)

The first goal is to install the needed apps and configure them. For Node-RED and InfluxDB apps we can follw this link: Setup influxDB and node-red. 
Once we have anything installed we need to keep the influxDB token and write a simple plc Progam.

STEP1: setup the PLC project

We need to simulate the acquisition of an HighFrequency signal. We can think it like a simple function like y=Kt+White Noise, where t is an index of an array that contains the value of the function. We need to think that we need the following process:

  1. Create the vector and sample the generated value.
  2. Read the data with some high level language and format it accordingly for InfluxDB using a trigger
  3. Once the load is stored then reset the signal and repeat. 

This simple functionality can be achieved using a simple PLC program. 

PLC codePLC code

STEP2: get the data, format it correctly and ship it in influxDB - Node-RED version

To correctly load an array we need to create a string that contains the measurement name, the field and the value and the time. The string is then repeated with "\n" as ending character. It is also important to Set the right precision/ authorization and database details.

Node-RED functionNode-RED function

Once the packet is ready we need to send a POST request that contains all the details. Node-RED postNode-RED post

The code can be shaped so that any time the PLC apps has a new array recorded Node-RED can then read and ship it. Can be also convenient to visualize directly in node-red the shape and maybe apply some downsampling if needed. The full code is attached.Node-RED codeNode-RED code

 

Node-Red graphNode-Red graph

Anyway, the data will be visible in influxDB and IOT Dashboard as well!InfluxDB outputInfluxDB output

STEP2: get the data, format it correctly and ship it in influxDB - python version

The code in python is similar. Can be used externally or inside ctrlX CORE with a custom app or with Jupyter APP. Use Jupyter notebook to test this code! 

Python CodePython Code

Ciao 🙂

MauroRiboniMX
MauroRiboniMX
Hello, I am Mauro a ctrlX DEVELOPR at night and a̶n̶ A̶p̶p̶l̶i̶c̶a̶t̶i̶o̶n̶ E̶n̶g̶i̶n̶e̶e̶r̶ Product Manager during the day 😎 . Ask me anything about ctrlX AUTOMATION but my best topics are IoT, AI, SDK and Communication!
1 Comment
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist