LinuxMCE Forums

General => Feature requests & roadmap => Topic started by: Raginglynx on October 29, 2010, 09:38:59 pm

Title: Control PLC with LinuxMCE?
Post by: Raginglynx on October 29, 2010, 09:38:59 pm
Hi all!

I read in an old thread about this and wonder if there's been a plugin written for this.

Since I am in housebuilding-thoughts and like the idea of controlling my home in every way possible, and also to keep the costs for it down, I tend to draw to the PLC direction. Logic-diagrams is nothing new to me, but I have never programmed a plc myself, however, I intend to learn how to :)

As I've heard there are plc-systems with which it is possible to control almost everything in a household - and to a much lower price than other systems such as eib / knx, lcn etc.

One pointed me to linuxMCE as the perfect platform to control your house with - and that's why I'm here! :)

Does anyone know if there is a price-worth plc-system with dimmer-outputs, web-integration among other things that it's possible to control through linuxMCE?
Title: Re: Control PLC with LinuxMCE?
Post by: Marie.O on October 29, 2010, 10:02:17 pm
If I were you, I would do a real calculation on the cost and benefit of the KNX vs PLC especially in a new building.

One think that really keeps the costs for a LinuxMCE KNX install down, is the absence of room controllers. You still have the KNX switches if you want, to keep the system running when the PC is dead.

You will end up with around 50EUR per room for the switch, plus around 25-30EUR per light circuit, 35EUR for each blinds circuit. The system devices (IP/KNX gate plus KNX PSU) will run around 250-260EUR. Cabling is around 35ct per meter.

You will save on wiring costs (and complexity), and you are open to the future, for whatever kind of need might arise. And you have a proven, fast and reliable system.
Title: Re: Control PLC with LinuxMCE?
Post by: Raginglynx on October 30, 2010, 12:10:20 am
Isnt plc-systems like Automation direct also running without a pc?
I thought so. But I'm new to all this, so feel free to correct me :)

Anyway, thanks for the input :)
Title: Re: Control PLC with LinuxMCE?
Post by: Raginglynx on November 01, 2010, 06:53:07 pm
Oh, now I see what you mean :)

It's an industry plc-system I'm thinking on using. It would cost me around 7 Euro/channel. Cable should be able to come down to 20 Cent/m.

I will save a lot of money using that instead of Knx. In this I neither need the use of specific room controllers, since I will connect normal self-retracting light-switches to DI. And it has it's own CPU-unit, so it works independent of the pc in case of power-down.

So how can I make this communicate with the LinuxMCE best way possible?

Is it by adding it as a GSD-device? Or is there a better way maybe?

Thank you!
Title: Re: Control PLC with LinuxMCE?
Post by: hari on November 02, 2010, 11:48:17 am
knx does not depend on a pc either. You can also do some nice things as it is a bus system that also supports stars on the bus. Regarding the DCE device for interfacing PLC, I'd go for a c++ device instead of a GSD.

br Hari
Title: Re: Control PLC with LinuxMCE?
Post by: Raginglynx on November 02, 2010, 12:19:53 pm
OK :)

I really think that a standard like the KNX is a good thing and if money wasn't a big issue when being young and wanting to build a house close to a big city in Sweden I would definitely go for that system.

But such as it is now I find a plc system closer to my budget - and - in fact I really like that kind of programming it involves.

C++ you say. Many years ago I started learning a little C++, but that was only a scratch on the surface.. However I'm willing to dig into it and learn - I have many times thought of doing so, since it's a handy language to know.

Are there any instructions on the wiki of how to add an own device through c++ coding?
Are there any templates I can make use of?

Regards,
Raginglynx
Title: Re: Control PLC with LinuxMCE?
Post by: Raginglynx on January 17, 2011, 11:27:16 pm
Explained to someone who doesn't know much about LinuxMCE - what would the benefits be of making the plc a c++ dev instead of GSD?
I guess that c++ is more flexible, but others than that?

rgds,
Christian
Title: Re: Control PLC with LinuxMCE?
Post by: tschak909 on January 18, 2011, 12:29:01 am
Basically? some of the big points:

* GSD devices can only connect and communicate with a single RS-232 or TCP port (no UDP, no multiple ports)
* GSD Devices are single threaded

Those are the biggies.

-Thom
Title: Re: Control PLC with LinuxMCE?
Post by: FedExGuy on January 28, 2011, 08:01:53 pm
I think I can input a little on this subject, I am a senior electrical engineer for Fedex and have been working on industrial PLC systems for over 30 Years, I just recently setup a system of 15 MD's as a sort of HD billboard system that so far has been working very well.
I have been connecting this system to our PLC network so that it can respond to equipment status changes and to be able to tell when our equipment is running or not ( since while it's running there is far too much noise to hear ANY audio from the MD's at all - unless I used 500 watt amps at each location ).
We use ControlLogix PLC's here, they have TCP/IP and ControlNet interfaces which are used by the 28 PLC CPU's to communicate with each other and to provide User Graphic Display information. The PLC's also have an RS232 port which is what I decided would be best for my dcerouter to connect to the PLC system.
The serial port can be operated two ways as an OPC device which uses an industry standard protocol to query the PLC for data, or it can be run in an open user configuration - this is what I chose to use mainly due to the complexities of the OPC protocol and that I didn't need that level of communication.
What I have done is write a PLC Program ( relay logic ) that sends dcerouter type commands to the server using a GSD as the receiving end that converts the already text based commands to actual router commands, so far I have only run simple tests but all indications are that it will work perfectly.
The PLC program must when triggered by some event, produce a text output to linuxmce. it can also accept text input from linuxmce, I will most likely not be using it in that fashion since my billboard system does not produce any events that I wish the equipment to affected by.

