implement the wireless m-bus protocol on an STM32/CC1120 - stm32

I'm trying to implement the wireless m-bus protocol on an STM32/CC1120 system, but I can't find any useful documentation about the wmbus working principles or any implementation examples.
Can anybody, please, help me find some tutorials/docs/specs ?
Thanks :)

The wireless M-Bus protocol is a part of the european norm EN 13757.
There is a whole series of documents describing the different aspects of M-Bus. Part 4 is for wireless M-Bus.
You can buy the documents at beuth. You'll certainly need part 4 for wireless m-bus and part 3 for detailed decoding of the contained m-bus records:
EN 13757-4 (W-Mbus)
EN 13757-3 (Application Layer)
If you don't want to directly invest money, but learn about the basics, you may also want to have a look at the OMS (open metering system) specification which is for free and based on the wireless-m-bus protocol. Keep in mind that not every wireless m-bus meter is necessarily a OMS meter but it could still help getting you started into the subject.

http://en.wikipedia.org/wiki/Meter-Bus
I also found the description of M-Bus proto in docs for ODIN OD4110 energy meter. But the sources are hard to find. I also need one just to communicate and log the consumption.

There are several libraries available:
jMBus: supports wireless and is based in Java
Mbus4J: based on Java
libmbus: don't support wireless, only wires, based on C
Using one of these helps coming around knowing the full M-Bus communication protocol or buying the documents.

Related

Is it required to use an OPC Server to Communicate with Controllogix?

I'm wondering if for simply communicating with a PLC, like reading and writing tags, do I need all of the other heavy lifting that comes with an OPC-UA server?
I've tried writing a simple server in Python that talks to the PLC, but I get denied when requesting information from the PLC.
The Controllogix PLC I'm attempting to communicate with uses Ethernet/IP to communicate, so why doesn't a simple server/client script work? What is required exactly to communicate with an Allen Bradley PLC or PLC's in general?
There is quite a bit required to communicate with a PLC.
Each vendor has a driver, there are firmware compatibility considerations. Different protocols to think about.
OPC-UA makes it a bit more generic, but OPC-UA still has a set of things to work around when setting up communications.
Most of the OPC products I've worked with, needs to have their security adjusted to allow anonymous communication. It's generally bad practice to do this. (A network intrusion would be able to read/write to your automation layer) There is certificate signing and some encryption business that needs to be turned off if you're looking for simple communication. (Again, not a good practice but ok for learning)
After all that you have to have a notion of how your PLC is set up on your OPC server, there are channels, devices, namespaces etc. You'll point the OPC client to some opc.tcp://:
If you got this far you're almost done, I'm assuming your OPC server is running and has tags configured at this point. You can use your OPC-UA API to do a read. It can return just the value, or you can get an object back with tag health, timestamp, and a bunch of other data. Depends on the implementation. After that you can do subscriptions, writes...whatever else you need.
TLDR: OPC server not required, but may be the easiest method. Turn off security. (But turn it back on before exposing your control layer to the net)
I am also a little late to this conversation. If you are interested in coding your own solutions and don't want to use any of the commercially available standards, AdvancedHMI is a "mostly" open source solution written in VB.NET which is 100% free and provides communications to many different PLCs including the ControlLogix platform. Since I see you are programming in Python you may also be interested to know that the project does work under Mono on the Linux OS. I have used it to write gateways between EthernetIP and ModbusTCP and to pull data serially from OEM devices and push this data to a CLX PLC.
The forum is full of many helpful hints and is very active and supported.
Just trying to give you another option. DDE, NetDDE, FastDDE, OPC, DCOM, Suitelink.... These are all good, but mostly a pay to play adventure. As a programmer, it seems ridiculous to have to pay such an excessive amount of money just to talk to my hardware, IMHO. Sorry for the rant. Have Fun!
Update - Just wanted to also suggest the following open source project written in python:
https://github.com/dmroeder/pylogix
I have used this to write small programs for communicating with CompactLogix and ControlLogix. (Even to/from a RaspberryPi!)
Depends on several factors, if you want something simple to program you can opt for Modbus/TCP I think some AB PLC supports it without extra hardware.
However if you want something with more security for example for industrial use then OPC UA would be better choice but the programming has a complexity far higher than Modbus, even using the libraries of OPC Foundation or others. There is the option of using a commercial or free (if any) OPC UA server to save work, then you will need to program the client side only.
With Ethernet/IP it should also be possible, but the problem is that there is no clear specification and even different AB models talk different Ethernet/IP dialect ! , it is also far more complex to program than Modbus.
I am a little late to this discussion, but there are a couple commercial tools that make this a bit easier. The one that comes to mind for me when you say you are using python is Cogent's data hub. It is certainly not the cheapest tool out there, but they have already done all of the heavy lifting for PLC/PC communications & security.
If trying to read CLX data using Python, there are several open source implementations that will save you a lot of work. Such as this:
https://github.com/dmroeder/pylogix
If you use .NET and Visual Studio, you can use AdvancedHMI
to be able to read and write OPC Tags to ControlLogix platform is done via its communication Driver RSLinx. RSLinx acts as an OPC Server, it will need to be configured to communicate with the PLC and run on a networked PC on the same LAN. Several flavours of RSLinx are available (for WAN/VLAN also) but essentially this is the communications driver you need to talk to AB PLC's

