XM125 - Measurement

Hi everyone. We’ve recently ordered a few of the XM125 radar modules. Going through examples and using I2C, in the video, the host turns it against himself and it measures as low as 35cm.

Regardless of what we do, I cannot get it under 800mm…

Once i do, it starts just outputting the same value:
16:26:14.522 → Presence Detected: 2622mm

16:26:15.116 → Presence Detected: 2611mm

16:26:15.702 → Presence Detected: 2618mm

1

In the acconner software I was able to calibrate it perfectly as for our use case, but this doesnt go over to the ardunio project after reflashing it.

We are following this video:

And using the exact same firmware and all…

I need to be able to reliably measure distance between 25cm up to 3 meters.

For distance-based applications you’ll need to install the distance firmware i2c_distance_detector.bin and re-try Flashing Firmware to the XM125 - SparkFun Qwiic Pulsed Coherent Radar Sensor Breakout - Acconeer XM125 Hookup Guide

Thanks for your answer
We’ve followed the guide and in there this is a step. The distance meassurement is still unreliable / not useable

Maybe share a photo of your setup

Hi.
We have been fiddling around with it. Using the acconneer tool and calibrating it we can get it to work, switching back to the arduino example and holding something in front 40-60 cm it doesnt take a reading.

Is there some how we can make a calibration that persist in the arduino example?

If you still need a picture let me know

Thanks for your help

Which arduino example?

Example 6. We also tried others

Alrighty; does it show a reading for other distances? (closer/farther than 40-60cm)?

Hi @xkaas -

I just gave this library a fairly big “refactor” as part of porting it to our updated version of the “SparkFun Toolkit” a core library for I2C/SPI communications .

During this effort, I dug into the library and realized it wasn’t our best effort - so I made some changes to simplifying the implementation - leveraging our toolkit, and broke up the core object into separate objects - one for each of the supported applications (Presence, Distance).

I haven’t published these changes yet because more testing is required and I couldn’t get to this at the time. But I did see similar behavior - the results didn’t make sense.

My intent is to figure this out over the next week and get the update published.

If you are curious about the update, it is here:

On the “release/v02.00.00” branch of our repo.

Part of this update also includes Doxygen generated documentation here:

Note: These docs are building using the older library version (just how our doc builds are working on GitHub right now).

When I have updates, I’ll post them here.

-Kirk

2 Likes

Hi Kirk.
Please do let me know what your findings are. I am happy that you confirm to see simillar results as us. We have a few modules now we’ve tested with and its been the same for all of them.

We also did a switch of MCU - STM32 to ESP32, just to see the same findings.

I hope the new libary is more stable in its readings. Using the acconeer tool really shows what this radar can do - Which is impressive!

Hi Kirk.
Was this updated? I just tried to compile the v2 branch, got alot of random issues - And on mac I just got an ARM error for the package specifically.

We’d love to help testing. We are pretty eager in getting this to work.

Hi @xkaas -

A couple things:

  • I just pushed a few more updates to the v2 branch - most of these were ease of use and simplifications. You might of also got some of my changes mid-checking/merge?, although I think your errors are b/c of the toolkit version you have installed (see below).

  • The updates include improvements to example 1 and example 6. These examples are working as I would expect - I haven’t tried the other examples yet due to time (this isn’t my day job :), but will in the next couple of days. Once this is done I’ll publish this release to the Arduino index.

Some of the issues you are seeing are because of the updates to the “SparkFun Toolkit” library that this driver/library uses. SparkFun Toolkit. You need to update the Toolkit to version 1.0.

Also, I’m building/testing on a mac with the latest OS and everything is working okay, but if you keep seeing issues, let me know and I can dig deeper.

Hi @gigapod. Thanks for letting me know. Luckily, example 6 is what we are trying to run.

I appreciate the time you take to maintain this!

The error im getting on build:

/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Library/Caches/arduino/sketches/8FF14A5A0C734A11E5682BF22AF411A8/sketch/Example06_DistanceBasicReadings.ino.cpp.o: in function `SparkFunXM125Distance::begin(unsigned char, TwoWire&)':
/Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/SparkFun_Qwiic_XM125_Arduino_Library.h:57: undefined reference to `sfDevXM125Distance::begin(sfTkII2C*)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Library/Caches/arduino/sketches/8FF14A5A0C734A11E5682BF22AF411A8/sketch/Example06_DistanceBasicReadings.ino.cpp.o: in function `setup()':
/Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:59: undefined reference to `sfDevXM125Distance::distanceBegin(unsigned long, unsigned long)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Library/Caches/arduino/sketches/8FF14A5A0C734A11E5682BF22AF411A8/sketch/Example06_DistanceBasicReadings.ino.cpp.o: in function `loop()':
/Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:79: undefined reference to `sfDevXM125Distance::distanceDetectorReadingSetup()'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:88: undefined reference to `sfDevXM125Distance::getDistanceNumberDistances(unsigned long&)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:103: undefined reference to `sfDevXM125Distance::getDistancePeakDistance(unsigned char, unsigned long&)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:129: undefined reference to `sfDevXM125Distance::getDistancePeakStrength(unsigned char, long&)'
collect2: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Library/Caches/arduino/sketches/8FF14A5A0C734A11E5682BF22AF411A8/sketch/Example06_DistanceBasicReadings.ino.cpp.o: in function `SparkFunXM125Distance::begin(unsigned char, TwoWire&)':
/Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/SparkFun_Qwiic_XM125_Arduino_Library.h:57: undefined reference to `sfDevXM125Distance::begin(sfTkII2C*)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Library/Caches/arduino/sketches/8FF14A5A0C734A11E5682BF22AF411A8/sketch/Example06_DistanceBasicReadings.ino.cpp.o: in function `setup()':
/Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:59: undefined reference to `sfDevXM125Distance::distanceBegin(unsigned long, unsigned long)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Library/Caches/arduino/sketches/8FF14A5A0C734A11E5682BF22AF411A8/sketch/Example06_DistanceBasicReadings.ino.cpp.o: in function `loop()':
/Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:79: undefined reference to `sfDevXM125Distance::distanceDetectorReadingSetup()'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:88: undefined reference to `sfDevXM125Distance::getDistanceNumberDistances(unsigned long&)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:103: undefined reference to `sfDevXM125Distance::getDistancePeakDistance(unsigned char, unsigned long&)'
/Users/kevinals/Library/Arduino15/packages/rak_rui/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/kevinals/Downloads/SparkFun_Qwiic_XM125_Arduino_Library-release-v02.00.00/examples/Example06_DistanceBasicReadings/Example06_DistanceBasicReadings.ino:129: undefined reference to `sfDevXM125Distance::getDistancePeakStrength(unsigned char, long&)'
collect2: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

Using a RAK3172 module.

I have uninstalled the XM125 libary version 1.0.4, and I moved SparkFun_Qwiic_XM125_Arduino_Library.h from src into the example 6 project.

I have updated to latest toolkit.

Sorry. I had a brainfart. I of course need to import the zip file.

1 Like

Okay!!

00:02:14.070 -> Distance Detection Started - range: 200mm to 2000mm
00:02:14.070 -> 
00:02:14.070 -> 
00:02:14.564 -> Current Work Mode: LoRaWAN.
00:02:14.959 -> ...........

Wired up exactly as before.

Yep, you need to replace the entire XM125 library contents in ~/Documents/Arduino/libraries/SparkFun_Qwiic_XM125 …/

So if you move something over the sensor (metal, phone … something that is reflective)- at say 30 cm above it, does it detect that range? Just want to make sure it’s working for you.

With the settings in the new Example 6, I would get solid distances when moving a metal bowl from about 22 cm to close to 2m.

-Kirk

Looking straight up:
0:25:29.592 → …
00:25:38.294 → Number of Values Detected: 1
00:25:38.294 → Distance Peak 0: 1.87m Distance Peak Strength 0: -5557
00:25:41.198 → .
00:25:44.096 → Number of Values Detected: 1
00:25:44.096 → Distance Peak 0: 1.85m Distance Peak Strength 0: -5858
00:25:47.001 → …

Getting something in front of it
0:26:24.732 →
00:26:24.732 → Number of Values Detected: 1
00:26:24.732 → Distance Peak 0: 40.10cm Distance Peak Strength 0: -10515
00:26:27.635 →
00:26:27.635 → Number of Values Detected: 1
00:26:27.675 → Distance Peak 0: 48.10cm Distance Peak Strength 0: -13734
00:26:30.572 → …

I still seem to get alot of “…”, for now, the results are simillar as before. I have a a few spare modules at our office I can try to test on to see if I get simillar results.
Just to be sure, I just reflashed it with the firmware.

With this current module its very good at 20-50cm, but after this it just blanks out

Okay … this is helpful.

The way our general setup runs (the distanceDetectorReadingSetup() method) follows one path the Acconneer dev guide for this mode of the sensor - looking to recalibrate if needed after each data/distance read - which is slightly different than the example in that document. The dev guide example just reads in values, no cal check - I wonder if this is an issue.

When I get some time this weekend I’ll put together a slightly different version of that example that follows what their example does and see if that improves the results. All the methods are there on our library object, so it shouldn’t be that hard.

Thanks again for helping determine the issue/ fix the library.

-Kirk

1 Like

Hi @xkaas -

Testing this morning, I found that just adjusting the start and end values of the detection range has a big impact on the results.

The I2C example provided by Acconeer uses a range of 1000m to 5000m (1m to 5m). Changing example 6 from a range of 200mm - 2000mm to 500mm - 5000mm gave greatly improved results and far few sensor ‘non-detect’ events.

I updated the range values in Demo 6 on the release v2.0 branch. Give it a try - I’d suggest also adjusting/tuning the start and end values of the demo to fit your applications need.

-K

Hi @gigapod
I have just tested this
16:25:55.972 → Distance Peak 1: 4.47m Distance Peak Strength 1: -7045
16:25:58.845 →
16:25:58.845 → Number of Values Detected: 1
16:25:58.886 → Distance Peak 0: 3.01m Distance Peak Strength 0: -6344

And its still rather jumpy. I dont have 4.4 meters near me - let alone 3 :stuck_out_tongue:

I will try with the different module. I just think its weird that using the acconeer tool I can get this working perfectly.