Maker Pro
Maker Pro

Creating a Customized MODBUS Program for a Remote Terminal Unit

Lei Reyes

Jul 2, 2014
60
Joined
Jul 2, 2014
Messages
60
Hi Everyone,

I have here a unit of King Pigeon S275 Remote Terminal Unit..
this RTU has communication modules for GSM, GPRS and TCP/IP (via RJ45 connection)
I can also communicate with this RTU by connecting it to my computer via USB .

The Manual I uploaded in this link...
https://www.mediafire.com/?gnfzfz5l7pess1p

This RTU can be configured using a configurator Software that is included in the purchase. By using that configurator software, you can also see the data/readings of all sensors connected to it, you can also see the status of all Digital Input/contacts connected to the RTU...

I have been researching about MODBUS the past days and I would like to create my own MODBUS program so that the S275 RTU can also send the sensors' data, or all the I/O data to my own program....

However ... I still do not know where I can start ...
Can I make this Modbus Program
1. using VB?
2. using PHP?

What other parameters do I need to know ?
and tutorials for making this modbus software...

I also uploaded here the S275's;
1. GPRS Custom Protocol
2. MODBUS TCP Handshake Communication Protocol
3. Register Address

Thanks
 

Attachments

  • MODBUS TCP Handshak Communication Protocol 20150308.pdf
    155.8 KB · Views: 77
  • S27x GPRS Custom Protocol 20150308.pdf
    329.9 KB · Views: 153
  • S27x Register Address 20150308.pdf
    158.2 KB · Views: 86

Amar Dhore

Dec 2, 2015
129
Joined
Dec 2, 2015
Messages
129
Yes, you can write Modbus program using any language as long as you can access the Serial Port (you can use rs485 to USB). The best way to learn about Modbus is, to go through the Modbus specifications at modbus.org. There are some free source codes available. If you search freeModbus on sourceforge.com, that is great way to understand Modbus.

Before you implement, you should know if the device you wish to talk is a Master or Slave (if its RTU).
You need make sure that both slave and Master has the same Baud rate. How much the distance going to be between Master and slave?
 

Lei Reyes

Jul 2, 2014
60
Joined
Jul 2, 2014
Messages
60
Thank you for the head-start information. Master or slave? In my perception I think it is a slave because I intend to use it such that it reports all its sensor readings to my central server...

The distance would be approximately 3Km .. I am going to use a radio antenna for point-to-point communication between the RTU and my server.
 

Amar Dhore

Dec 2, 2015
129
Joined
Dec 2, 2015
Messages
129
I think I misread your Post. Modbus RTU is a Modbus over serial. If you are planning for Modbus TCP/IP, what you have to know is:
1. Who is going to send a request (it would be Client)
2. The one who sends a response to a request will be a server.

The best way for this is, use Berkeley socket. Server will have to open a socket and listen on a port 502. It will accepts a new client.

Server: socket() --> bind() --> listen() --> accept(): block all connection until there are connection available from client

Client will connect to the server by using server's ip address.

Client: socket() --> connect(): --> connection establishment to server

The Modbus frame is pretty similar to the modbus RTU.

* <------------------------ MODBUS TCP/IP ADU(1) ------------------------->
* <----------- MODBUS PDU (1') ---------------->
* +-----------+---------------+------------------------------------------+
* | TID | PID | Length | UID |Function Code | Data |
* +-----------+---------------+------------------------------------------+
* | | | | | |
* (2) (3) (4) (5) (6) (7)
*
* (2) ... MB_TCP_TID = 0 (Transaction Identifier - 2 Byte)
* (3) ... MB_TCP_PID = 2 (Protocol Identifier - 2 Byte)
* (4) ... MB_TCP_LEN = 4 (Number of bytes - 2 Byte)
* (5) ... MB_TCP_UID = 6 (Unit Identifier - 1 Byte)
* (6) ... MB_TCP_FUNC = 7 (Modbus Function Code)
* (7)
*
* (1) ... Modbus TCP/IP Application Data Unit
* (1') ... Modbus Protocol Data Unit

Hope its helpful.
 
Top