# K-LD7 with Arduino uno

**URL:** <https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781>\
**Category:** General Guidance\
**Created:** [October 30, 2023, 12:51pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781 "2023-10-30T12:51:45Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kokm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kokm/32/1011475_2.png) [@kokm](https://forum.arduino.cc/u/kokm)\
**Post date:** [October 30, 2023, 12:51pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/1 "2023-10-30T12:51:46Z")

</div>

![6](https://europe1.discourse-cdn.com/arduino/original/4X/f/6/5/f658771647a0d77ebd3cf58d9e547e6aa5678be0.jpeg)  
I want to connect K-LD7 radar to Arduino uno.  
but I don't know what is my problem.... help me please.

this is a link to the datasheet of the K-LD7  
-\> [[RF Beam] DataSheet\_41. K-LD7 radar transceiver : CRAECA 판매 제품 각종 자료실](https://www.rndsuper.com/Resource-center/10850212)

and this is my code

```arduino
void setup() {
  Serial.begin(115200);
  mySerial.begin(115200);
}

void loop() {
  if (mySerial.available()) {
    byte header1 = mySerial.read();
    byte header2 = mySerial.read();

    if (header1 == 0x54 && header2 == 0x44) {
      byte distanceLSB = mySerial.read();
      byte distanceMSB = mySerial.read();
      uint16_t distance = (distanceMSB << 8) | distanceLSB;
      
      byte speedLSB = mySerial.read();
      byte speedMSB = mySerial.read();
      uint16_t speed = (speedMSB << 8) | speedLSB;
      
      byte angleLSB = mySerial.read();
      byte angleMSB = mySerial.read();
      uint16_t angle = (angleMSB << 8) | angleLSB;
      
      byte magnitudeLSB = mySerial.read();
      byte magnitudeMSB = mySerial.read();
      uint16_t magnitude = (magnitudeMSB << 8) | magnitudeLSB;
      

      Serial.print("Distance: ");
      Serial.print(distance / 100.0, 2);
      Serial.println("m");

      Serial.print("Speed: ");
      Serial.print(speed / 100.0, 2);
      Serial.println("m/s");

      Serial.print("Angle: ");
      Serial.print(angle / 100.0, 2);
      Serial.println("deg");

      Serial.print("Magnitude: ");
      Serial.print(magnitude / 100.0, 2);
      Serial.println("dB");
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [October 30, 2023, 1:01pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/2 "2023-10-30T13:01:44Z")

</div>

I moved your topic to an appropriate forum category @kokm.

In the future, please take some time to pick the [forum category](https://forum.arduino.cc/categories) that best suits the subject of your topic. There is an " **About the \_\_\_\_\_ category**" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in [the " **How to get the best out of this forum**" guide](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966). The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

---

<div class="post-metadata">

**Author:** ![Railroader](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/railroader/32/274550_2.png) [@Railroader](https://forum.arduino.cc/u/Railroader)\
**Post date:** [October 30, 2023, 1:26pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/3 "2023-10-30T13:26:01Z")

</div>

Using the advice in the link given in reply #2, You will post a link to the datasheet of the K-LD7?

---

<div class="post-metadata">

**Author:** ![kokm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kokm/32/1011475_2.png) [@kokm](https://forum.arduino.cc/u/kokm)\
**Post date:** [October 30, 2023, 1:34pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/4 "2023-10-30T13:34:46Z")

</div>

Sorry, this is my first post.  
Thank you for your advice.

---

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [October 30, 2023, 4:15pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/5 "2023-10-30T16:15:26Z")

</div>

@kokm welcome to the forum.

Software serial is not recommended for band rate of 115200.

The data sheet states the band rate is 34800, still perhaps a stretch for Softwareserail, but try it.

The data sheet says you are looking at 3.3 volt logic level serial communication, which means it can be wired to RX and TX on whatever serial port you rig up. You may need level translating for your 5 volt UNO.

Lastly it is not clear that the device will just send you information. At a glance, it seems like you may have to talk to it and ask it to tell you what you want to know.

Llastly lastly, it would be 100 percent easier to conduct initial experimentds with the device just using a terminal program and a USB to serial converter. no Arduino, no code to suspect. Of anything.

CoolTerm and PuTTY are two well-known and respectable terminal programs.

Get the device talking, worry about the UNO and all that other stuff until you can see it working.

HTH

a7

---

<div class="post-metadata">

**Author:** ![kokm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kokm/32/1011475_2.png) [@kokm](https://forum.arduino.cc/u/kokm)\
**Post date:** [October 30, 2023, 11:51pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/6 "2023-10-30T23:51:04Z")

</div>

Thank to your help!! I will try it.

---

<div class="post-metadata">

**Author:** ![kokm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kokm/32/1011475_2.png) [@kokm](https://forum.arduino.cc/u/kokm)\
**Post date:** [November 1, 2023, 10:26am UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/7 "2023-11-01T10:26:23Z")

</div>

I've tried, but nothing appears on my serial monitor. Should I consider switching from the Arduino Uno to another option?

---

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [November 1, 2023, 11:21am UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/8 "2023-11-01T11:21:17Z")

</div>

> [@kokm](#):
>
> I've tried, but nothing appears on my serial monitor

Tried what?

Please post the code and schematic from your experiment.

Show how all parts are connected, with attention to sources of power and how power gets to the parts that need it.

> another option?

It's not an UNO problem. You could try a terminal emulator.

Did you read the data sheet to determine what you need to do to get values from the device?

a7

---

<div class="post-metadata">

**Author:** ![kokm](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kokm/32/1011475_2.png) [@kokm](https://forum.arduino.cc/u/kokm)\
**Post date:** [November 1, 2023, 2:04pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/9 "2023-11-01T14:04:43Z")

</div>

I connected pin 1 (GND) of the radar to GND, pin 3 (VCC) to 3.3v, pin 4 (RX) to pin 10, and pin 5 (TX) to pin 11. I tried running it in the Arduino IDE with the baud rate set to either 34800 or 38400 bps as advised, but nothing appeared.  
I am using a USB cable compatible with the Arduino Uno for power supply, and it is powered from my laptop.  
And this is my code.

```arduino
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX on pin 10, TX on pin 11

void setup() {
  Serial.begin(34800);
  mySerial.begin(34800);
}

void loop() {
  if (mySerial.available()) {
    byte header1 = mySerial.read();
    byte header2 = mySerial.read();

    if (header1 == 0x54 && header2 == 0x44) {
      byte distanceLSB = mySerial.read();
      byte distanceMSB = mySerial.read();
      uint16_t distance = (distanceMSB << 8) | distanceLSB;
      
      byte speedLSB = mySerial.read();
      byte speedMSB = mySerial.read();
      uint16_t speed = (speedMSB << 8) | speedLSB;
      
      byte angleLSB = mySerial.read();
      byte angleMSB = mySerial.read();
      uint16_t angle = (angleMSB << 8) | angleLSB;
      
      byte magnitudeLSB = mySerial.read();
      byte magnitudeMSB = mySerial.read();
      uint16_t magnitude = (magnitudeMSB << 8) | magnitudeLSB;
      

      Serial.print("Distance: ");
      Serial.print(distance / 100.0, 2);
      Serial.println("m");

      Serial.print("Speed: ");
      Serial.print(speed / 100.0, 2);
      Serial.println("m/s");

      Serial.print("Angle: ");
      Serial.print(angle / 100.0, 2);
      Serial.println("deg");

      Serial.print("Magnitude: ");
      Serial.print(magnitude / 100.0, 2);
      Serial.println("dB");
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [November 1, 2023, 2:17pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/10 "2023-11-01T14:17:49Z")

</div>

> [@kokm](#):
>
> And this is my code.

Looks like you are sure the thing is just gonna start talking at you.

Does the datasheet support this?

Try using serial printing to monitor you program flow, viz:

```arduino
  if (mySerial.available()) {
    byte header1 = mySerial.read();

    Serial.print("I see "); Serial.println(header1, HEX);

```

It's 38400 for sure. I don't think you are getting any characters up from the device for one or more of the reasons I have suggested.

Did you need to worry about the 5 volt UNO vs. the 3.3 volt device attached?

What did you learn when you tried simply talking to it using a terminal emulator?

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [November 1, 2023, 2:45pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/11 "2023-11-01T14:45:58Z")

</div>

The default baud rate is 115200 (page 13 of data sheet)

You have the TX, RX pins connected wrong.  
Should be this way:  
Pin 4 (RX) -\> UNO pin 11 (TX)  
Pin 5 (TX) -\> UNO pin 10 (RX)

---

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [November 1, 2023, 3:24pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/12 "2023-11-01T15:24:01Z")

</div>

> [@jim-p](#):
>
> default baud rate is 115200

Yes, _THX_. I did not find the nice data sheet with my tablet at the beach. Whatever I did find obvsly did not stick in my mind for three seconds or, less likely, was different. Or another device on another thread altogether. 😑

115200 makes using Software serial a potential part of the problem.

It might be possible to configure it for a lower rate using a terminal emulator, or a real port on a different Arduino board.

TBH the data sheet does not make it clear, to me, that the default can be changed and made to survive a power cycle.

The data sheet also nicely illustrates the conversational nature of interacting with the device. It's not going to just start sending. Anything.

a7

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [April 29, 2024, 3:24pm UTC](https://forum.arduino.cc/t/k-ld7-with-arduino-uno/1183781/13 "2024-04-29T15:24:25Z")

</div>

Closed on April 29, 2024, 3:24pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