I summary connecting linuxmce to a PLC via RS232 is definitely possible even without using a full OPC server. however I have seen several open source OPC servers out there maybe one could be used in linuxmce to give it built in PLC capabilities, I have to imagine there are more than a few people that could benefit from PLC type control.
Title: Re: Control PLC with LinuxMCE?
Post by: Raginglynx on January 28, 2011, 08:16:20 pm
Thank you very much!
Most interesting!

Do you think that communicating as a GSD would be sufficient to give and receive commands?
For one not up to date with C++ it would save a lot of time..

rgds,
Christian

PS. Could you by any chance send the ladder logic or an example of it showing how you sent text commands from the PLC-CPU?
Title: Re: Control PLC with LinuxMCE?
Post by: FedExGuy on January 31, 2011, 12:57:18 am
Yes a GSD works just fine for bi-directional communication between LinuxMCE and a PLC. We
use an RS232 to PLC connection here for high speed imaging barcode scanners at over 3500 packages per hour with no data loss at all.

I can definitely post examples of some of my PLC program on this forum, but better yet tell me what PLC your planning on using and I'll provide examples tailored to that system.

Title: Re: Control PLC with LinuxMCE?
Post by: Raginglynx on January 31, 2011, 08:57:31 am
Yes a GSD works just fine for bi-directional communication between LinuxMCE and a PLC. We
use an RS232 to PLC connection here for high speed imaging barcode scanners at over 3500 packages per hour with no data loss at all.

I can definitely post examples of some of my PLC program on this forum, but better yet tell me what PLC your planning on using and I'll provide examples tailored to that system.



That'd be even more great! Unfortunately I've chosen to go with an unknown Chinese plc-system - Kinco (Very cheap)

CPU's http://www.kinco.cn/en/prl.asp?aspid=4&c2id=18&c3id=53 (http://www.kinco.cn/en/prl.asp?aspid=4&c2id=18&c3id=53)
Expansion I/O's http://www.kinco.cn/en/prl.asp?aspid=4&c2id=18&c3id=38 (http://www.kinco.cn/en/prl.asp?aspid=4&c2id=18&c3id=38)
SW http://www.kinco.cn/en/download.asp?c1=1&c2=24 (http://www.kinco.cn/en/download.asp?c1=1&c2=24)

I don't know if it's compatible, maybe you do.. I've looked at their programming SW and they seem to use "ordinary" ladder logic (I haven't played much with plc, so I don't know what's actually ordinary or not :))

thanks!
//Christian
Title: Re: Control PLC with LinuxMCE?
Post by: yves on February 20, 2011, 09:13:29 pm
Hello,

I'm also interested in using LinuxMCE with a PLC.

I'm planning to use WAGO 750-841 PLC.

Thanks.
Title: Re: Control PLC with LinuxMCE?
Post by: tschak909 on February 20, 2011, 09:31:47 pm
So write a driver. We have all the tools in the source tree to do so.

-Thom
Title: Re: Control PLC with LinuxMCE?
Post by: tkteun on March 24, 2011, 03:52:57 am
If you start hacking protocols and such, maybe it's better to hack the bus protocols.

I've spent some time with Siemens S7's and I can tell you there isn't much to gain from using PLC's except as a failsafe.

It's much more interesting to be able to drive the external IO units like the ones on Profibus (tm), which is of course prohibited by licenses.
If you can engineer an open source profibus driver it would really become nice.
Most PLC's use a proprietary protocol for programming and debugging, but most can also communicate with others on a multiple master network or just control dumb IO units.

This way you can make/use any $5  'RS232 / RS485 converter'. Which still is the underlying technology for DMX512, Profibus, KNX, CAN and such...
Title: Re: Control PLC with LinuxMCE?
Post by: dcubox1 on March 29, 2011, 05:19:12 pm
Really interested in this post as I do a good deal of work with PLC's and OPC servers.
OPC is a really good option as it can make alot of different makes of equipment "talk" to each other.
Also you can buy PCB devices that you can get any type of data out via OPC http://embeddedlabs.com/servermodule.html

I am interested in the PLC programs that Fedex Guy has as I would love to see how he is doing this.
A good option I reckon for a PLC would be Allen Bradley Micrologix. It has the serial port and an ethernet port and you can expand the IO with various add-on cards.

I reckon if this method was explored it would be a great advantage to the LinuxMCE system.
Title: Re: Control PLC with LinuxMCE?
Post by: yves on November 08, 2011, 11:48:08 pm
Hello,

I'm currently in the process of writing a Modbus TCP driver to connect LinuxMCE to a PLC.

I have found a driver already written in C++ and in ruby, with source code.

Is there any simple method to compile the driver and copy it into a LinuxMCE directory or should I go through a DCE template ?


Considering OPC server as another option (instead of the driver), how can I connect LinuxMCE to the OPC server ?

Thanks
Title: Re: Control PLC with LinuxMCE?
Post by: tschak909 on November 09, 2011, 11:12:47 am
You have to create a DCE device to interface with our system, please do not duct tape it.

Please read the section in the wiki called Developing a DCE Device.

-Thom