I'm trying to read data from Makel M600 model meter with ESP32. I use RS485 and IEC 62056-21. I send command to get device identification but serial monitor prints unreadable characters. mySerial.println("/?!<CR><LF>"); this is the command for device id,
if (mySerial.available()) {
String response = mySerial.readStringUntil('\n');
Serial.println("Received: " + response);
// Baud hızı değişikliği isteği gönderme
if (response.startsWith("/SAT")) {
mySerial.println("[DATA]050<CR><LF>");
}
// Aktif tüketim sorgusu gönderme
if (response.startsWith("/SAT")) {
mySerial.print("[SOH]R2[STX]1.8.0()[ETX][BCC]");
}
}
and this is the loop part.
The output is:
Received: ������
I'm new with ESP32 and Arduino so I hope you can help me.
Probably the mySerial speed is not the speed your Makel M600 is using.
No idea what that Makel is, but IEC 62056-21 has different modes, not all being ASCII, and there's a complex negotiaton phase in the communication. But this is not my knowledge, just some frightening warning.
Anyway, your current version will not work, as it reads half of the characters for your Serial log, the other half of the "characters" are transformed character by character into something like String("FF"); which is not what you want, even when you will get the correct data by the proper speed settings..