Page 1 of 1

Serial Gateway

Posted: 12 May 2020, 07:56
by RMeissnerCC
Dear all,
I have browsed through this forum and some of the documentation on the Serial Gateway, e.g.: "https://www.kunbus.com/serial-rx-gateway-module.html", and the Scripter, e.g.: "https://www.kunbus.com/files/media/scri ... -UM-EN.pdf".
In our application we have to read multiple times each second a value from modbus and send it through a serial interface to a PID controller. We use the RevPi Core 3+ Modbus RTU Master with an USB-to-RS485 adapter. The serial interface works through another USB-to-RS485 adapter supplied by the manufacturer. Now, we have also the possibility to directly connect to RS485 on the PID controller.
Could we use a Serial Gateway to connect to that PID controller?
The manufacturer of the PID controller has a rather complex format to be send via serial. It is still just a string of bytes, but combines a lot of different informations, e.g., a sequence counter which is incremeneted on each call and a CRC checksum.
Is it possible to do this with the scripter?
Would this gateway give us access to the data similar to a DIO/AIO module? We use revpiomodio2 in python, i.e., we access those values by "revpimodio.io.O_1.value".
Best, Robert

Re: Serial Gateway

Posted: 12 May 2020, 13:42
by dirk
Hi RMeissnerCC, this is an interesting question. Yes you can use the Scripter and the Modular Gateway Serial.
So you are thinking about the following setups:
a) [Sensor - RS485] - [Modular Gateway Serial] [RevPi Core 3+]
b) [Sensor - RS485] - [USB-RS485] [RevPi Core 3+]

Parsing
a) you have to parse the values using the Scripter but you have the values in the process image
b) you have to parse the values using i.e. Python. You could then use i.e. a virtual module to put these values to the process image.

Error Handling
a) you have to implement i.e. a state machine - with the scripter
b) you have to implement i.e. a state machine - with python

Modification
a) you have to use the PiBridge USB adapter
b) you edit i.e. the Python script

Well, it is up to you but I would prefer using a USB-RS485 interface and avoid using the Scripter and the GW Serial module

Re: Serial Gateway

Posted: 12 May 2020, 14:15
by RMeissnerCC
Hi Dirk,
option b) is what we already build. Our problems with that is that:
1) we sometimes lose connection because the USB hub fails/disconnects
2) Reading those serials commands is very slow and blocks everything else.

So if we gain speed and do not have to take care of the connection then the hazzle with the Scripter might be worth it.

Is there something we would need to look out for if we use the serial gateway? Is it possible to have two gateways? We have the same serial controller twice.
Best, Robert

Re: Serial Gateway

Posted: 12 May 2020, 15:57
by RMeissnerCC
I just realized I can daisy chain my two controllers, so I currently just need one USB-to-RS485 adapter. Potentially this way I also only need one serial gateway.