1

I am trying to use the Neato xv11 lidar with an ESP32. This should output packets of 22 bytes with the starting byte 0xFA. The communication is 8N1 and the baud rate is 115200.

When I connect the Lidar TX to the ESP32 RX2 pin, I get data that does not make sense as I get the start byte every 9 (and sometimes 8) bytes. However, when I run the same code on an Arduino Nano, I get the correct 22 byte packages. I even connected both at once and logged the results in Putty. This is the data I got.

// Arduino Nano Code
void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}
void loop() {
  while (Serial1.available()) {
    Serial.println(Serial1.read(),HEX);
  }
}
// ESP32 Code
void setup() {
  Serial.begin(115200);
  Serial2.begin(115200, SERIAL_8N1, 16, 17);
}

void loop() {
  while (Serial2.available()) {
    Serial.println(Serial2.read(),HEX);
  }
}

ESP32

FA
A8
0
35
6D
11
17
71
3D
FA
A9
0
3D
12
97
12
10
D1
41
FA
AA
0
E1
E
14
12
E7
1F
FA
AB

Arduino Nano

FA
D8
74
35
6B
3
3D
1
7B
3
3B
1
8C
3
2B
1
9F
3
1C
1
A
1D
FA
D9
74
35
B2
3
3
  • try running Serial at a higher baud rate ... also try using if, instead of while Commented Dec 19, 2021 at 20:16
  • did you check the voltage of the communication? Commented Dec 19, 2021 at 21:43
  • I checked the voltage and tried voltage converters. The ESP32 still gets strange data. I also tried to use an if statement instead of while and that did not fix it. It is very strange behaviour. Commented Dec 20, 2021 at 2:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.