How to Read Modbus Data with Python - Part 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • (Part 1 of How to Read Modbus Data with Python)
    Part 2: • How to Read Modbus Dat...
    The 5 inch industrial panel PC in the video: chipsee.com/product/ppc-a55-050/
    pymodbus: github.com/pymodbus-dev/pymodbus
    I used Chipsee 5 inch RK3568 HMI and Python pymodbus to read a temperature + humidity sensor data, using Modbus and RS485.
    This video shows how to wire the devices, how to install Python packages, how to invoke Python functions to read the temperature data, and how to use logging to learn what's going on under the hood.
    In the end you should be able to read your own Modbus sensor including but not limited to simple ones like temperature and humidity sensor.
    In the next video I'll also show you how to build a GUI to display the data we get from sensor on the Chipsee human machine interface.
    Follow us on Facebook: / chipseeipc
    Follow us on Twitter: / chipseeipc
    00:00 Intro
    01:02 Wiring
    03:16 Install Pymodbus
    04:12 Pymodbus programming
    05:04 Chipsee Doc - How to decide port
    06:45 Sensor Doc - Which registers
    09:25 Pymodbus Doc - How to read holding register
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 11

  • @davidsiltroy
    @davidsiltroy 2 วันที่ผ่านมา

    Amazing video! thank you a lot!!

  • @retieftheron8280
    @retieftheron8280 2 หลายเดือนก่อน

    Hi man. Great video, it helps so much. I was just wondering, I'm currently working for the first time on a Raspberry Pi3 and am trying to implement this to read the values from a temp and humidity sensor(FG6485A). Around the 4:10, mark it seems like your out of the terminal and in an IDE of a sort. Mine does not do this and keeps me in the terminal. Can I just code in Thonny and will this also work? Thanks so much in advance.

    • @Chipsee
      @Chipsee  2 หลายเดือนก่อน

      Hi, thanks for leaving a comment! At 4:10, I was using the default terminal app of MacOS, and ssh to my 5 inch panel PC's Debian Linux system, so it's not an IDE, it's still a terminal.
      If you're using a Raspberry Pi3, you can use its out of box terminal app as well. Take a look at this: projects.raspberrypi.org/en/projects/raspberry-pi-using/8.
      As far as I know, Thonny is an IDE to run Python scripts? If so, you can work in Thonny, no problem at all. At 4:10, I was in terminal, running a program called VIM (th-cam.com/video/-txKSRn0qeA/w-d-xo.html), which is a text editor. Then I execute python commands manually like in 7:48, this is the same as editing code in Thonny then click a run button in Thonny.
      But you said you're new to Raspberry Pi (and general programming maybe?), if you want it work in Thonny, don't forget to pip install the packages like I did from 3:30 to 3:40 like in this tutorial: packaging.python.org/en/latest/tutorials/installing-packages/#use-pip-for-installing. You might find this page for Thonny helpful: github.com/thonny/thonny/wiki/InstallingPackages.
      Happy hacking!

  • @juancamilo9995
    @juancamilo9995 8 หลายเดือนก่อน

    Hello, I would like to know if it is possible to make and do you have experience for a modbus sunspec prototype (Modbus variant specified in solar energy) with this python library?

    • @Chipsee
      @Chipsee  8 หลายเดือนก่อน +2

      Hi! It's totally doable with pymodbus, but I don't have experience. Have you looked at some Github open source project like this: github.com/sunspec/pysunspec2?

  • @lennich4199
    @lennich4199 8 หลายเดือนก่อน

    Very interesting video! Is there a way to read Modbus TCP data with the Man in the middle principle? For example, you have the temperature sensor as the server and the Chipsee PC as the client. Instead of reading the data directly from your sensor, you have for example a Raspberry Pi in between those components that monitors the traffic.

    • @Chipsee
      @Chipsee  8 หลายเดือนก่อน +1

      Thanks man!
      I read your comments a couple of times, and searched for MitM+Modbus, I found it's an attack method to take control of the Modbus server? Are you trying to hack a Modbus network or protecting against MitM?
      I do not have any experience to actually set up an MitM attack though.
      If you want to protect against MitM, maybe set up the firewall of the HMI, use TCP over TLS(like use https instead of http to avoid MitM) when sending Modbus TCP data. And of course, patch other workstations in the network, avoid social engineering happening to your operators (guys working in the plant/factory who operates the machines).
      Is this what you are asking?

    • @bentleyjarrard885
      @bentleyjarrard885 16 วันที่ผ่านมา

      Ya, what you are describing is a very common scenario. I have the exact same problem, trying to R/W data to holding registers of several devices with unique unit ID's that are connected to a communication gateway that is accessed by Modbus TCP/IP. Did you ever find an answer to this question?

  • @B__AhmadNur_DMekatronika
    @B__AhmadNur_DMekatronika หลายเดือนก่อน

    first thnks to this tutorial and i want to know more, i do research abt read data from sensor with rs485 to LAN converter, i use USR-DR302 as converter and i will using python to get data, so using pymodbus to, can u help me more tutorials abt tht. thnks

    • @Chipsee
      @Chipsee  หลายเดือนก่อน

      Sorry I don't have any experience with USR-DR302, so can't say much about it. Is there any specific problems you got into?

    • @B__AhmadNur_DMekatronika
      @B__AhmadNur_DMekatronika หลายเดือนก่อน

      ​@@Chipsee thnks to reply, and i hve done with my code​