Modbus RTU RS485

Hi,

I wrote for a while a Python 3.9 script for reading data of a data aquisition box over Modbus RTU.

  • I used minimalmodbus over a RS485 Dongle to USB: working well
  • What I’ve tried and what’s not working: I would like to connect the box now over Anvil in real time and showing the data on the connected pc and then showing the data in the web (ANVIL APP like a remote desktop)

#################
import serial
import minimalmodbus

instrument = minimalmodbus.Instrument(‘COM4’, 1)
… all the needed stuff for the modbus (parity, …)

I do not get the port to open in Anvil on the same PC and same port, however the Pyton program is running and able to open the port and to connect.

What is strange: I tried to print the connected ports in Anvil, giving me [ ] no port in the print result. The Winows device manager is showing the port and USB Dongle.

Question:

  • Do I need to give the PC path since on the server side?
  • Can I show the Anvil app from the PC connected to the MODBUS RTU like a remote app in the web; not as a multiuser app?

BR,
Gerhard