Electric meter with Arduino and RS485 module

I'm a Arduino newbie. I have an Electric meter with an RS485 output. I want to get the MeterID value over the RS485 module and the Arduino. I just have document from manufacturer.

Sent by computer : 68 99 99 99 99 99 99 68 01 02 67 F3 C3 16
Return from meter : FE 68 99 99 99 99 99 99 68 81 08 67 F3 A6 9B 34 4B 33 33 6F 16

My Arduino code:

#include <SoftwareSerial.h>

#define SSerialRX        10
#define SSerialTX        11
#define SSerialTxControl 3
#define RS485Transmit    HIGH
#define RS485Receive     LOW

SoftwareSerial RS485Serial(SSerialRX, SSerialTX);
byte request[] = {0x68, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x68, 0x01, 0x02, 0x67, 0xF3, 0xC3, 0x16}; 
int byteRead;

void setup()   
{
  Serial.begin(9600);
  RS485Serial.begin(1200);
  pinMode(SSerialTxControl, OUTPUT);
  digitalWrite(SSerialTxControl, RS485Receive);
  delay(20);
  Serial.println("Get Meter Address App");
}
void loop()   
{
  digitalWrite(SSerialTxControl, RS485Transmit);
  RS485Serial.write(request, sizeof(request));
  delay(2000);
  digitalWrite(SSerialTxControl, RS485Receive);
  delay(2000);
  if (RS485Serial.available()) 
  {
    byteRead = RS485Serial.read();
    Serial.println(byteRead, HEX);
  }
}

But Monitor show blank after show "Get Meter Andress App". I'm using combo Arduino Uno R3, MAX485 and Meter. My code is in C# below. I used the code before and it worked fine, but on the computer I use a COM port (Baudrate 1200, data 8bits, Parity EVEN, Stopbit 1) with an RS485-R232 converter:

#Send data
dataOUT = WriteData("68 99 99 99 99 99 99 68 01 02 67 F3 C3 16");
serialPort_Meter.Write(dataOUT, 0, dataOUT.Length);

#WriteData method
private static byte[] WriteData(string hex)
{
return hex.Split(' ').Select(s => Convert.ToByte(s, 16)).ToArray();
}

#Read data
private static string ReadData(SerialPort serial)
{
byte[] buffer = new byte[serial.BytesToRead];
serial.Read(buffer, 0, buffer.Length);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < buffer.Length; i++)
sb.AppendFormat("{0:X2} ", buffer[i]);
return sb.ToString();
}

I just have document from manufacturer.

These two lines are the only documentation you got from the manufacturer? Return that device, that's definitely deficiency enough to ask for a money back.

I'm using combo Arduino Uno R3, MAX485 and Meter.

You use the chip directly? Without any breakout board? Post a wiring diagram!

  digitalWrite(SSerialTxControl, RS485Transmit);
  RS485Serial.write(request, sizeof(request));
  delay(2000);
  digitalWrite(SSerialTxControl, RS485Receive);

You wait 2secs to activate reception again. Does your meter also wait 2 seconds until it sends the response? I doubt.

pylon:
These two lines are the only documentation you got from the manufacturer? Return that device, that's definitely deficiency enough to ask for a money back.

I'm sorry to make you misunderstand. They gave me a document including data frames format and configure connection when using RS485-232 converter with desktop. The above two lines are examples of sending to ask the meter ID and how the meter returns.

pylon:
You use the chip directly? Without any breakout board? Post a wiring diagram!

No. I'm using with RS485 module and concept like this picture https://i.stack.imgur.com/TNlLU.png

pylon:
You wait 2secs to activate reception again. Does your meter also wait 2 seconds until it sends the response? I doubt.

I don't know, because my .NET language code doesn't need it. But some people said I need to delay time for the circuit board to send completely. but if i delete it, the result is still empty.
Please guide me.

I'm sorry to make you misunderstand. They gave me a document including data frames format and configure connection when using RS485-232 converter with desktop.

