Free Modbus Driver in .Net

S

Thread Starter

Stephen McLain

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.
 
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.
 
S

Stephen McLain

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.
 
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.
 
S

Stephen McLain

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
 
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
 
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
 
> 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!
 
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.
 
M

Mustafa Al-mosawi

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
 
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.
 
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.
<i>Thanks</i>
 
Dear Stephen,

I know you've posted 3 years ago but your text is a very interesting and important subject. I'd like to know if you reach your goal, that is, did you develop the MODBUS drivers by your own? I'm asking you because I'm facing the same problems and I agree to you when you said that the best manner to solve such problem, some times is to do the job by yourself. So, if you can, please gimme some tips in order to help me to build my MODBUS TCP drivers by my own. I use to develop in C Builder and Delphi but any help will be very welcome!

Thanks in advance!
Xavier
 
Hi,

I know for you its long time back but i am also held in situation like need to start from scratch.

I need to create application which can talk on modbus with field device. not sure from where to start need your guidance.

Thanks in advance.

Niks,
Email- [email protected]
 
Top