Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide to get this working? #2

Open
Rasmus7700 opened this issue Aug 1, 2016 · 26 comments
Open

Guide to get this working? #2

Rasmus7700 opened this issue Aug 1, 2016 · 26 comments

Comments

@Rasmus7700
Copy link

Rasmus7700 commented Aug 1, 2016

Hello..
First of all - awesome project.... :)
i'm trying to understand the basics in this program - after this i wanna try to port it to the TIA Portal and the S7-1500/1200 (Seems like the program allmost can be compiled under a 1500 CPU) Has any of ya guys tried to compile this under the TIA portal and a 1500/1200 Controller?

Is there any guide or sample Siemens project where i can see how it works?

What's the difference between PUBLISH, WRITE and WRITESTRING - how to use the WRITE if i need to send a header and a value to a MQTT broker?

@CarstenMaul
Copy link
Contributor

Hi,

first of all - welcome :-)

  1. WRITE and WRITESTRING are helper functions, don´t use them.

  2. I did not compile it on TIA and used it with a S7-1500, but it should work. I will try it in the beginning of September, after my vacation.

  3. How to use this MQTT library:

There are 3 functions:
mqttCONNECT
mqttPUBLISH
mqttSUBSCRIBE

Those 3 functions are all you need to call to connect to a broker, send a message (publish) or subscribe to a topic.

Within your OB1 you need to call the main functionblock MQTT once.

Please refer to the sample program:
https://github.com/CarstenMaul/MQTT-Siemens-S7-300/blob/master/MQTT_Example.SCL

Check the MQTT data traffic via Wireshark (install Wireshark on the PC where you run the broker), if you want to debug the MQtt communication.

Read the readme of my project.

@CarstenMaul
Copy link
Contributor

Also if you are new to MQtt, play around with the Mosquitto broker and with the clients MQtt.FX or MQttLens. Debug the traffic with Wireshark and understand how MQtt has to behave on the network. Then start to play around with the S7 implementation.

http://mosquitto.org
http://mqttfx.jfx4ee.org
https://chrome.google.com/webstore/detail/mqttlens/hemojaaeigabkbcookmlgmdigohjobjm?hl=en

@RoanBrand
Copy link
Owner

Hi

I plan to put some priority on this soon. Get it working on TIA V13 and the S7-1200 & 1500 as well.
It also needs stress tests & documentation. I want to get this production ready.

@Rasmus7700
Copy link
Author

Thanks all... That sounds pretty awesome :) I'll start playing with it - in the beginning on a old 300 System - then maybe we can upgrade to a 1200/1500... If there's something i can help with, let me know - i'm pretty experienced PLC programmer - just not experienced with MQTT (yet)

@sonikreload
Copy link

Hi RoanBrand, awesome project!! I'm interested in this 1200/1500 compatibility. When you said you get it working on them, it means that this project can be used directly, or that you're working in a modified version for them?

@Rasmus7700
Copy link
Author

Hello @sonikreload - the project can't be compiled correctly under either 1500 or 1200, in the 1500 system it's small errors that needs to be corrected, about calling the Communication blocks, but unfortunately the S7-1200 doesn't support the old format ANY pointer - so the code needs to be changed in order to get this working.

I haven't tested on a S7-1500 yet - only what the compiler tells me

@sonikreload
Copy link

Thanks @Rasmus7700. We have some S7-1500 and an upcoming student with 2 available weeks to develop something in SCL related to Industry 4.0. Perhaps he can collaborate in this porting, it would be interesting to know if @RoanBrand or @CarstenMaul have advanced in this line to plan better his tasks ;)

@RoanBrand
Copy link
Owner

