Intercepting RS485

Hello Forum,

I have a device that receives data from sensors and sends it to a GSM module via RS485. I need to intercept this signal, alter some of the contents and send it on to the GSM module.

Is this possible? What hardware do I need to achieve this?

This may help

http://forum.arduino.cc/index.php?topic=14085.0

You need two RS485 buffers - one to receive the existing data and feed it into processor.
Then a second to make a standalone network with your processor and the GSM module so the GSM module can’t react to to the original network data.

Here’s an article on RS485.

And another on RS232, RS422, RS485 standards.

MAXIM AN763 Guidelines for RS485 wiring.pdf (247 KB)

Selecting and using RS-232, RS-422, RS-485 Serial Data Standards AN723.pdf (251 KB)

In general you have to cut off the existing connection, and insert an Arduino with two Serial devices and RS-485 line drivers. I'd suggest an Arduino Mega, which comes with multiple Serial devices in hardware. Smaller controllers would require the SoftwareSerial or similar library, which are all very limited in transmission speed (at most 32kBaud) and do not normally allow to listen on multiple Serial connections at the same time.

Then listen to both Serial devices, and analyze the incoming data packages. Modify the data as required, and send it to the other Serial device.

In half-duplex transmission (2 wires only) you'll have to turn on the transmitter before sending data, afterwards issue a flush() command to empty the transmit buffer, and turn it off again.

The Arduino DUE USART supports RS485.

Sam3x datasheet extracts :

  1. Universal Synchronous Asynchronous Receiver Transmitter (USART) The USART supports specific operating modes providing interfaces on RS485 …

35.2 Embedded Characteristics RS485 with Driver Control Signal …

35.7.6 RS485 Mode The USART features the RS485 mode to enable line driver control. While operating in RS485 mode, the USART behaves as though in asynchronous or synchronous mode and configuration of all the parameters is possible.

BTW there are 4 USART available.

Is the DUE able to deal with both incoming and outgoing RS485 signal at the same time?

Would this be RS485 connected directly to the board or via a TTL converter?

You still need an RS485 chip - the RS485 mode on the Due just provides hardware support for the control line that tells the RS485 chip whether to be in send or receive mode (rather than having to do it in software). RS485 is half duplex. You cannot send and receive at the same time with any RS485 device.

With RS485 chip you mean like MAX485?

Or will one UNO and two RS485 shields do the trick?

http://www.ebay.co.uk/itm/Tinysine-RS232-RS485-Shield-For-Arduino-Convert-UART-to-RS232-or-RS48-/132060117244?hash=item1ebf6578fc:g:poYAAOSwA3dYhFW4

heinburgh: With RS485 chip you mean like MAX485?

Ya - or equiv. Many vendors make similar ICs

heinburgh: Or will one UNO and two RS485 shields do the trick?

http://www.ebay.co.uk/itm/Tinysine-RS232-RS485-Shield-For-Arduino-Convert-UART-to-RS232-or-RS48-/132060117244?hash=item1ebf6578fc:g:poYAAOSwA3dYhFW4

You want something with two hardware serial ports unless you're content to work with software serial for one of them. A mega2560 or a 1284p based board would be suitable, for example. Or even an attiny841 or 1634 (both of those have 2 serial ports too). Doing it with software serial might actually work okay, since the whole thing is half duplex... I'm uncomfortable with the level of documentation provided with that shield. At most, it works on either the hardware serial port, or one set of pins for the software serial port (which pins, for example, isn't specified on that page...); I would favor a module that you connect with jumpers rather than the shields....

Hi, There are some easy-to-use modules available like THESE so you don't need to mount chips etc...|500x172

Another good information resource from Nick Gammon is HERE

Excellent resource by Nick Gammon! Why don't we use RS485 more? Seems very useful.

Line drivers (RS-232, RS-485...) are required for long distances only. For short distances the UARTs can be connected directly.

DrDiettrich: Line drivers (RS-232, RS-485...) are required for long distances only. For short distances the UARTs can be connected directly.

Yeah - TTL serial works fine for short distances, and saves cost and complexity.

RS232 is better for distance, and maintains the full duplex without extra wires.

RS485 is better still for distance (since it uses differential signaling) - but you only get half duplex with 2 wires; you need 4 for full duplex.

Hi, What do you want to change in the 485 data stream?

If it is one of the senors data, can you change the data at the device before it gets put on the 485 bus? Do you know the protocol, data construction of the 485 data stream?

Tom... :)

I have a piece of equipment that has a remote monitoring system attached. The company that I bought the equipment from places heavy limitations on me, the end user. If I have any adjustments to make, I am supposed to email the agent who I bought the equipment from. "IF" he is available at the time, he can change settings on it. If not, I simply have to wait. There is also a large amount of very useful data and settings to which I am not allowed access, only my agent is. Also, this data is sent to their server once every five minutes, so if I need to do a remote shutdown in case of emergency, it can take up to five minutes to take effect. Last reason - they charge me to access my own data. So I intend to access the data every few seconds, and upload it to my own server so I can create a real time scenario and take back my own.

In short - I need to bypass this ridiculous authoritarian system so I can have access to my equipment. I just hope there is no encryption involved.

heinburgh: I have a piece of equipment that has a remote monitoring system attached. The company that I bought the equipment from places heavy limitations on me, the end user. If I have any adjustments to make, I am supposed to email the

A description what the system does may be helpful.

heinburgh: In short - I need to bypass this ridiculous authoritarian system so I can have access to my equipment. I just hope there is no encryption involved.

Can you give more information about this authouriantation system ?

Authoritarian. Dictatorial. "You will do as you are told with the equipment that you bought from us. And we will limit what you may do with it."

It's a water pump. The signal that I intend to intercept and alter comes from the pump through a communications unit that connects to the web through a GSM module. One can change settings on the pump through this comms module (via bt or web) as well as get updates on current working pressure, pump motor rpms, etc. I intend to cut into this link where the comms module links with the GSM module, i.e. RS485.

My immediate question is, and I'm yet to open up the box and start cutting into wires, is it possible to simply monitor normal communication between the comms module and GSM module without altering their normal communication? I need to observe at first to see if there is any encryption involved, and what protocol is used before I go further. Ideally I would like to set up an Arduino with SD data logger to grab normal comms so I can analyze it.

Once this is done and it is not encrypted, and I'm able to alter the data, then I'd like to start playing around with sending the data to my own server and unlock the full potential.

How do I listen to the normal "conversation"?

The GSM module used in this unit is:

http://www.gemalto.com/m2m/solutions/modules-terminals/terminals/bgs2t

(the RS485 model, not RS232)

heinburgh: Excellent resource by Nick Gammon! Why don't we use RS485 more? Seems very useful.

Huh? Its very commonly used. https://en.wikipedia.org/wiki/RS-485#Applications

MarkT:
Huh? Its very commonly used. RS-485 - Wikipedia

Interesting. Never knew it’s so commonly used, but I can see why.

I have this RS485 adapter (picture attached), can anyone tell me if it would be possible to use it to read traffic between the GSM module and host controller? If I simply T-off the existing wires and connect them to this adapter, would I be able to read the ongoing comms, or will the adapter’s presence interfere with the signal?

IMG_5944.jpg