Email Us at [email protected]

Download N3uron
Back to videos

Modbus Server / Configuring Modbus Server

Configuring Modbus Server

Description

In this video of our N3uron Academy, we’re going to show how easy it is to configure the Modbus Server module, to make our data model available through the Modbus protocol. Let’s get started!

  • [06:30] Configuring Modbus Server

Transcription

[00:00] Hello everyone! In this video, we’re going to show how easy it is to configure the Modbus Server module, to make our data model available through the Modbus protocol. We’ll use a Tank as our example to demonstrate how to map some tags like tank level, level setpoint, valve command, and valve statuts to a Modbus device. Let’s begin by creating a new instance of the Modbus Server module. Navigate to the “Config” tab under the “System” section in the Navigation panel. Click on “Modules,” and then select “New module” from the menu. We’ll call this one “ModbusServer”, and set the Module type to “ModbusServer”. All the other settings can stay as they are, so let’s save the changes. Now that our module is created, we’ll select it from the modules list in the Explorer panel and proceed to create a new channel. 

[01:03] This channel will represent the physical medium that one or more slave devices will use to communicate. Let’s name it “Tank Channel” and get to configuring it. First, we’ll enable data collection to keep the channel active. Next, choose the Modbus mode. You can pick either TCP for direct Ethernet communication, or RTU encapsulated for Ethernet-to-serial converters. For this setup, we are going with TCP. Now, we’ll focus on the Server section. The default port number is 502, so we’ll leave that as is. For the network interface, we’ll select “All interfaces” to make sure the server listens to all network adapters. Set “Max connections” to 0 for unlimited connections. Finally, leave the “Source IP addresses” blank for no restrictions, or enhance security by specifying IP addresses separated by commas in the whitelist.

[02:00] With these settings configured, go to the Devices section to add a device. Remember, you can add one or multiple devices. Enable data collection for the device and assign it a unique device address. Then, adjust the Modbus address offset, buffer sizes, and swap settings to ensure compatibility with your Modbus clients. If you want to, you can also enable status control to monitor the device status and alert clients of any issues. When active, it checks a control tag’s quality or value. If the quality is not “Good” or the value is not zero, the device rejects requests from the Modbus client and sends an error response. Let’s move on to tag mapping. We’ll create a map group and set up our tags for both read and write requests. You’ll define if you’re sharing the tag’s value, timestamp, or quality, set the Modbus address, and pick the data type. There’s also an option to set a fallback value if the tag’s quality isn’t good.

[03:03] Begin by mapping the Level tag, a 16-bit unsigned integer, to Modbus address 400001 as a Holding Register. Next, map Level_Setpoint to 400002, another 16-bit unsigned integer Holding Register. The read and write permissions for this tag have already been configured in the tag’s settings. Then, map the Valve_Command tag to 000001 as a Coil with a Boolean data type, with its read/write permissions also pre-configured in the tag settings.

[04:00] Finally, map Valve_Status to 000002, another Boolean Coil, that shows the valve’s status. These addresses follow the Modbus standard. For more details on addressing registers and coils, check the Web UI help section or visit our knowledge base. With the Modbus Server module fully configured, it’s time to test it out. First, let’s check the diagnostics to ensure everything is running smoothly. As we can see, the server is up and actively listening for requests on all interfaces, and the tag mappings are in place.

[05:10] To test our setup, we’ll connect to the Modbus server using a Modbus client. Keep in mind that different clients may use varying addressing methods, handle addressing a bit differently. While some use implicit offset addressing, N3uron’s Modbus Server relies on absolute Modbus addressing. For example, when configuring Holding Registers, address 400001 on the server might correspond to address 0 on the client, 400002 to 1, and so on. We’ll start by writing a value to the Level_Setpoint tag. Notice how the Level tag adjusts to match the new setpoint. Now let’s open the valve by switching the value of  the Valve_Command tag.

[06:03] As the valve opens, the Valve_Status tag will update to show the valve’s status, and we’ll observe the Level decreasing as the tank empties. That’s all for this video. Thanks for watching, and see you in the next one!

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Youtube
Consent to display content from - Youtube
Vimeo
Consent to display content from - Vimeo
Google Maps
Consent to display content from - Google
Spotify
Consent to display content from - Spotify
Sound Cloud
Consent to display content from - Sound