Hello,
I am working with the LD8001B radar module, and I am having difficulty obtaining valid distance data over UART.
Setup:
- Microcontroller: Arduino Uno
- Communication: UART (TX0/RX0)
- Power supply: 3.3V - from arduino 5V + voltage divider with 1K, 2K resistors
- Baud rate: 115200
- BOOT1 (P19): GND
Observations:
-
The module powers on and sends data over UART.
-
I also observed boot-like messages such as:
- "Success jump to boot"
- "Boot Area Flash read done"
Issue:
- I am not receiving valid measurement frames
- I expected structured distance data, but instead I get error(?) or boot output
Additional test:
Measured Current <100mA, and which I am thinking is the main issue, since the datasheets require 1A.
Any guidance or example UART communication for arduino uno would be greatly appreciated.
Below is the code I used, found from a forum (https://forum.arduino.cc/t/how-to-hook-an-ld8001b/1296215/39).
Thank you in advance!
#include <SoftwareSerial.h>
SoftwareSerial mySerial(5, 4); // RX, TX
void setup() {
// Start the serial communication with a baud rate of 115200
Serial.begin(115200);
mySerial.begin(115200);
// Wait for the serial port to initialize
while (!Serial) {
delay(100);
}
// Hex string to send
String hex_to_send = "FDFCFBFA0800120000006400000004030201";
sendHexData(hex_to_send);
}
void loop() {
// Read and print serial data
readSerialData();
}
void sendHexData(String hexString) {
// Convert hex string to bytes
int hexStringLength = hexString.length();
byte hexBytes[hexStringLength / 2];
for (int i = 0; i < hexStringLength; i += 2) {
hexBytes[i / 2] = strtoul(hexString.substring(i, i + 2).c_str(), NULL, 16);
}
// Send bytes through software serial
mySerial.write(hexBytes, sizeof(hexBytes));
}
//read and print as HEX
/*
void readSerialData() {
while (mySerial.available() > 0) {
byte b = mySerial.read();
if (b < 0x10) Serial.print("0");
Serial.print(b, HEX);
Serial.print(" ");
}
}
*/
void readSerialData() {
// Read and print data from software serial
while (mySerial.available() > 0) {
char incomingByte = mySerial.read();
Serial.print(incomingByte);
}
}