"Smart" GPRS modem and IdTCPServer lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- shyub · 2022-02-07 06:36 Hi. It is necessary to organize communication with level meters using a GSM network based on "Robustel m1000 pro v2" modems. However, these modems allow communication via the Modbus RTU protocol only between two points. And I have 13 sensors. The network protocol for TCP / IP modems. Can I create a multi-threaded chat server based on IdTCPServer and poll sensors at a specified interval? As an alternative, I consider the components TTCP_UDPPort, TModBusRTUDriver and TPLCTagNumber from the PascalSCADA library. After all, such a problem is somehow solved ... ---------------------------------------------------------------------- MarkMLl · 2022-02-07 08:13 Can I just ask as a slight aside here: how much longer is GPRS supposed to work for? I get the impression that the operators are trying to railroad everybody onto Internet-style services even if they aren't really suitable for the application. MarkMLl ---------------------------------------------------------------------- PascalDragon · 2022-02-07 12:34 Quote from: MarkMLl on February 07, 2022, 09:13:05 amCan I just ask as a slight aside here: how much longer is GPRS supposed to work for? I get the impression that the operators are trying to railroad everybody onto Internet-style services even if they aren't really suitable for the application. I think GPRS will be with us for quite some time as that is part of GSM (also there are many embedded solutions that do use GPRS, so that might provoke some problems otherwise ). It was only UMTS that the operators really got rid of. ---------------------------------------------------------------------- MarkMLl · 2022-02-07 13:16 Quote from: PascalDragon on February 07, 2022, 01:34:54 pmI think GPRS will be with us for quite some time as that is part of GSM (also there are many embedded solutions that do use GPRS, so that might provoke some problems otherwise ). It was only UMTS that the operators really got rid of. That's my impression as well, and it's been pointed out that a very large number of units ("modems" etc.) has been integrated into e.g. personal alarms for the elderly. However I don't know where it fits into "5G". I'm very wary of any proposed technology that forces an endpoint to have separate subscriptions for both communications (i.e. with a GSM service provider) and Internet (with an ISP). I've seen too many cases where somebody has said "what's this 'phone bill for... it's not making outgoing calls so let's cancel it" and adding another type of account will only multiply the risk. (With apologies to OP for intruding on his thread, which is of interest to me as well.) MarkMLl ---------------------------------------------------------------------- Remy Lebeau · 2022-02-07 18:34 Quote from: shyub on February 07, 2022, 07:36:12 amCan I create a multi-threaded chat server based on IdTCPServer and poll sensors at a specified interval? Are the sensors acting as clients that connect to your server?  Do the sensors push data to the server at frequent intervals, or does the server have to actively poll them?  I'm not sure I understand what you are asking for exactly, or what "chat" has to do with sensors. ---------------------------------------------------------------------- shyub · 2022-02-08 04:58 I'm more concerned not about who will be the client, who is the server, but the ability to use the Robustel m1000 pro v2 smart modem with a regular modem and the ability to use Indy or PascalSCADA components on the side of a regular modem. Here is the description of the modem: https://www.robustelanz.com/assets/files/ProductsPlatform/Product/M100 0/UG/RT_UG_M1000%20Pro%20V2_v.2.1.1.pdf ---------------------------------------------------------------------- af0815 · 2022-02-08 06:20 Quote from: shyub on February 08, 2022, 05:58:18 am... but the ability to use the Robustel m1000 pro v2 smart modem with a regular modem and the ability to use Indy or PascalSCADA components on the side of a regular modem. ... The m1000 is very multifunctional. But what kind of connection do you want to use ? Are you connection local over RS232/485 or over the phone modem with TCP (and there what kind of protocol) ? Indy (maybe synapse too) will be a good choice for connection over tcp. PascalSCADA (and other ModBus implementation) will be good if you want to use modbus over tcp or serial cable. But you must decide what kind of communication you prefere. ---------------------------------------------------------------------- ccrause · 2022-02-08 06:37 Quote from: shyub on February 08, 2022, 05:58:18 amI'm more concerned not about who will be the client, who is the server, but the ability to use the Robustel m1000 pro v2 smart modem with a regular modemThe user guide states that this modem can connect to a public IP address, or accept an tcp/ip connection. So I don't see a problem with using a regular modem on the "other" side of the tcp/ip connection. Quote and the ability to use Indy or PascalSCADA components on the side of a regular modem. Here is the description of the modem: https://www.robustelanz.com/assets/files/ProductsPlatform/Product/M100 0/UG/RT_UG_M1000%20Pro%20V2_v.2.1.1.pdf Both the m1000 and PascalSCADA supports Modbus TCP, so that combination should work (I haven't tested this). ---------------------------------------------------------------------- ccrause · 2022-02-08 06:52 Quote from: shyub on February 07, 2022, 07:36:12 amHowever, these modems allow communication via the Modbus RTU protocol only between two points. And I have 13 sensors. Just thinking out load here: You can configure the m1000 as a modbus gateway (RTU <-> TCP). On the remote side, connect using modbus TCP protocol, the m1000 will handle the conversion to RTU on the sensors side. Also note that modbus can address different devices, so if the sensors are physically close, you can connect multiple sensors to the same RTU bus and use a single m1000 modem. Note that I'm no modbus expert ---------------------------------------------------------------------- avra · 2022-02-08 09:15 Quote from: shyub on February 07, 2022, 07:36:12 amIt is necessary to organize communication with level meters using a GSM network based on "Robustel m1000 pro v2" modems. However, these modems allow communication via the Modbus RTU protocol only between two points. And I have 13 sensors.Are you aware that MODBUS RTU is single master multi slave protocol, and that master can normally talk with up to 32 slaves on RS485, and only with one slave on RS322? That means that if you have 13 sensors with RS485 MODBUS RTU slave functionality - single master can read all of them if each has a unique address. QuoteRobustel GoRugged M1000 Pro V2 is a rugged serial to cellular gatewayAre you aware that such a gateway can expose MODBUS RTU network in several ways, like TCP/UDP port (your app needs to talk MODBUS RTU protocol over TCP or UDP), like MODBUS TCP (you app needs to talk MODBUS TCP), or like virtual COM port (your app needs to talk MODBUS RTU over serial). This gives you many options to choose from, like using standard socket programming, some MODBUS TCP library, or some serial port or even better MODBUS RTU library. So you need to decide first which way to go. Quote from: shyub on February 07, 2022, 07:36:12 amCan I create a multi-threaded chat server based on IdTCPServer and poll sensors at a specified interval? As an alternative, I consider the components TTCP_UDPPort, TModBusRTUDriver and TPLCTagNumber from the PascalSCADA library.If I had to do it then I would make a communication thread with a loop that would poll sensors one by one over MODBUS TCP. Your mileage may vary... Usefull MODBUS links: https://forum.lazarus.freepascal.org/index.php/topic,57438.msg427071.h tml#msg427071 https://forum.lazarus.freepascal.org/index.php/topic,47289.msg338572.h tml#msg338572 https://sourceforge.net/projects/pascal-modbus/ https://www.pascalscada.com/modbus-rtu-and-tcp/ ---------------------------------------------------------------------- Remy Lebeau · 2022-02-08 19:02 Quote from: af0815 on February 08, 2022, 07:20:01 amIndy (maybe synapse too) will be a good choice for connection over tcp. PascalSCADA (and other ModBus implementation) will be good if you want to use modbus over tcp or serial cable. With some extra effort, Indy can be used with a non-IP transport, like a serial port.  You just need to write (or find) a custom TIdIOHandler-derived class that wraps the relevant APIs for opening the connections and reading/writing data.