And why didn't you post that document?

But some people said I need to delay time for the circuit board to send completely.

Bullshit. The SoftwareSerial code won't return before it had sent the last bit. If you used the hardware serial interface, you just have to add a Serial.flush() to wait exactly as long as the hardware needs to send the complete data out. But if anyone tells you to insert a delay() call he's simply wrong and did not understand the concept of a half-duplex serial connection.
In the 2 seconds you waited the meter might have sent up to 240 bytes of data back to you.

but if i delete it, the result is still empty.

Did you check that with the Serial Monitor of the IDE or with that strange C-anything program? Always check the Arduino part with the Serial Monitor, you can test your Windows programming experience later on when you know that the Arduino side works (and for the C# stuff this forum is the wrong place to ask for help).

  if (RS485Serial.available())
  {
    byteRead = RS485Serial.read();
    Serial.println(byteRead, HEX);
  }

You do know that this only returns you the first byte sent by the meter, don't you?

byte request[] = {0x68, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x68, 0x01, 0x02, 0x67, 0xF3, 0xC3, 0x16};

  RS485Serial.write(request, sizeof(request));
dataOUT = WriteData("68 99 99 99 99 99 99 68 01 02 67 F3 C3 16");
serialPort_Meter.Write(dataOUT, 0, dataOUT.Length);

Do you also know that the two codes do completely different things? The first one sends 14 bytes in binary out the SoftwareSerial interface. The second one (in my understanding) sends an ASCII string containing the hexadecimal representation of the above bytes separated by spaces. I hope you understand the difference.

pylon:

  if (RS485Serial.available())

{
byteRead = RS485Serial.read();
Serial.println(byteRead, HEX);
}




You do know that this only returns you the first byte sent by the meter, don't you?

I figured out the reason is because SoftwareSerial's default library does not support connection configuration. I use CustomSoftwareSerial and fixed it by connecting the required data bit, stop bit, ...

#include <CustomSoftwareSerial.h>

#define SSerialRX        10
#define SSerialTX        11
#define SSerialTxControl 3
#define RS485Transmit    HIGH
#define RS485Receive     LOW
#define LED13            13
CustomSoftwareSerial RS485Serial(SSerialRX, SSerialTX);
byte request[] = {0x68, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x68, 0x01, 0x02, 0x67, 0xF3, 0xC3, 0x16}; 
int byteRead;

void setup()   
{
  Serial.begin(9600);
  RS485Serial.begin(1200, CSERIAL_8E1);
  pinMode(LED13, OUTPUT);
  pinMode(SSerialTxControl, OUTPUT);
  delay(10);
  digitalWrite(SSerialTxControl, RS485Receive);
  Serial.println("Get Meter Address App");
  digitalWrite(SSerialTxControl, RS485Transmit);
  digitalWrite(LED13, RS485Transmit);
  RS485Serial.write(request, sizeof(request));
  RS485Serial.flush();
  digitalWrite(SSerialTxControl, RS485Receive);
  digitalWrite(LED13, RS485Receive);
}
void loop()   
{
  if (RS485Serial.available()) 
  {
    digitalWrite(LED13, RS485Transmit);
    byteRead = RS485Serial.read();
    Serial.print(byteRead, HEX);
    Serial.print(" ");
    digitalWrite(LED13, RS485Receive);
  }
}

You are right to say that it only returns the first byte but I only try to communicate with it successfully first and continue the next processing steps. Based on my code, it shows the desired string but only separate and concatenated bytes with the print statement without "ln".

How I can receive it fully once and then process it like the image above?

Based on my code, it shows the desired string but only separate and concatenated bytes with the print statement without "ln".

I have no clue what this sentence will tell.

How I can receive it fully once and then process it like the image above?

Where is this image from? Why didn't you post the manual although I asked twice for it? If you (or that manual if it gets posted) don't specify how exactly the data has to be transferred, we cannot help you.