EdgeX-API doc
  • EdgeX Foundry Background
  • Getting Started
    • Install
    • UI Console
      • V1.0
      • V1.1
    • Experiencing EdgeX
  • Edge to Cloud
    • Azure
    • AWS
    • Aliyun
  • Edge to Edge
    • MQTT Export Service
    • MQTT Import Service
    • Grafana Dashboard Connection
  • Industrial SDK Setup
  • Device Connection
    • Configuration
    • Programming Basics
    • EdgeX Version
    • Platform
      • System Information
      • RF
    • Cold Chain
      • G1 Sensor
      • Gateway
    • Printer
    • Scanner SDK
    • Battery
    • IP Camera
    • SNMP
    • Modbus
    • Medical Cart
  • Advanced Services APIs
    • EdgeX Service Layers
    • Core Data Service APIs
    • Meta Data Service APIs
    • Command Service APIs
    • Alarm Service APIs
  • Edge AI
    • Face Detection
    • Facial Recognition
  • Edge to WISE-PaaS
    • Smart Pump Station Solution
    • Cloud Cold Chain Solution
    • Integration with WISE-PaaS
  • Edge to Cloud(for Delhi only)
    • Azure
    • AWS
  • Retail Utility
    • OPOS Manager
  • Medical Utility
    • AMiS Link
  • Vertical Utility
    • Self-Diagnostics
    • System Diagnostics
    • DeviceChecking / Kiosk
    • DeviceChecking / Server
    • Device Diagnostic Dashboard
    • Windows Lockdown/ Kiosk
    • Retail System Manager
    • Scanner Utility
  • Application Cases
    • Smart Warehouse
    • Smart Kiosk
    • Demo Video
Powered by GitBook
On this page
  • Purpose
  • Gateway Environment
  • Modbus Device
  • Add Modbus Device Service
  • Create Modbus Device/Device Profile
  • Test Modbus Device Service

Was this helpful?

  1. Device Connection

Modbus

PreviousSNMPNextMedical Cart

Last updated 3 years ago

Was this helpful?

Purpose

This tutorial can help you quickly to build a Modbus application with Advantech EdgeX SDK.

Gateway Environment

Note: In Windows, Docker containers are completely isolated from local machine. In order to share Windows folders with Docker containers, you first need to configure the "Shared Drives" option in Docker Desktop settings. The computer also needs to restart to finish the configuration changed.

Modbus Device

The following table shows the configurations of the Modbus simulator.

Add Modbus Device Service

1) Download the Modbus sample from GitHub, then copy to Advantech EdgeX SDK installation location.

2) The Modbus sample contains following files and folder.

modbus – This folder contains Modbus device service configurations docker-compose-modbus.yml – Modification for Modbus device service modbus.tst – Testing config file of Modsim32 application

3) To deploy Modbus device service.

docker-compose -f docker-compose-modbus.yml up -d device-modbus

Create Modbus Device/Device Profile

In our sample, both device and device profiles are created which the definition of the protocol shown in the table.

However, you can create the other device and input the related parameters through edgex-ui-go. For the device profile, the easiest approach is to just upload the profile.

Test Modbus Device Service

1) Launch Modsim32 application to load the testing config file. (File > Restore Test Config > Choose modbus.tst file)

2) Connect to service port. The predefined number is 501.

3) After Modsim32 connection finished, then you can use edgex-ui-go for EdgeX commands sending/receiving.

4) The output result of command 1: {"device":"WISE-4012","origin":1623326175129752600,"readings":[{"origin":1623326175116855800,"device":"WISE-4012","name":"Temperature","value":"50"},{"origin":1623326175124556300,"device":"WISE-4012","name":"Humidity","value":"70"}],"EncodedEvent":null}

5) The output result of command 2: {"device":"WISE-4012","origin":1623326183105216000,"readings":[{"origin":1623326182998939000,"device":"WISE-4012","name":"Fan","value":"true"},{"origin":1623326183089695200,"device":"WISE-4012","name":"Light","value":"true"}],"EncodedEvent":null}

Here, we choose the ModSim32 application for simulation on Windows.

git clone tutorial-modbus xcopy /s tutorial-modbus* c:\Advantech\EdgeX-API\EdgeX-tools\

https://www.win-tech.com/html/modsim32.htm
https://github.com/Advantech-EdgeX/tutorial-modbus