« Close

Datasheets and User Guides

App Notes

Software & Driver

 

Scada Mobile with Modbus (App Note)

This AppNote shows users how they can monitor and control a Modbus capable LabJack device over the internet using ScadaMobile.  

Compatibility

  • T7
  • UE9, Please use Comm version 1.43 for stable results
  • U3 through LJSocket
  • U6 through LJSocket

Overview of Scada Mobile

ScadaMobile (website, store) is an iOS App (iPhone, iPod Touch, iPad) that can be purchased from the Apple App Store to directly monitor and control Modbus devices over the internet. In addition to several examples and a user's guide regarding the larger use of their product, this App Note will cover the specifics of ScadaMobile's Modbus support and its use to communicate with LabJack devices.

Figure 1. LabJack via internet, using the ScadaMobile app

Communicating with a LabJack

Getting information from a LabJack device using ScadaMobile:

  1. Find the IP address and active Modbus port of the device you are trying to use
  2. Look at the relevant Modbus page, find the register number for the information you are trying to collect, and determine how many registers need to be read.
  3. Construct a .csv file and upload it to your phone.

1. Finding necessary device information

Plug the device into your computer, open LJControlPanel, scan for the device, and locate the IP address it is using.  You may also need to know that the Modbus port on our UE9 devices is the standard port 502 as declared by the Modbus protocol.  

If you are connecting to a device using LJSocket, you need to make sure that you instruct your computer to open the device before attempting to start using the app. You can not open or close devices using ScadaMobile.  Once you are sure that socket has opened the device, find the IP address of the computer and use the port in the 5000's 

These attributes can be modified in the csv file by changing the "local_ip" and "local_port" values

2. Modbus information

Once you know what address you wish to collect data from or control, change the HRxxxx value to the register in the Modbus table+1.  The next important step is to understand what information is being read, making sure to review all of the documentation that corresponds to the desired Modbus address. This includes determining a corresponding data type in ScadaMobile with a sufficient number of bits.  AIN0, for example, uses address 0 (which becomes 1 for Scada, HR1). Also understand that the value is stored in two registers and, knowing that information, you may need to consult reference 3.1.2 of the ScadaMobile users manual to find an appropriate data type. For AIN0, the desired data type is REAL.

3. Creating a .csv file

To properly create a .csv file, refer to ScadaMobile's website or the following examples.  When editing these files with a text editor, the value before the first "," is the name that the value will be stored under. Additionally, the second is the data type, the third is the starting Modbus address+1, and everything after the third "," constitutes extra configurations.  The important configuration variables are local_ip and local_port which need to be changed in order for ScadaMobile to work properly.  

The first, LJSimpleModbus, contains four one-liners that read a single attribute of a LabJack device.  Simply open the file in a text editor, delete the "#" before the line you wish to use, configure the IP address / port for your device, and upload the file to your phone.

The second, LJREAD_ANALOG, reads all 14 AIN channels on a UE9 device.  This is done in one command by telling ScadaMobile to read 14 sequential addresses and store them into a buffer. Of course, you will need to define the data type as an array. I needed to read REALs for AIN values and, in order to read all of the channels, I defined the array with a length of 14.  

The third, LJREAD_DIGITAL, reads 20 of the 23 digital lines of the UE9.  It does this by, again, defining an array that is long enough to store all of the necessary data and then telling ScadaMobile to make a Modbus request for multiple addresses before finally pulling out the valuable information from that array.  

2 comments

Same fantastic stuff for Android is available?

For a pre-made program, there are a number of Android compatible Modbus TCP programs: http://www.appszoom.com/android_applications/scada+modbus

It looks like TeslaModbusSCADA is quite popular.

To write your own program that has custom functionality, we recommend starting with the source code of our Android Modbus TCP demo program. The demo program is written in Java and can be used to communicate with a T7 over its Modbus TCP interface (Ethernet/WiFi).

 

Also, here is a list of other Modbus TCP programs for the iPhone, or iPad

http://www.pacetoday.com.au/news/top-5-scada-and-automation-apps-for-iph...