Communication between Arduino and PID module with Profibus

Hello, I need help to communicate an Arduino Mega and a TRS Fieldbus(PID module).

I want to be able to communicate an Arduino to a PID module(TRS Fieldbus - TRS Fieldbus Technical Information ), I have a problem because this PID module works with a Profibus interface using RS-485 standard, which I have never used, so I have many doubts of how can I get a communication between these, due to the technical information of the module is really vague.

I have been researching about this topic but I have not found much yet, I have read about using a RS-485 circuit with a MAX485 but Im not really sure if that would be enough.

I also found this work Design of an Arduino based low-cost error generator for PROFIBUS DP but they dont really dig into the communication process they used.

If anyone could help me on this matter I would really apreciate it.


RS-485 is a serial line interface, like RS-232 or RS-422. It does not affect the transferred data, only the logic levels on the signal lines. It can be used for half and full duplex connections, where full duplex means transmission in both directions at the same time, while with half duplex the transmission direction of a single line has to be switched in code. You connect the RS-485 line driver module to a serial port (Rx/Tx), e.g. Serial or a SoftwareSerial port.

If the connected module uses half-duplex, and you don't know when to switch the direction, leave it in receive direction, and switch to transmit direction only while you send data in code.

I'm not sure about the Fieldbus protocol, but it looks to me like messages of 6 bytes are transmitted by the master or slave. Make sure to select the right baudrate, then use the serial read() and write() methods to transfer the bytes.

Hi DrDiettrich, thank you for your help and sorry for the late answer, I tried what you said, following another topic on this forum I connected the Arduino to the PID modulo using a MAX485 like in this picture:

As I investigate, it appears that the slave would recognize the master baudrate and work with it, so I made the following code to try to send and receive the 6 bytes message:

const int ledPin =  13;
const int ControlPin =  3; // HIGH:TX y LOW:RX

byte StatusTX = 0b00100000;
byte AdressTX = 0b00000001;
byte Data1TX  = 0b00000000;
byte Data2TX  = 0b00000000;
byte Data3TX  = 0b00000000;
byte Data4TX  = 0b00000000;

byte ControlRX = 0b00000000;
byte AdressRX  = 0b00000000;
byte Data1RX   = 0b00000000;
byte Data2RX   = 0b00000000;
byte Data3RX   = 0b00000000;
byte Data4RX   = 0b00000000;

void setup() 

  pinMode(ControlPin, OUTPUT);
  digitalWrite(ControlPin, HIGH); //RS485 in TX
void loop() 
    digitalWrite(ControlPin, LOW); // RS485 in RX
    ControlRX =;
    AdressRX  =;
    Data1RX   =;
    Data2RX   =;
    Data3RX   =;
    Data4RX   =;
    if(ControlPin, LOW)
      digitalWrite(ledPin, HIGH); // 

The way I see it in the technical information of the manufacturer( TRS Fieldbus - PBX 21 AXIS ) I have to send a 6 byte frame to the PID module indicating that the Master is ready so it can start sending information to the Arduino, at least that is what I understand from it.

So, I tried all of this but the only thing I receive is the number 3210000 only one time, I think that the way I am sending and receiving the 6 byte frame is wrong or something like that, so if anyone could help me through this will be awesome.

Thanks for your help.

Use Serial.write() to send the bytes in binary. Serial.print() transmits the bytes as text, in decimal or other encoding.