from the Free Modbus department...
Free Modbus Driver in .Net
PLCs and related questions. topic
Posted by Stephen McLain on 29 January, 2009 - 7:22 pm
I'd like to program a TCP/IP Modbus driver to work with .NET so I can then develop an HMI. I want to do this from the ground up, but I'm not sure where to start.

I've spent the day looking around for a Modbus driver that will work for me that is free, but one doesn't seem to exist. There are free demos, OPC servers, and simulators, but I want a truly open source modbus driver OR the ability to program my own. Kepware costs, Automated Solutions costs, FieldTalk costs, and open source stuff out there is in Java or Python.

If there is a completely free Modbus TCP/IP dll that's out there, I'd be interested in it. If not, however, I need to figure out where to get started building from the ground up.

I'm not yet a very advanced programmer, but it's things like this that help us become more advanced, right? This community has already been a tremendous help in other areas, so I'm confident you'll have good insight on this matter.

Thanks for your time and attention. I look forward to your responses.


Posted by Geert on 30 January, 2009 - 6:11 am
I know of:
http://nmodbus.com/

have not yet used it...


Posted by Paul Wacker on 30 January, 2009 - 9:59 am
If source code in C is an option, you might consider http://www.freemodbus.org

Paul


Posted by M Griffin on 30 January, 2009 - 6:20 pm
One of the Python drivers that you may have looked at may have been mine. Something that you might consider is to just write your program in Python or Java. Another alternative is to re-write one of the Java drivers into C#. The two languages aren't that different.

Whatever way you decide to go, I would suggest that you figure out how your overall program is going to work before deciding that one or other of the possible solutions will work for you. One problem that many drivers have (whether they are free or whether you paid thousands of dollars for it) is that the authors didn't give a lot of thought as to how to integrate the driver into a useful program. The result is that you end up writing the program around the driver instead of making the driver fit your program. If you are doing anything other than a very small program, you will find out there is a lot difference between those two situations.


Posted by pvb on 1 February, 2009 - 6:13 am
You might have a look on
http://pvbrowser.org

This is a whole SCADA system as open source.
Besides other protocols it also includes modbus
http://pvbrowser.de/pvbrowser/sf/manual/rllib/html/classrlModbus.ht ml

The software runs on Linux/Unix/OS-X/Windows and servers also under OpenVMS.


Posted by Stephen McLain on 2 February, 2009 - 12:53 pm
Alright. I'll investigate all this stuff and let you know what I decide to do. I definitely want to build the driver for my application.

It will be particularly helpful to have an HMI with driver that I don't have to pay for each time I deploy it. As it is, we've bought around 40-45 licenses for our current HMI software. Going forward and probably backward, it would be good to be able to put a new HMI everywhere without paying for a license each time.

I'll keep you all posted on my progress.


Posted by M Griffin on 2 February, 2009 - 4:46 pm
I mentioned above that one of the Python drivers that you may have looked at is mine. It's part of a package on SourceForge called MBServer (it's also used in several other packages). http://sourceforge.net/projects/mblogic/
The web site for the project is at http://mblogic.sourceforge.net/index.html

