
CHemminger (Customer) asked a question.
Data logging
I am currently programming a production monitor system using the Click PLC in each machine and then an EA9-RHMI that can be accessed by supervisors to tell when machines are up and down and also a simple counter in each. Management wants to be able to log this data. I have found how to connect to one PLC and log the data, but I have multiple PLCs that I need to connect to and log the data. I know I have all the information there just can't figure out how to get it.
Hi @CHemminger (Customer)
I would use Node-RED and store the information in a SQL database. This way multiple people can access the data. Node-RED has a dashboard that can display information (HMI) through the browser. This can be on a computer, tablet, or phone. Anything that has access to a browser.
This series will discuss how this is all accomplished.
https://accautomation.ca/series/node-red-iot-enabling-software/
Let me know if you have any questions.
Regards,
Garry
https://accautomation.ca/
Here is a specific post that will show you how to use Node-RED with the Click PLC.
https://accautomation.ca/simple-click-data-logging-node-red/
I hope this helps you out.
Regards,
Garry
https://accautomation.ca/series/click-plc/
If you make a line graph object in the EA9-RHMI there is a check box in the option tab to log the tags.
Update: I have the monitors installed in the machines, and trying to log the data in a SQL DB. I have node red all installed and fired up and is working. I can get the information into node-red, but I can't get it into the DB. This is a learning as I go scenario. It says there is a problem with my function before the SQL write. Is there anyone who could possibly point me in the right direction? I have read and watched the tutorials on how to and still not working.
Can you post your code in the function to write to the database?
Sometimes the syntax can be tricky.
Regards,
Garry
https://accautomation.ca/
Here is the Server side of the data I am wanting.
Date DATE,
Machine CHAR,
[Parts Ran] INTEGER,
[Down Time] DATETIME,
[Setup Time] DATETIME
Function
msg.payload = { value: msg.payload, 'fc': 4, 'unitid': 1, 'address': 0 , 'quantity': 4 }
Function
"topic":"INSERT INTO ProdMon(Date,Machine,[Parts Ran],[Down Time]) values("+""+msg.payload.data[3]+ ":" +(+msg.payload.data[2]) + ":" +(msg.payload.data[1]) + (+msg.payload.data[0])}
I keep getting an error that Node-Red can't open my database. I saved it to my desktop to try and make it easier to find. I can't get it to put any data into the server.
Any and all help is greatly appreciated.
Hi @CHemminger (Customer)
Your function code syntax does not look correct. It looks like you have a table called ProdMon. I do not believe you can have spaces for your table column names. What type of databases is connecting?
You are only storing two variables - (data3 : data2 : data1) and data0
If you can attach your flow it would be easier to see and find your errors.
https://accautomation.ca/node-red-sql-database-log-modbus-logging/
Note: Ctrl + e will export your nodes.
Regards,
Garry
I think this is what you are wanting. this is just basic so I can understand it before hooking up more machines to it. So far I have 3 machines that I am able to connect to and pull the bits from just can't do anything with the information yet.
Hi @CHemminger (Customer)
If you select the pancake (three horizontal lines) beside your deploy button.
Attach this file in the post.
Regards,
Garry
https://accautomation.ca/series/node-red-iot-enabling-software/