การใช้ Node Red อ่านค่าจาก Modbus เพื่อให้ PLC จับมือกับ IoT

Mr.aegkaluk sopapun
Sep 1, 2018 · 2 min read

ก่อนอื่นผมใช้ Modbus Simulator เพื่อเราไม่ต้องซื้ออุปกรณ์ PLC จริงมาเรียนรู้ แล้วเราก็กำหนดค่าให้กับ IO แล้วใช้ Node Red อ่านค่าเพื่อนำไปประมวลผลต่อได้ ก็ทำการ download ตามลิงค์ที่อยู่ด้านล่าง

http://www.plcsimulator.org/documentation

และทำการกำหนดค่า Modbus Master หรือ Server ใน Node Red

ใน node red ให้ติดตั้ง node-red-contrib-modbus เพื่อใช้งาน protocol modbus ได้

แล้วกำหนดค่าใน Modbus Read ว่าจะอ่านที่ address ที่เท่าไหร่ input แบบไหน ในที่นี้ผมกำหนดไว้เป็น read input registers

เราก็จะได้ค่าที่อ่านมาจาก Modbus simulator แล้วล่ะครับ

ถามว่าจะทำไงต่อ เมื่อเราอ่านค่าจาก modbus ได้ หมายความว่าในยุคปัจจุบันที่ IoT กำลังเติบโต ระบบรุ่นพี่ที่เกิดก่อน คือ SCADA และ PLC ก็ขยายตัวไปแล้วในวงกว้างในกลุ่มอุตสาหกรรม แล้วเราจะทิ้งรุ่นพี่ไปได้อย่างไร หวังว่าจะเป็นแนวทางในการใช้ PLC เข้ากับ IoT น่ะครับ

ตัวอย่างที่ผมกำลังทำ คือ อ่านค่า protocol modbus แล้วแปลงเข้าสู่ protocol mqtt ที่ใช้ในระบบ IoT

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade