Jump to content
borisv

GMT PLC connect to MQTT broker

Önerilen İletiler

Hello all,

I am sorry for writing in english but i don't know turkish.

Is it possible to connect 396 or 496 plc to my own mqtt broker ?

i tried changing the ip adress in WMI SCADA web configuration but i cannot connect the plc to my broker. 
I saw a post by user VKU that says he was succesful but i cannot make it work.
i am currently trying with 396 plc but i have a 496 also that i can use.

 

I hope that english is not a problem.

 

Thanks in advance

 

Yorum bağlantısı
Sitelerde Paylaş

I could not make a success connecting 396T PLC via my own broker on my PC.  As Hanifi Bey explained the PLC does not allow customer broker.

But I may suggest another way to read/write Modbus addressed values between 396T PLC and PC. 

VS 2019 Community, NUGET EasyModbusTCP by Stefan Roßmann.

Imports EasyModbus
Public Class Form1
 Public Mb(10) As Boolean  = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 Public Mw(3) As Integer  ' 04x0001 ...

' Use a radio button to connect PLC via local ethernet IP
' TbxPLC_IP.Text holds PLC IP Addr.
Private Sub RB_F1_ON_Click(sender As Object, e As EventArgs) Handles RB_F1_ON.Click
 TcpClient_1 = New EasyModbus.ModbusClient(Convert.ToString(TbxPLC_IP.Text), 502) ' PLC
 TcpClient_1.Connect()
End Sub

' use a Timer with 200ms interval
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
  ' EasyModbus lib supports discrete connection. So, every time to read/write values make a new connection
 TcpClient_1 = New EasyModbus.ModbusClient(Convert.ToString(TbxPLC_IP.Text), 502) ' PLC
 TcpClient_1.Connect()
 If TcpClient_1.Connected Then
 ' for coils
 Mb = TcpClient_1.ReadCoils(0, 7) ' Coil 0 .. 6 -> adres 1..7

' for holding Regs
 Mw = TcpClient_1.ReadHoldingRegisters(0, 2)

 End If
End Sub
End Class

Yorum bağlantısı
Sitelerde Paylaş

I already have a Home Assistant server running the plc's in my workshop over TCP modbus and it is working very stable for a 6-7 months. I can share some info if you like.
 

But i wanted to connect gmt plc's from outside my shop to my server and when i read that they support MQTT i was very happy for a while, guess im back to square one on that.

I also have a semi working micropython build for  396T that supports networking and IO and i am in the process of porting flash memory, but i am not sure if the staff will allow me to share that here. If i am given the blessing of hanifi i will share most of what i know.

 

Yorum bağlantısı
Sitelerde Paylaş

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Misafir
Bu konuyu yanıtla

×   Yapıştırdığınız içerik biçimlendirme içeriyor.   Biçimlendirmeyi Temizle

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Önceki içeriğiniz geri yüklendi.   Editör içeriğini temizle

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Yeni Oluştur...