similarities and differences between FIteagle and OpenIot frameworks

I m trying to understand better the two frameworks therfore i m trying to figure out the similarities and differences between FIteagle framework and OpenIot because both of the frameworks includes the same aims, the first one provides a testbeds environments which provide different resources to manage and communicate with and the second one provides the possiblity to connect to different sensors within a database cloud and it provide the ability to communicate with the sensors and to aply some IoT services on it. Does anyone has an idea about the two frameworks ?
Not being familiar with any of the above frameworks, I would say that eventually all IoT frameworks will focus on virtual markets in order to deliver industry-specific services. Consider transportation and smart grids - those are completely separate industries. for example, in transportation - geo analytics is much more important than in smart grids where meters tend to have fixed locations.
For those who are still interesting and making research in this area and looking for a detailed comparative and understanding of the two frameworks, I published a paper in this matter which contain a specific and a complete understanding of both frameworks. Since the paper is not uploaded yet to the internet Please get in touch with me in case you want to read it.
I will provide a link here as soon as I upload it.

Real time communication PC with PLC (protocol?)

Basically, I would like to creat my own piece of software something a la communication protocl between PC and PLC.
I would like to read real time values from PLC and display them in a table for example Data Base, OPC table, Excel and write to PLC from PC in real time mode as well.
The whole point is I would like to access this data via ethernet port. How I can do it ? I do not want to use 3rd party software. I want to create something my own.
Choose any programming languages like C#,VB.NET and use opcdaauto.dll ,it is free dll for OPC Foundation members
You can easily get the live data from the OPC
or use dll provided by the OPC Server which you are using
As already mentioned, OPC-UA is probably more preferable, otherwise, there are commercial libraries such as InGear and open projects on GitHub.
If you actually want to implement your own low level drivers, they will depend on the PLC manufacturer. For example:
If you are working with Allen-Bradley, you will have to implement Common Industrial Protocol (CIP).
If you are working with Siemens, you will have to implement S7 Communication (S7comm or S7 for short).
If you search GitHub for various search terms related to Allen Bradley CIP and Siemens S7, you will find many starting points for communicating directly with these controllers.

Simple examples/applications of Bayesian Networks

Thanks for reading.
I want to implement a Baysian Network using the Matlab's BNT toolbox.The thing is, I can't find "easy" examples, since it's the first time I have to deal with BN.
Can you propose some possible applications, (with not many nodes) please ^^ ?
Have a look at Tom Mitchell's "Machine Learning" book, which covers the subject starting with small, simple examples. I suspect there are many course slides you could access online which also give simple examples.
I think it helps to start with higher level tools to get a feel for how to construct networks before constructing them in code. Having a UI also allows you to play with the network and get a feel for the way the networks behave (propagation, explaining away, etc).
For example have a look at the free Genie (http://genie.sis.pitt.edu) and its samples, and/or the 50 node limited Hugin-Lite (http://www.hugin.com/productsservices/demo/hugin-lite) with it's sample networks. You can then check your BNT implementations to make sure they verify against the software packages.
Edit: I forgot to mention Netica which is another BN/Influence diagram software package which I think has the biggest selection of examples http://www.norsys.com/netlibrary/index.htm.

Network Communication Question

I would like to ask a question about network communication.
The Question is:
A server uses the socket interface on the Lunix platform,
and a client uses Winock on the Windows platform.
Can they communicate?
Explain briefly.
I guess the answer is NO.
I guess it is due to the compatibility between 2 different socket interface?!
But I am not sure my estimation is right or not.
So, I hope someone could give me some comments about this questions.
Thank you very much!
Not right at all.
The APIs are different, but both sockets create packets written to a standard format described in RFC 793 and lots of subsequent revisions and additions.
Follow that packet format, and implementations written for different platforms and in different languages will talk to each other.
This is the magic of the internet.