Categories

Remote Machine Monitoring–Connecting to a Modbus Network with Java and Jamod

Remote Machine Monitoring–Connecting to a Modbus Network with Java and Jamod

For a recent project, I had an interesting challenge. It involved a (relatively) simple control system, with an Allen Bradley MicroLogix PLC, and 30 or so inputs and outputs. The challenge was that the customer wanted to be able to access (and potentially control) live machine data from anywhere on their network, while buying as little hardware or software as possible. After a bit of research I came up with the following solution:

The only entryway to the data that was available with no additional hardware was the Modbus RTU network already in place, that fed data from the PLC (master) to some intelligent analog gauges (slaves) in the field. If I tapped into that, and sent the signal through a cheap Modbus RTU to TCP/IP converter (the only hardware addition necessary), I knew I could just plug into the customer’s existing Ethernet network, and have all the data I needed available from any Modbus TCP/IP server also plugged into the network.

That was the easy part. The hard part was finding a way to display that data in a meaningful way on a PC. After a bit of research I found two options. Two libraries, one for Visual Studio .NET offered by Win-TECH, and one for Java (called jamod), that could set up both client and server Modbus TCP/IP connections from a PC. The core differences were that the .NET library was supplied by a private company and cost thousands of dollars, whereas jamod was open source, had an active online community, and was free to distribute under a modified BSD license. Even after weighing the risks of leaning on an open source solution (lack of support), the jamod solution seemed a little more enticing.

After surprisingly little tinkering around, I had it up and running. The library simply extends the regular Java TCP/IP Connections class, and offers many of the same connectivity functions, along with all of the standard Modbus communication functions. It really opens up the possibilities for custom remote monitoring software. My customer can now log into their machine, check the status of (or modify) all of its parameters, and log the data to a local CSV file, all from any computer that can run the Java Runtime Environment. Even neater, the JRE is available on many mobile platforms, giving anyone with the right smart phone the ability to peek into the machine data.

Jamod truly opens some exciting doors. This open source library, combined with Modbus (the most widely used protocol in the manufacturing world), makes it easier than ever to create customized remote monitoring and control applications with extremely low hardware and software costs.

Learn more about DMC's software and web development services.

Comments

Sindhu Patil R.V
# Sindhu Patil R.V
Dear Sir

I am Student, doing my internship. in my internship my one of my aim is to make Raspberry pi as modbus slave device and send the data, for that used 2 USB to R485 converter to connect two laptops, presently writing code in eclipse in one of the window laptop and used modscan software in other laptop to detect the data, is this way both master and slave will communicate ??

please can you help me in java code , Since i am new to java and also new to modbus protocol
Thanks
Sindhu
Satya
# Satya
Hi - I'm new to TCP MODBUS. Can you kindly tell me step by step process of running protocol on a single PC (both master and slave are on localhost)

From http://jamod.sourceforge.net/ - I downloaded jamod-1.2-SNAPSHOT having only .class files are there, how to see source code!

Eagely Waiting
Satya
Jon Carson
# Jon Carson
Hi Luis, I am not sure what you mean by FVD, however, the library should work just fine regardless of the type of device, as long as it follows the Modbus protocol.
Luis
# Luis
Hi

Are there examples how to connect and modify tags from the FVD? PLC
Jon Carson
# Jon Carson
Hey Roberto. Glad you found this solution helpful!
Roberto
Hi Jon, Hi all,
After my post at 22 June 2011 I have used Jamod classes to realize SCADA system that query many fotovoltaic plants around Italy country, you can see at www.energemetry.net and sign in with demo, demo.

The results with graphs is very reliable, powerfu, and is possible to query hundred of plants in few seconds, each one for 60 register at least.

Connectivity for plants is realized by UMTS routers and datalogger that acts as Modbus TCP server.

Up to now there are monitored 20 plants, but in demo only 4 are shown.

Available for suggestion.

bye
Roberto

Luis
# Luis
Hi

