Skip to content

Commit 80dfefa

Browse files
Updated arduino example folder structure, names, examples
Generic outline for examples created - setup functionality mostly completed. Folder structure, and names have been adjusted for more examples.
1 parent 50179d9 commit 80dfefa

File tree

9 files changed

+295
-62
lines changed

9 files changed

+295
-62
lines changed

examples/Example01_DistanceBasicReadings/Example01_BasicUsage/Example01_BasicUsage.ino

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
Example 1: Distance Basic Readings
3+
4+
Using the Acconeer XM125 A121 60GHz Pulsed Coherent Radar Sensor.
5+
6+
This example shows how operate the XM125 when the device is in Distance Reading Mode.
7+
The sensor is initialized, then the distance values will print out to the terminal in
8+
mm.
9+
10+
By: Madison Chodikov
11+
SparkFun Electronics
12+
Date: 2024/1/22
13+
SparkFun code, firmware, and software is released under the MIT License.
14+
Please see LICENSE.md for further details.
15+
16+
Hardware Connections:
17+
QWIIC --> QWIIC
18+
19+
Serial.print it out at 115200 baud to serial monitor.
20+
21+
Feel like supporting our work? Buy a board from SparkFun!
22+
https://www.sparkfun.com/products/ - Qwiic XM125 Breakout
23+
*/
24+
#include <Arduino.h>
25+
#include "SparkFun_Qwiic_XM125_Arduino_Library.h"
26+
27+
SfeXM125 radarSensor;
28+
29+
// I2C default address
30+
uint8_t i2cAddress = SFE_XM125_I2C_ADDRESS;
31+
32+
void setup()
33+
{
34+
// Start serial
35+
Serial.begin(115200);
36+
Serial.println("XM125 Example 1: Basic Distance Readings");
37+
Serial.println("");
38+
39+
// If begin is successful (0), then start example
40+
if(radarSensor.begin(i2cAddress, Wire) == 1)
41+
{
42+
Serial.println("Begin");
43+
}
44+
else // Otherwise, infinite loop
45+
{
46+
Serial.println("Device failed to setup - Freezing code.");
47+
while(1); // Runs forever
48+
}
49+
}
50+
51+
void loop()
52+
{
53+
// Request Distance Data from the device
54+
55+
delay(100);
56+
}

