Hi,
I am trying to write the logged sensor data in CSV file. I am getting the file with “i” {x,y,z} values and want to write that data to a CSV file.
Has anyone done it before? What would you recommend looking at first?
Hi,
I am trying to write the logged sensor data in CSV file. I am getting the file with “i” {x,y,z} values and want to write that data to a CSV file.
Has anyone done it before? What would you recommend looking at first?
Hi @arystan
I’m asking because we are developing ncd Node-RED Dashboard with the function to save CSV data.
For now they are available for:
and more coming soon.
But if you are using another type, don’t worry, I could help you create your own flow.
Hi Eduardo,
We are using NCD 2-channel vibration sensor plus. The file below is the vibration we are reading (testing it right now). I want to write X Y and Z to CSV file.
Data_points.txt (112.2 KB)
We were able to read the device temperature separately.
I have not tried reading data through modbus yet, but I believe it could be an easier way to collect data through modbus and write it to CSV. Json file is attached below:
vibrationflows.json (16.7 KB)
Thank you!
Best regards,
I share you a basic flow to save CSV file for “i” {x,y,z} values:
[{"id":"846bf67135d18c8c","type":"csv","z":"554db30249c9d434","name":"building CSV","sep":",","hdrin":false,"hdrout":"none","multi":"one","ret":"\\r\\n","temp":" key, value_x, value_y, value_z","skip":"0","strings":true,"include_empty_strings":true,"include_null_values":true,"x":650,"y":200,"wires":[["96fe9348b70f10f3"]]},{"id":"96fe9348b70f10f3","type":"file","z":"554db30249c9d434","name":"Add your local path","filename":"","filenameType":"str","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":830,"y":200,"wires":[["b2df274e1d839634"]]},{"id":"b2df274e1d839634","type":"debug","z":"554db30249c9d434","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":990,"y":200,"wires":[]},{"id":"abea9099e3c8c3b0","type":"function","z":"554db30249c9d434","name":"getData","func":"var data = msg.payload.data;\nfor (const property in data) {\n msg.payload = {\n key : property, \n value_x : data[property].x,\n value_y : data[property].y,\n value_z : data[property].z,\n };\n node.send(msg);\n}\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":200,"wires":[["846bf67135d18c8c"]]}]
Copy JSON.
Go to Node-RED instance, click on main menu and select “Import” option.
Paste JSON in textbox (pink color):
Click on “Import” button.
Connect the output of your ncd node (2-Channel Vibration Plus) to input function node:
Then go to the path you assigned and open the “log.csv” file to verify the data.
I hope you find the flow useful, let me know if you have any questions or if I can help you with anything else,
Thanks
Eduardo M.