Communicating with sensor over RS485

Hi guys,

Bit of a challenge here, i recently purchased a sensor online and i wanted to use my arduino to communicate with it.

It uses RS485 protocol and i have attached the datasheet below.

i am using a max485 breakout.

i have tried the following code without success:

int enablePin = 8;  // DE and RE tied to pin 8

byte msg [] = {
    0xFF,    
    0x03,   
    0x00,    
    0x00,
    0x00, 
    0x01, 
    0x91,
    0xD4// end byte
};

void setup()
{
  Serial.begin(9600);            
  pinMode(enablePin, OUTPUT);
  delay(10); 
  digitalWrite(enablePin, HIGH);  
}

void loop()
{
    for (int i = 0; i < 8; i++) 
    {
    Serial.print(msg[i], HEX);
    }
    delay(5000);
}

i used a software to communicate over a USB to rs485 converter and i was able to get a result (screenshot below)

can anyone assist me with this?

Your device communicates in binary, not hex.

So what do you recommend i do to communicate with the device?

aarg:
Your device communicates in binary, not hex.

Serial.write();

i have tried using serial.write() and i still get no response

Isaac258:
i have tried using serial.write() and i still get no response

That is nothing that anybody here can help with, unless you provide a lot more information. What "response" are you expecting?

Please show us the wiring. int enablePin = 8;  // DE and RE tied to pin 8it is actually ED and !RE so you set it to 'drive' that seems to be what you what you want to do. If you want us to look at pictures, please right click on the attachment that you send, select 'copy link address' modify your post, click on the picture icon and past the link there. So we don't have to download the picture.

if you want to receive, both enable pins !RE and DE must be LOW.

Legends guys! thankyou so much!!!!!