In this repository you will find various examples of Reading and writing information between Node-RED and MySQL
This respository is part of Interface MySQL with PLC via Node-RED Course published at ✅ https://codeandcompile.com/course/interface-mysql-with-plc-via-node-red
- Learn various ways to send data (standalone, array, objects) to various charts
- Read data directly from MySQL and show it on the Node-RED Chart
- Read the controller (PLC or Arduino) using Serial or MODBUS TCP/IP communication.
- Replace the simulated data with your PLC or Arduino data
In this example, you can read the single variable with timestamp from MySQL and show it on the chart as shown below:
In the above example, the values are coming from the table defined in the MySQL database.
In this example, you can read the single variable with timestamp from MySQL and show it on the chart as shown below:
In the above example, the values are coming from the table defined in the MySQL database.
The code can be modified easily to read more than two values stored in the MySQL table
The following is the format of MySQL table used for the example. The schema is included in the repository and can be used for testing.
- timestamp1: This is used for storing the datetime in 'String' format.
- timestamp2: This is used for storing the datetime in ISO format which helps to display values on the Chart easily.
- value1: Dummy value for showing it on the chart
- value2: Dummy value for showing it on the chart
Note: value1 and value2 are simulated in the project using random flow, the user can take the values from PLC or any other controller.
graph LR
A[Random/PLC values] --Write--> B[MySQL] --Read--> C[Node-RED Chart]