examples/Example02_DistanceSettings/Example02_DistanceSettings.ino

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Example 2: Distance Threshold Settings
3+
4+
Using the Acconeer XM125 A121 60GHz Pulsed Coherent Radar Sensor.
5+
6+
This example shows how operate the XM125 when the device is in Distance Reading Mode.
7+
The sensor is initialized, then the distance amplitude, and strength thresholds are set.
8+
9+
By: Madison Chodikov
10+
SparkFun Electronics
11+
Date: 2024/1/22
12+
SparkFun code, firmware, and software is released under the MIT License.
13+
Please see LICENSE.md for further details.
14+
15+
Hardware Connections:
16+
QWIIC --> QWIIC
17+
18+
Serial.print it out at 115200 baud to serial monitor.
19+
20+
Feel like supporting our work? Buy a board from SparkFun!
21+
https://www.sparkfun.com/products/ - Qwiic XM125 Breakout
22+
*/
23+
#include <Arduino.h>
24+
#include "SparkFun_Qwiic_XM125_Arduino_Library.h"
25+
26+
SfeXM125 radarSensor;
27+
28+
// I2C default address
29+
uint8_t i2cAddress = SFE_XM125_I2C_ADDRESS;
30+
31+
void setup()
32+
{
33+
// Start serial
34+
Serial.begin(115200);
35+
Serial.println("XM125 Example 2: Distance Threshold Settings");
36+
Serial.println("");
37+
38+
// If begin is successful (0), then start example
39+
if(radarSensor.begin(i2cAddress, Wire) == 1)
40+
{
41+
Serial.println("Begin");
42+
}
43+
else // Otherwise, infinite loop
44+
{
45+
Serial.println("Device failed to setup - Freezing code.");
46+
while(1); // Runs forever
47+
}
48+
49+
// Set the fixed amplitude threshold
50+
radarSensor.();
51+
// Set the fixed strength threshold
52+
radarSensor.();
53+
54+
}
55+
56+
void loop()
57+
{
58+
// Request Distance Data from the device
59+
60+
delay(100);
61+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Example 3: Distance Subsweeps - Power Consumption Optimization
3+
4+
Using the Acconeer XM125 A121 60GHz Pulsed Coherent Radar Sensor.
5+
6+
This example shows how operate the XM125 when the device is in Distance Reading Mode.
7+
The sensor is initialized, then the measurement range is split into multiple subsweeeps to
8+
allow for optimization of power consumption and signal quality. A shorter/longer profile can
9+
be change byt setting the max_profile parameter, and the step length can be limited using the
10+
max_step_length parameter. Setting the high signal quality can result in a better SNR, but
11+
setting it low in this application reduces power consumption and measurement time.
12+
13+
By: Madison Chodikov
14+
SparkFun Electronics
15+
Date: 2024/1/22
16+
SparkFun code, firmware, and software is released under the MIT License.
17+
Please see LICENSE.md for further details.
18+
19+
Hardware Connections:
20+
QWIIC --> QWIIC
21+
22+
Serial.print it out at 115200 baud to serial monitor.
23+
24+
Feel like supporting our work? Buy a board from SparkFun!
25+
https://www.sparkfun.com/products/ - Qwiic XM125 Breakout
26+
*/
27+
#include <Arduino.h>
28+
#include "SparkFun_Qwiic_XM125_Arduino_Library.h"
29+
30+
SfeXM125 radarSensor;
31+
32+
// I2C default address
33+
uint8_t i2cAddress = SFE_XM125_I2C_ADDRESS;
34+
35+
void setup()
36+
{
37+
// Start serial
38+
Serial.begin(115200);
39+
Serial.println("XM125 Example 3: Distance Subsweeps - Power Consumption Optimization");
40+
Serial.println("");
41+
42+
// If begin is successful (0), then start example
43+
if(radarSensor.begin(i2cAddress, Wire) == 1)
44+
{
45+
Serial.println("Begin");
46+
}
47+
else // Otherwise, infinite loop
48+
{
49+
Serial.println("Device failed to setup - Freezing code.");
50+
while(1); // Runs forever
51+
}
52+
53+
// Select a shorter profile at the start of the measurement
54+
radarSensor.setDistanceMaxProfile(XM125_DISTANCE_PROFILE1);
55+
56+
// Choose a longer step length
57+
radarSensor.setDistanceMaxStepLength(5);
58+
59+
// Reduce signal quality for lower HWAAS, SNR to decrease power consumption
60+
radarSensor.setDistanceSignalQuality(10000);
61+
}
62+
63+
void loop()
64+
{
65+
// Request Distance Data from the device
66+
67+
delay(100);
68+
}

examples/Example03_PresenceBasicReadings/Example03_PresenceBasicReadings.ino

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Example 4: Presence Basic Readings
3+
4+
Using the Acconeer XM125 A121 60GHz Pulsed Coherent Radar Sensor.
5+
6+
This example shows how operate the XM125 when the device is in Presence Reading Mode.
7+
The sensor is initialized, then the presence values will print out to the terminal.
8+
9+
By: Madison Chodikov
10+
SparkFun Electronics
11+
Date: 2024/1/22
12+
SparkFun code, firmware, and software is released under the MIT License.
13+
Please see LICENSE.md for further details.
14+
15+
Hardware Connections:
16+
QWIIC --> QWIIC
17+
18+
Serial.print it out at 115200 baud to serial monitor.
19+
20+
Feel like supporting our work? Buy a board from SparkFun!
21+
https://www.sparkfun.com/products/ - Qwiic XM125 Breakout
22+
*/
23+
#include <Arduino.h>
24+
#include "SparkFun_Qwiic_XM125_Arduino_Library.h"
25+
26+
SfeXM125 radarSensor;
27+
28+
// I2C default address
29+
uint8_t i2cAddress = SFE_XM125_I2C_ADDRESS;
30+
31+
void setup()
32+
{
33+
// Start serial
34+
Serial.begin(115200);
35+
Serial.println("XM125 Example 4: Basic Presence Readings");
36+
Serial.println("");
37+
38+
// If begin is successful (0), then start example
39+
if(radarSensor.begin(i2cAddress, Wire) == 1)
40+
{
41+
Serial.println("Begin");
42+
}
43+
else // Otherwise, infinite loop
44+
{
45+
Serial.println("Device failed to setup - Freezing code.");
46+
while(1); // Runs forever
47+
}
48+
}
49+
50+
void loop()
51+
{
52+
// Request Presence Data from the device
53+
54+
delay(100);
55+
}

examples/Example04_PresenceSettings/Example04_PresenceSettings.ino

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
Example 5: Presence Subsweeps - Power Consumption Optimization
3+
4+
Using the Acconeer XM125 A121 60GHz Pulsed Coherent Radar Sensor.
5+
6+
This example shows how operate the XM125 when the device is in Presence Reading Mode.
7+
The sensor is initialized, then the presence values will print out to the terminal.
8+
9+
By: Madison Chodikov
10+
SparkFun Electronics
11+
Date: 2024/1/22
12+
SparkFun code, firmware, and software is released under the MIT License.
13+
Please see LICENSE.md for further details.
14+
15+
Hardware Connections:
16+
QWIIC --> QWIIC
17+
18+
Serial.print it out at 115200 baud to serial monitor.
19+
20+
Feel like supporting our work? Buy a board from SparkFun!
21+
https://www.sparkfun.com/products/ - Qwiic XM125 Breakout
22+
*/
23+
#include <Arduino.h>
24+
#include "SparkFun_Qwiic_XM125_Arduino_Library.h"
25+
26+
SfeXM125 radarSensor;
27+
28+
// I2C default address
29+
uint8_t i2cAddress = SFE_XM125_I2C_ADDRESS;
30+
31+
void setup()
32+
{
33+
// Start serial
34+
Serial.begin(115200);
35+
Serial.println("XM125 Example 5: Presence Subsweeps - Power Consumption Optimization");
36+
Serial.println("");
37+
38+
// If begin is successful (0), then start example
39+
if(radarSensor.begin(i2cAddress, Wire) == 1)
40+
{
41+
Serial.println("Begin");
42+
}
43+
else // Otherwise, infinite loop
44+
{
45+
Serial.println("Device failed to setup - Freezing code.");
46+
while(1); // Runs forever
47+
}
48+
}
49+
50+
void loop()
51+
{
52+
// Request Presence Data from the device
53+
54+
delay(100);
55+
}

0 commit comments

Comments
 (0)