If you go to the project site on Sourceforge, you will see a screen shot of a web based HMI. That HMI page comes with the MBServer package as an example of what you can do. The demo page can be used as the starting point of your own application, and the Javascript libraries included are general purpose (they're not written just for the demo). The HMI demo uses ordinary web technologies with no ActiveX controls or Java applets. To make an HMI application, you just have to know how to make a web page.

MBServer can act as a server (slave). It can also simultaneously open multiple client (master) connections to other servers. There are many other features built in as well.

MBServer is based on the Twisted communications and application framework "http://twistedmatrix.com/trac/". Even if you don't use MBServer, you might still want to use Twisted as the basis for your own system. I've only used a few of the Twisted features in MBServer (so far). If you would rather have a non-web based HMI, it is possible to use the Tkinter, GTK, Qt, or WxWidgets GUI toolkits instead. Twisted also does also a database API that works with Oracle, MySQL, PostgreSQL, etc. You can also do e-mail, FTP, and pretty much anything else. It's a lot easier than trying to do everything yourself. All the software you would need is free and comes with source code.


Posted by Stephen McLain on 3 February, 2009 - 5:08 pm
Thanks for the response. This is great stuff. I'm going to look into MBLogic and see if this will work for me. I've invested a lot of time learning .NET, so I've had an aversion to jumping into anything programmed in another language, but looking over it, this might supply me with what I need.

I'll keep you posted and let you know what I figure out.

Thanks again.

Stephen McLain


Posted by Mark on 4 February, 2009 - 4:57 pm
I noticed your inital posting on 1/29/09 and saw that you were still looking as of 2/3/09.

It sounds like you're determined to build your own driver, but I thought you might want to be aware of some of the benefits of off-the-shelf solutions.

Automated Solutions ASComm.NET includes field testing with hundreds of installations, is highly optimized for performance and usability with years of code refinements, has extensive cross-device testing and function support, and supports many industrial protocols. Help system is extensive and numerous examples are included.

With a multi-protocol component, as your requirements grow you have the ability to switch to other protcols like A-B Ethernet, GE Ethernet, other modbus flavors, etc. with a simple namespace change.

Some modern interface components like ASComm.NET have also evolved from pure driver (node address, starting address and quantity) to tag databases capable of scanning thousands of datapoints with register optimization, synchronous and asynchronous read/write capability, data change event notification, visual design capability, and configuration serialization. These features significanly reduce your coding time and allow you to focus on your solution.

ASComm.NET is also runtime-free in many situations.

Just some things to consider in your decision making process.

-Mark
http://automatedsolutions.com


Posted by Tim on 22 August, 2009 - 9:46 pm
> I'll keep you posted and let you know what I figure out. <

Wondering if you've decided and the reasoning. We're looking to implement a small-scale SCADA system to integrate our server room monitoring, modbus/TCP thermostat, and modbus RTU generator.
Not big enough to warrant Wonderware type solution.

Thanks!


Posted by M Griffin on 23 August, 2009 - 11:13 am
In reply to Tim: What are you trying to do? What features do you need?

I have a free stand alone web based HMI called HMIServer which you can download from "http://sourceforge.net/projects/mblogic/". Click on "view all files" and then select the newest version of "MB-Tools". HMIServer is one of the programs in the MB-Tools package. On-line documentation can be found at "http://mblogic.sourceforge.net/".



Posted by Power on 5 February, 2009 - 6:49 pm
I did it with winsock in vb6. It's so eazy. You don't need a driver. Google for "winsock modbus pdf" I'll try to find a sample and post it later.

It sometimg like winsock.send =(0)chr & (0)chr & (0)chr & (0)chr & (0)chr & (TotalBites)chr & (TotalDataBytes)chr & (mode)chr & (startREG)chr (value)chr & ................NO CRC needed


Posted by bob gantt on 24 August, 2009 - 12:26 pm
Need a free modus OPC server, that can work with multiple modbus RTU serial devices. Kepware works fine with multiple devices but is not freeware, I tried Iconics modbus server but couldn't make it work with more than one device. any suggestions? thanks.


Posted by Mustafa Al-mosawi on 25 August, 2009 - 6:25 pm
I think any search will come up rather empty, or direct you write your own TCP/IP stack and implement your own server.

Freeware is not as free as it seems, because you get freeware support, and freeware development, which can vary. If you are using this in a serious application I would go with a trusted OPC vendor that understands has implmented OPC.

Try MatrikonOPC's server for Modbus
http://www.matrikonopc.com/opc-drivers/128/base-driver-details.aspx


Posted by M Griffin on 25 August, 2009 - 11:53 pm
So far as I can tell, "OPC" and "free of charge" (or even "cheap") don't go together. All the "free of charge" OPC servers that I have seen are just demo versions (usually time limited. or some other limitation).

If you are using OPC, then the software that you are using it with is usually fairly expensive as well. In that case, people are usually don't have a problem paying still more for the drivers.

On the other hand, if you are writing your own software, then using OPC for Modbus is usually rather pointless because Modbus is an open protocol. There are lots of free of charge Modbus drivers available, they just don't use OPC.


Posted by e. Alan on 5 March, 2010 - 4:58 pm
It's been a year since thie post how did things work out. I am at about the same place now that you were a year ago.
Thanks


Posted by pvb on 6 March, 2010 - 8:26 am
http://pvbrowser.org is HMI/SCADA under GPL running on almost any operating system.

Modbus is also available there. The basis for Modbus is this class.
http://pvbrowser.org/pvbrowser/sf/manual/rllib/html/classrlModbus.h tml
(Please remove the spaces from the above URL)

You do not need to go into programming for Modbus communication. Filling out a ini file is enough.

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2010 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.


Fortune
You could get a new lease on life -- if only you didn't need the first
and last month in advance.