Read and Write Siemens S7 PLC Data in Node-RED
This Node-RED flow demonstrates how to connect to a Siemens S7 PLC using the S7 protocol for both reading and writing data. It uses the s7 in and s7 out nodes to access specific DB addresses or memory locations in the PLC. Ideal for industrial automation scenarios that require bidirectional communication with Siemens controllers (e.g., S7-1200, S7-1500).
[{"id":"e267b548965a7a6d","type":"s7 in","z":"c1e71160f19e64f3","endpoint":"48669d354896b173","mode":"single","variable":"Temperature","diff":false,"name":"Read Temperature","x":230,"y":100,"wires":[["d9cb9d8c6010d2f4"]]},{"id":"d9cb9d8c6010d2f4","type":"debug","z":"c1e71160f19e64f3","name":"Debug Read","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":100,"wires":[]},{"id":"7f0f8184d48f8a7f","type":"inject","z":"c1e71160f19e64f3","name":"Inject Write Value","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"42.5","payloadType":"num","x":220,"y":180,"wires":[["ab11fbc7403f38b5"]]},{"id":"ab11fbc7403f38b5","type":"s7 out","z":"c1e71160f19e64f3","endpoint":"48669d354896b173","variable":"","name":"Write Temperature","x":460,"y":180,"wires":[]},{"id":"48669d354896b173","type":"s7 endpoint","transport":"iso-on-tcp","port":"102","rack":"0","slot":"1","localtsaphi":"01","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"rack-slot","adapter":"","cycletime":"1000","timeout":"2000","name":"S7-1200 Connection"}]