Modbus Slave simulator setup

Hi everyone. I am trying to setup a modbus slave simulator in my PC in order to test my Python script before I purchase an actual hardware for the prototyping. I am facing issue trying to setup this simulator and hope someone who have experience with this can point me to the right direction.

My current understanding of setting up the simulator is this:

1. Turn on the simulator software
2. Setup the connection
3. Test my script by connecting to the simulator

I am using a software called "Modbus Slave". When I setup the connection, using "Serial Port", it often tells me "Port n not available". I have read the documentation and don't whether I need to have a physical RS485-USB converter connected to my PC to make the port available. What is the proper way to setup the simulator with serial connection?

Note: the simulator will be a slave device, and my Python script will run and take the registry value from this simulator.

Any help will be appreciated!
 
I'll try,
(1) install the SW, it will give you some trial version. I think it should be enough.
(2) Create New Pair, the SW will open for you 2 virtual comm ports that are logically connected between them.
* follow the following link: https://www.eltima.com/virtual-com-port-windows-10/
(3) you can connect python to one virtual comm port, and modbus slave to the other. and it should communicate between them through the virtual comm pair.

Hope this helps.
 
Hi everyone. I am trying to setup a modbus slave simulator in my PC in order to test my Python script before I purchase an actual hardware for the prototyping. I am facing issue trying to setup this simulator and hope someone who have experience with this can point me to the right direction.

My current understanding of setting up the simulator is this:

1. Turn on the simulator software
2. Setup the connection
3. Test my script by connecting to the simulator

I am using a software called "Modbus Slave". When I setup the connection, using "Serial Port", it often tells me "Port n not available". I have read the documentation and don't whether I need to have a physical RS485-USB converter connected to my PC to make the port available. What is the proper way to setup the simulator with serial connection?

Note: the simulator will be a slave device, and my Python script will run and take the registry value from this simulator.

Any help will be appreciated!
Setting up a Modbus slave simulator for testing your Python script is a great way to ensure your code works before investing in physical hardware. Here's how you can set up the simulator and address the "Port not available" issue:

  1. Software Selection: You mentioned you're using "Modbus Slave" software, which is a common choice for Modbus simulations. Make sure you've downloaded and installed it correctly.
  2. Serial Port Connection:
    • Physical RS485-USB Converter: Modbus over RS-485 typically requires a physical RS485-USB converter to connect your PC to the Modbus network. You need this hardware because RS-485 is a physical layer standard, and your PC's native serial ports are usually RS-232, not RS-485.
    • Virtual COM Port Emulation: If your PC doesn't have a physical serial port, you can use virtual COM port emulation software. These tools create a virtual serial port on your PC, allowing you to connect to it as if it were a physical port. Software like "Virtual Serial Port Emulator" or "com0com" can help you set this up.
  3. Configuring the Simulator:
    • Open the "Modbus Slave" software and configure it to emulate a Modbus slave device.
    • Select the serial port (either physical or virtual) that you want the simulator to use. Ensure the settings (baud rate, data bits, stop bits, parity, etc.) match the settings you plan to use in your Python script.
  4. Python Script Configuration:
    • In your Python script, use a Modbus library like pymodbus or minimalmodbus to communicate with the Modbus slave. Ensure the Python script is configured to connect to the same port and uses the correct Modbus slave address.
  5. Testing:
    • Run your Python script and check for successful communication with the simulator.
    • Test reading and writing Modbus registers to ensure your script behaves as expected.
If you're still encountering issues with the "Port not available" error, double-check that the selected port in your Modbus simulator matches the one you've configured in your Python script. Also, make sure you've set the correct parameters (baud rate, data bits, stop bits, etc.) consistently in both the simulator and your Python script.

By following these steps and ensuring the proper configuration of your virtual or physical serial port, you should be able to set up the Modbus slave simulator and test your Python script effectively.
 
Top