Any ideas with this, i have several VFD that i need to read the status and values of the parameters but i also want to scan the devices connected and read the values, i am trying to use jamod, any idea or example?


Thank you.
Krishna Aryal
I use web600 device which is used to retrieve six zones information using Modbus protocol using JMdbus Library sucessfully. If need any solution please contact me.

Thanks
Sandy
# Sandy
1.I have a Siemens control system and want to add some signals into the system using a device which has modbus protocol.
2.I have a simulator running process model and want to communicate with a device runs on modbus protocol. What I need so I can write/read data into this interface device using Modbus.May I get some guidance please.
Thanks in advance.
Dave O
Is it possible to display Modbus RTU data (via a Modbus TCP/IP gateway) in a web browser? Our products, with our proprietary control instrumentation, have the Modbus RTU interface. Some customers would like to see a representation of the control instrument in a web browser.
Krishna Aryal
please help me how to access sansaphone remote monitoring system data from java.
Erick
I need the source code, its a proyect to my job.
Billy Smith
# Billy Smith
Thanks, for the article. I am trying to use jamod to write an application to help automate testing of some chillers using the MCS-Magnum controller. Do you have any experience with these? With TCP connections I am seeing ACK's from the controller but I am unable to establish a connection.
Roberto
# Roberto
Hi Jon,
I have same requirements as yours, but with de-centralized plants, so I need to get data and status in Modbus TCP from different sites.

All plants can be reached via Pubblic IP but dynamic, so I need to address a domain name, mapped on dynamic dns service, and resolve in IP address, does the Modbus TCP with Jamod library implement that?

Thanks
Roberto
Jon Carson
Hi John,

As far as I am aware, the error code you're describing means that your Modbus slave doesn't have that register address. Make sure the Modbus slave (modsim32?) has that register available, and also be aware that sometimes different Modbus components address things differently, i.e. some start at 0 and some start at 1, so register 0x40001 on one device might be 0x40002 on another. If you can't figure it out from there I recommend the jamod forum, which is at http://jamod.sourceforge.net/ . Good luck!

Jon
JOHN
# JOHN
hi,

i am new to this field. but i have to work on modbus tcp/ip. i found one modsim32 through i did tct/ip connection using port no 502 in two differnt pc. now i copy the Tcp Master program from jamod and run that. i tried a lot but i found one error code 2 which means address reference is not correct. i spent alredy 3 day but can't find the exact solution for this. if u have any solution please help me

if u say i will send allthe screenshort and my program and error msg to u so that u have clear idea.

Thanks,
John
INDIA
Jon Carson
Java is platform independent. I have never developed Java on the Mac, but I know it can be done. Any Java library will work wherever the latest version of the Java Development Kit (JDK) and Java Runtime Environment (JRE) are installed, and these are available for Windows, Mac, and many others.

Regards,
Jon Carson
Travis
Do you think this will work for mac osx?
Jon Carson
I'm glad you found this post helpful. You can absolutely accomplish data monitoring using this method. I have implemented it on most of my Java/Modbus control applications. It's very easy to get as sophisticated with it as you like-- anywhere from simple CSV file logging on a local hard drive, to full-on database entry and automated reporting services. One thing to note is you will run into difficulties if you try to log to a CSV file using a Java applet instead of a Java application, because applets do not have file read/write capabilities. It sounds from your description however that an applet would not be the right solution anyway--a pretty quick program could probably do everything you desire.

If you would like to talk more about details feel free to either reply here or send me an email at jon.carson@dmcinfo.com

Regards,

Jon Carson
Robert Honders
Sounds like exactly the solution I have been looking for to read the Circuit Monitors (power meters) in my Micro Hydro powerhouse. How about some data logging? Do you think that can be done as well?
Rob

Robert J. Honders CE
Honderosa Valley Consulting & Renewables Research
Studio Building I
129 Kennel Rd.
Cuddebackville NY 12729

Honders@HVC.RR.COM
Robert@Honders.com
Phone: 845 754 7106
http://energyindependence-rob.blogspot.com/

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Categories

Related Blog Posts