Modbus request

I’m trying to learn how to talk to my modbus slave by trying to do a simple request and then build the software up
bit by bit. I’m using a max485 wired w/ an uno card. The wiring is the basic seen all over the internet, namely
Max - UNO
RO to RX
DO to TX
RE and DE tied together and controlled from pin 3 on the uno. I do have a terminating 27ohm resister across A and B as per the max485 data sheet.

Power and GND and A and B going to A and B on the modbus device. I do have the uno GND going to the GND on the modbus
device. I can see the request going out over lines A and B, but I get no response. Voltages from GND to A ~ 3.4v,
from GND to B ~1.4v.

Note: I tried a USB -RS485 cable with the FTDI chips and vendor software (checked slave address, comm parameters) to the modbus device and it works ok. So i know the unit is good. I’ve seen other users use this configuration and their designs seem to work, so I believe my wiring is ok. The software, I think is simple enough to get a single response; unless I’m just really missing something.

Any help from an Arduino / Modbus / Programming God would be met with a candle burning under their picture in my living room.

Kind Regards, HuaTian.

//Slave addr is 1, query coil 3, addr 9c45, 1 register
byte message = {0x01,0x03,0x9c,0x45,0x00,0x01,0xbb,0xef}; // ← Query holding register w/ a valid CRC.

char inBound;

void setup() {
pinMode(0,INPUT); //RX
pinMode(1,OUTPUT); //TX

void loop() {
digitalWrite(3,HIGH); //Tx
Serial.write(message,sizeof(message)); //Send message
digitalWrite(3,LOW); //Rx should receive something / anything

if (Serial.available() > 0 )
{ inBound =;
delay(1000); //Wait 1 seconds for Modbus to respond

  pinMode(0,INPUT);    //RX
  pinMode(1,OUTPUT); //TX

Pins 0 and 1 belong to the Serial instance. They do not need for you to diddle with them. So, don't.

  if (Serial.available() > 0 )
  { inBound =;

Are you using the Serial port to talk to the modbus device OR the PC? Both is the wrong answer.

I am sending the data down the pin 1 (Tx) via the serial write function, then reading a response from pin 0 (Rx). Those pins are connected to the max485 IC.

I am sending the data down the pin 1 (Tx) via the serial write function,

Yes, you are:

   digitalWrite(3,HIGH);   //Tx
    Serial.write(message,sizeof(message));  //Send message
   digitalWrite(3,LOW);   //Rx should receive something / anything

then reading a response from pin 0 (Rx).

Yes, you are:

  if (Serial.available() > 0 )
  { inBound =;

But, then, what are you doing?


Where is this supposed to be going?

Trying to read the return value from Rx line. Maybe I’m not understanding something.

I’m assuming: I write to the Tx line - it goes over the max485 (i can see the requests) on my scope both A and B lines. Then read the response from the Rx line. I can see the request on my scope, but I never see a response either on the scope or the Rx.

Attached is how I have this connected without the pull up or pull down resistors.


:D Guys / Gals It's my birthday today :fearful: Everyone wishing me a happy birthday, they do not realize it sucks getting older.

A good gift would be some insight to this problem.

Hi all !!!,