Development of 24GHz mmWave in XIAO and Arduino | Seeed Studio Wiki #1248
Replies: 7 comments 2 replies
-
How Can i integrate this sensor with esp32 or esp8266 ? |
Beta Was this translation helpful? Give feedback.
-
I tried Demo 1. Basic mode output with xiao esp32s3 but im Getting this Error ELF file SHA256: 805bee0994594d52 Rebooting... Core 1 register dump: Backtrace: 0x42002592:0x3fcebe10 0x4200262e:0x3fcebe50 0x42001765:0x3fcebeb0 0x4200348e:0x3fcebf70 ELF file SHA256: 805bee0994594d52 Rebooting... |
Beta Was this translation helpful? Give feedback.
-
For anyone else struggling to stream relaible data over the serial port, its becuase software serial is not up to the task of reading this sensor. Its really a shame you decided to use software serial considering there are two hardware serial ports available (XIAO ESP32C3). I found that sofware serial was not nearly reliable enough. I'm just trying to stream the distance vaules over USB to use as a proximity trigger on a PC. With software serial it freezes up and misses frames frequently. Seems like its not able to read the sensor fast enough. After a lot of wasted time trying to make software serial work, I wired mine up to use the hardware serial pins on D6 and D7. This works way better!!! No more stuttering or freezing. Maybe for a future revision consider adding some solder bridge jumpers to the end user can decide if they want hardware or software serial. Software serial is junk for this application. |
Beta Was this translation helpful? Give feedback.
-
The latest version of the SoftwareSerial library doesn't even compile in the Arduino IDE. To avoid these issues, it's better to skip using SoftwareSerial and switch to HardwareSerial, which will work much more reliably. For the XIAO C6 board, you can use pins D6 and D7 for hardware serial communication with the radar, which should be connected to the radar's RX and TX pins, respectively. Below is a code sample for setting up HardwareSerial on the XIAO C6 board: HardwareSerial RadarSerial(0); // Alias for UART0 (Serial0) // Initialize the radar configuration void setup() { |
Beta Was this translation helpful? Give feedback.
-
Hi guys, it seems like there is issue while using software serial. The microcontroller freeze while processing. I have also faced the same issue and find a solution. We know that the mmwave sensor uses HLK LD410 module. They have their own library for this. #if defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_AVR_LEONARDO)
//ARDUINO_SAMD_NANO_33_IOT RX_PIN is D1, TX_PIN is D0
//ARDUINO_AVR_LEONARDO RX_PIN(RXI) is D0, TX_PIN(TXO) is D1
#define sensorSerial Serial1
#elif defined(ARDUINO_XIAO_ESP32C3) || defined(ARDUINO_XIAO_ESP32C6)
//RX_PIN is D7, TX_PIN is D6
#define sensorSerial Serial0
#elif defined(ESP32)
//Other ESP32 device - choose available GPIO pins
#define sensorSerial Serial1
#if defined(ARDUINO_ESP32S3_DEV)
#define RX_PIN 18
#define TX_PIN 17
#else
#define RX_PIN 16
#define TX_PIN 17
#endif
#else
#error "This sketch only works on ESP32, Arduino Nano 33IoT, and Arduino Leonardo (Pro-Micro)"
#endif
// User defines
// #define DEBUG_MODE
#define ENHANCED_MODE
#define SERIAL_BAUD_RATE 115200
//Change the communication baud rate here, if necessary
//#define LD2410_BAUD_RATE 256000
#include "MyLD2410.h"
#ifdef DEBUG_MODE
MyLD2410 sensor(sensorSerial, true);
#else
MyLD2410 sensor(sensorSerial);
#endif
unsigned long nextPrint = 0, printEvery = 1000; // print every second
void printValue(const byte &val) {
Serial.print(' ');
Serial.print(val);
}
void printData() {
Serial.print(sensor.statusString());
if (sensor.presenceDetected()) {
Serial.print(", distance: ");
Serial.print(sensor.detectedDistance());
Serial.print("cm");
}
Serial.println();
if (sensor.movingTargetDetected()) {
Serial.print(" MOVING = ");
Serial.print(sensor.movingTargetSignal());
Serial.print("@");
Serial.print(sensor.movingTargetDistance());
Serial.print("cm ");
if (sensor.inEnhancedMode()) {
Serial.print("\n signals->[");
sensor.getMovingSignals().forEach(printValue);
Serial.print(" ] thresholds:[");
sensor.getMovingThresholds().forEach(printValue);
Serial.print(" ]");
}
Serial.println();
}
if (sensor.stationaryTargetDetected()) {
Serial.print(" STATIONARY= ");
Serial.print(sensor.stationaryTargetSignal());
Serial.print("@");
Serial.print(sensor.stationaryTargetDistance());
Serial.print("cm ");
if (sensor.inEnhancedMode()) {
Serial.print("\n signals->[");
sensor.getStationarySignals().forEach(printValue);
Serial.print(" ] thresholds:[");
sensor.getStationaryThresholds().forEach(printValue);
Serial.print(" ]");
}
Serial.println();
}
byte lightLevel = sensor.getLightLevel();
if (lightLevel) {
Serial.print("Light level: ");
Serial.println(lightLevel);
}
Serial.println();
}
void setup() {
Serial.begin(SERIAL_BAUD_RATE);
#if defined(ARDUINO_XIAO_ESP32C3) || defined(ARDUINO_XIAO_ESP32C6) || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_AVR_LEONARDO)
sensorSerial.begin(LD2410_BAUD_RATE);
#else
sensorSerial.begin(LD2410_BAUD_RATE, SERIAL_8N1, RX_PIN, TX_PIN);
#endif
delay(2000);
Serial.println(__FILE__);
if (!sensor.begin()) {
Serial.println("Failed to communicate with the sensor.");
while (true) {}
}
#ifdef ENHANCED_MODE
sensor.enhancedMode();
#else
sensor.enhancedMode(false);
#endif
delay(nextPrint);
}
void loop() {
if ((sensor.check() == MyLD2410::Response::DATA) && (millis() > nextPrint)) {
nextPrint = millis() + printEvery;
printData();
}
} |
Beta Was this translation helpful? Give feedback.
-
when i try to download the library for mmWave in XIAO and Arduino Github writes "404 this is not the webpage you are looking for." Where is the library now located? |
Beta Was this translation helpful? Give feedback.
-
Hi Frank,
thanks so much!
I am trying to follow your Wiki on using the 24GHz mmWave device with a XIAOESP32C3 exactly
I dowloaded the zip file from Github and installed it and tried to compile and run the examples.
under the /Examples/Seeed Arduino 24GHz Radar Sensor there are 2 examples
MR24FDB1_Example
and
MR24HPB1_Example
i tried both
the MR24FDB1_Example compiles and uploads but does Not send back any thing in the Serial monitor window in the Arduino IDE - it just stays blank
the MR24HPB1_Example does not compile. There is an error
"/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino: In function 'void loop()':
/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino:46:13: error: 'Situation_action' was not declared in this scope
46 | if (Situation_action = 1){
| ^~~~~~~~~~~~~~~~
/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino:49:13: error: 'Situation_action' was not declared in this scope
49 | if (Situation_action = 2){
| ^~~~~~~~~~~~~~~~
/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino:52:13: error: 'Situation_action' was not declared in this scope
52 | if (Situation_action = 3){
| ^~~~~~~~~~~~~~~~
/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino:55:13: error: 'Situation_action' was not declared in this scope
55 | if (Situation_action = 4){
| ^~~~~~~~~~~~~~~~
/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino:58:13: error: 'Situation_action' was not declared in this scope
58 | if (Situation_action = 5){
| ^~~~~~~~~~~~~~~~
/private/var/folders/p9/mpmh5j8137lg6p60n7r9pgpw0000gn/T/.arduinoIDE-unsaved202539-5468-fzpqmq.86oer/MR24HPB1_Example/MR24HPB1_Example.ino:61:13: error: 'Situation_action' was not declared in this scope
61 | if (Situation_action = 6){
| ^~~~~~~~~~~~~~~~
exit status 1
Compilation error: 'Situation_action' was not declared in this scope"
Looking at the example code it seems that 'Situation_action' would be a variable that is never defined in the example, and looking at the radar.h and radar.cpp library files it is not defined there either.
Do you have any suggestions?
thanks,
Paul
…________________________________
From: Frank Nie ***@***.***>
Sent: Wednesday, April 9, 2025 10:39 PM
To: Seeed-Studio/wiki-documents ***@***.***>
Cc: Paul DeMarinis ***@***.***>; Comment ***@***.***>
Subject: Re: [Seeed-Studio/wiki-documents] Development of 24GHz mmWave in XIAO and Arduino | Seeed Studio Wiki (Discussion #1248)
Hi, the link issue has been fixed. You should be able to download the library now. Let us know if you need any further help!
—
Reply to this email directly, view it on GitHub<#1248 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABZSBKL3NPRTAFOMEY7KPJL2YX7X5AVCNFSM6AAAAABISPJGFSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTENZYGY4DCNA>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Development of 24GHz mmWave in XIAO and Arduino | Seeed Studio Wiki
Introduction of how to develop mmWave Sensor on XIAO.
https://wiki.seeedstudio.com/mmwave_for_xiao_arduino/
Beta Was this translation helpful? Give feedback.
All reactions