Hi I don't have anything yet. I plan to get it on here soon, maybe in 1-2 months. I don't have a new PLC but will try to get one. :(

Yes, it is would be a port of the code specific to that PLC range. I guess we would have multiple folder's for the library blocks in this repo for each PLC type.

You are welcome to contribute with pull requests to this repo.

@CarstenMaul
Copy link
Contributor

CarstenMaul commented Oct 15, 2016

Hi, we did some updates and I think we are close to a 1.0 version. I also think we should now work on a TIA version.

Also this project may need some style changes. I already included a Symbolic table template in an Excel file, because PLC programmers don´t like autocreation but manually assign block numbers into some task related number range.

The other task is the reduction of processing time.

Third task is to do some simplification.

@thestone92
Copy link

Hi, I'm new here and have not much experience. But I wondering how the MQTT Signal goes in the SPS. Over which Input?

Thanks

@AutoDoc1955
Copy link

My colleague and I have gotten this working on a S7-1500 and TIA Portal V14. We are not (yet) convinced of its practicality for our use (we are small OEM who jams every possible PLC memory location with data).
We have only done this as a proof of concept and are now abandoning it until our management gives us the green light to continue. At that point, we'll go through the code and see how much we can minimize the PLC memory footprint and execution time.

Thanks much to all who have come before us and built this logic.

@AutoDoc1955
Copy link

Today, my colleague has gotten an S7-1200 up and talking MQTT. We think the thing to do from here is to migrate the S7-1200 code back to the S7-1500 which will get both platforms running the same code. The S7-1200 code was modified to eliminate the ANY data type that S7-1200s don't know what to do with.

@ssalonen
Copy link

@AutoDoc1955 would it be possible to share this code for 1200? For example, as a fork of this project in github?

Best
Sami

@AutoDoc1955
Copy link

Yes, we will try to publish when we can, but are very busy with "real" work right now. As soon as I have some time I'll try to post up what we have. It's nowhere near being able to put out into the field, but it works. Please be patient. We are very busy these days.

@beckenc
Copy link

beckenc commented Jun 26, 2017

Hello... Awesome Project! Is it still alive?
I'm going to try it on a S7-300 with SimaticManager 5.1.

@ypramos1986
Copy link

Hi AutoDoc1955, I would like to test the port to the 1200, please, could you share? Does anybody else has been able to compile the code for the 1200?

Thanks...

RoanBrand pushed a commit that referenced this issue Jan 8, 2019
Update MQTT_Main_PN.SCL
@Faldrian
Copy link

So this may be a dead project...? I would be interested in running it on S7-1200 as well.
I tried importing the contents of the files step by step, but there are some differences in how they access DBs between 300 and 1200. So "Any is unknown" as a Data type and it does not recognize the any pointer struct...
:)

@bartjanisse
Copy link

bartjanisse commented Jun 25, 2019

Hi,

Take a look at The official Siemens MQTT publisher. I tried it myself on a S7-1200 and it works. Hope it will work for you as well. Here you can find it:

https://support.industry.siemens.com/cs/document/109748872/mqtt-publisher-for-simatic-cpu?dti=0&lc=en-WW

For PUB and SUB with a S7-1500 you could try these (created by Yu-wen Tang):

https://support.industry.siemens.com/tf/ww/en/posts/mqtt-client-application-example-for-simatic-s7-1500/188465?page=0&pageSize=10

And for the S7-1200:

https://support.industry.siemens.com/tf/us/en/posts/s71200-data-publish-subscribe-with-microsoft-azure-cloud-using-mqtt-protocol/187968/?page=0&pageSize=10

Kind regards

@Faldrian
Copy link

My Problem is that we have TIA Portal V13 and I can not load the Siemens MQTT Library and most of the linked examples (since they are V14 or V15) ... and have not found a way to extract the source code from the project files by hand to insert that into our TIA Portal. :-/

@bartjanisse
Copy link

Hi Faldrian,

If you allow me I could send you by private email the generated source files (V15.1) since these are free for use and modification.

@Faldrian
Copy link

Faldrian commented Jun 26, 2019

That would be awesome, so I could import those as external files to my TIA Portal V13 and create blocks from them. :)
If you could mail to (mail removed) it would be great. Thanks for the offer. :)

@bartjanisse
Copy link

Hi Faldrian,

To be sure, did you receive the files?

@Faldrian
Copy link

Yes, they arrived and I tried to import them, but TIA Portal was very picky, so I did try some things and did not respond immediately. Thanks again!

@PetersPlace
Copy link

few questions, i found your project and this is the first who looks ok, the siemens FB70Mqtt will not run in my plc since the lean needs agsend and ag receive
I downloaded the files to my old step7 5.5
Made a check if it compiles, i only remove M23.2 from the project
Import the source files in TiaPortal V14 en compile ok
I have a 315 2DP with 343-1 Lean
So prepared the connection as test to MQTT.fx mosquito broker test

I enabled DB70.con to true and the broker is connected.

But now iám a little stuck
Let say i want to send a
boolean status to mosuito
Real value temp

And then receive a command to set a bit

@Shtynder
Copy link

Hello, tell me the project is still alive? I have problems loading this code into tiaportal for programming the S7-300 controller. Could you please help me. Make a brief instruction for creating a project or post an example project. Thank you for earlier! The text is provided via an online translator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

14 participants