Arduino Library for the SparkFun Pulsed Coherent Radar Sensor
The SparkFun Pulsed Coherent Radar Sensor - Acconeer XM125 (SEN-24540) brings powerful 60 GHz radar technology to your projects. This sensor isn't limited to surface detection; it can see through walls, cabinets, and even pockets (depending on the material), making it perfect for unique applications. Measure distances with millimeter precision, detect motion, the speed of an object, or even gestures!
The XM125 boasts an impressive range of up to 20 meters, allowing you to create long-range sensing projects. The actual measurable distance is dependent on the object size, shape, dielectric properties, and lens (e.g. water level measurements up to 20 meters with lens utilization, human presence detection up to 7 meters with lens-free utilization). Despite its power, the sensor has remarkably low in power consumption, which is ideal for battery-powered applications. The real magic lies in the sensor's ability to do more than measure distance; the XM125 can differentiate between stationary objects and moving targets using pulsed coherent radar. This means you can sense an object's presence and how fast something is moving!
Looking for the board that matches this library - pick up a SparkFun Pulsed Coherent Radar Sensor - Acconeer XM125 (Qwiic) at <www.sparkfun.com>.
Note
If upgrading from Version 1 of this library, some changes are required before moving to Version 2.0+. The detals of this are outlined in the section titled Upgrading to Version 2 from Version 1 later in this document.
The SparkFun Pulsed Coherent Radar sensor can run as an I2C client device, or as a standalone development board. This library is used when the sensor is operating as a standalone I2C device.
When running as a I2C client device, the Acconeer XM125 is loaded with a specific firmware application from Acconeer.
The SparkFun Pulsed Coherent Radar Sensor - Acconeer XM125 comes with the Presence Detector firmware loaded, which is accessible using the Presence focused methods in this library.
This library also supports the Distance Detection application firmware from Acconeer. To enable this functionally, the Distance Detection firmware must be loaded onto the SparkFun Pulsed Coherent Radar Sensor - Acconeer XM125 board. The firmware is available from Acconeer as part of the XM125/A121 SDK. The files are located in the out/
folder - with naming patter of i2c_*_detector.bin
. Install instructions are noted in our Hook Up Guide for the product.
This library provides a extensive interface that enables the following functionality/interaction with the SparkFun Pulsed Coherent Radar Sensor when the sensor is operating as an I2C sensor device:
Function | Firmware | Library Class To Use |
---|---|---|
Distance Detection | i2c_distance_detector |
SparkFunXM125Distance |
Presence Detection | i2c_presence_detector |
SparkFunXM125Presence |
Reference | Description |
---|---|
Quick Reference - Distance | A quick reference API for the the main library object for the Distance Application |
Quick Presence - Distance | A quick reference API for the the main library object for the Distance Application |
Full Documentation | The full documentation and API for this Arduino library |
SparkFun Pulsed Coherent Radar Sensor | Hardware GitHub Repository |
Hook Up Guide | Hardware Overview and Quick Start for the XM125 Qwiic Development Board |
The following examples are provided with the library
Example | Description |
---|---|
Presence Basic Readings | The sensor is initialized, then the presence distance values will print out to the terminal. |
Presence GPIO 0 Usage | The sensor is initialized, then the presence values will print out to the terminal and trigger the GPIO0 pin high when there is a presence detected. |
Presence Serial Plotter | The sensor is initialized, then the presence values will print out to the terminal and the serial monitor. |
Presence Advanced Readings | The sensor is initialized, then the presence distance, intra-presence, and inter-presence values will be printed to the terminal. |
Presence Advanced Settings | The sensor is initialized, then the presence distance values will print out to the terminal just as they do in example one. If you wish to change the settings of the device, do so before applying the configuration. |
Distance Basic Readings | The sensor is initialized, then the distance values will print out to the terminal in mm. |
Distance Threshold Settings | The sensor is initialized, then the distance amplitude, and strength , fixed amplitude, and sensitivity thresholds are set. |
Distance Serial Plotter | This example prints out the distance values of the 0 distance channels to the serial plotter tool in Arduino. |
Distance Advanced Settings | The sensor is initialized, then the distance (mm) and advanced values are output to the terminal. |
This product is open source!
This product is licensed using the MIT Open Source License.
Version 2.0+ of this library is not compatible with Version 1.* implementations/use. For Version 2.0, the single class defined by the library, SfeXM125
, was divided into two distinct classes for schemantic clarity and code simplification.
The device single class was devided into two classes - one for each specific I2C application that the Acconeer XM125 can run. These classes are:
- SparkFunXM125Distance - Used when the XM125 is running the Distance application
- SparkFunXM125Presence - Used when the XM125 is running the Presence application
Additionally, the method naming pattern for each application was simplified - removing Distance and Presence from method names.
To simplify the transition from an application written using the Version 1.* library, two compatiblity classes are provided:
- SparkFunXM125DistanceV1 - Used when the XM125 is running the Distance application
- SparkFunXM125PresenceV1 - Used when the XM125 is running the Presence application
These classes implement the version 1.method names for the library, to minimize the porting requirements when upgrading to Version 2..
To upgrade to Version 2.0 of the library, perform one of the following:
- If the Acconeer XM125 is running the I2C Distance Application: Rename the device class from
SfeXM125
toSparkFunXM125DistanceV1
- If the Acconeer XM125 is running the I2C Presence Application: Rename the device class from
SfeXM125
toSparkFunXM125PresenceV1
Once the class name is changed, your application is ready to use version 2.* of this library.