Tracker One - Sensing a Drop Event

I noticed that there is a capability for the Tracker One to detect a “high G event” and it also seems that there are some hooks to change sensitivity. I am looking for any help that might be available to help me take advantage of this functionality?

Here is what I know so far,

I am assuming that you need to enable this functionality so, in setup() I added:

 Tracker::instance().motionService.enableHighGDetection();

When I run this, it does seem to allow me to trigger a publish when I (responsibly) drop the tracker. Here is the JSON payload (ignore the placeholder “drop” which is not functional yet).

{
"cmd":"loc"
"time":1614263987
"loc":{
"lck":1
"time":1614263988
"lat":35.90857697
"lon":-78.80269623
"alt":87.849
"hd":29.62
"spd":0.01
"h_acc":1.2
"v_acc":2
"cell":44.3
"batt":94.2
"temp":24
"speed":0.01
"drop":1
}
"trig":[
0:
"lock"
]
"req_id":5
}

The “trig” value does change from “time” to “lock” on drop but the “lock” trigger is also used when the device first comes on-line or reacquires a location lock - so it is not unique to a high-G event.

So, how can I get a value into this payload that reflects a drop event so my back - end can trigger an alert?

Thanks,

Chip

Normally you enable high-g mode from the console not from device firmware.

You should be getting a value of “imu_g” in the “trig” array for a high-g event. These are the possible values, and there can be more than one in the array.

					"time",
					"radius",
					"imu_m",
					"imu_g",
					"imu_o",
					"lock",
					"unlock",
					"temp_h",
					"temp_l",
					"user",
					"batt_warn",
					"batt_low"

Try enabling high-g from the console and see if the imu trig are added in that case.

@rickkas7 ,

Thanks for the tip. I tried this using the configure fleet settings but did not see either motion or g events. Does the configuration go our to all devices once they are changed or do I need to reset or refresh the device.

Again, any help is appreciated.

Chip

The change is immediate for all devices that are online. For the devices that are offline, they will get the configuration update when they come back online.

You can monitor the event log to see if the configuration is being delivered. Also, there are some USB serial debug logs generated that may be helpful to see what is happening on-device.

@rickkas7 ,

I don’t think the updates are being received by my device. I have the serial log open on USB and making changes in the “configure fleet” section does not generate any data.

The devices does seem to publish on a (significant) drop but the trigger is always “lock”.

Here is my code:


#include "Particle.h"

#include "tracker_config.h"
#include "tracker.h"


SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);

PRODUCT_ID(TRACKER_PRODUCT_ID);
PRODUCT_VERSION(TRACKER_PRODUCT_VERSION);

STARTUP(
    // Correct power manager states in the DCT
    Tracker::enablePowerManagement();
);

SerialLogHandler logHandler(115200, LOG_LEVEL_TRACE, {
    { "app.gps.nmea", LOG_LEVEL_INFO },
    { "app.gps.ubx",  LOG_LEVEL_INFO },
    { "ncp.at", LOG_LEVEL_INFO },
    { "net.ppp.client", LOG_LEVEL_INFO },
});

void locationGenerationCallback(JSONWriter &writer, LocationPoint &point, const void *context); // Forward declaration

float get_temperature();

int test;


// Define the variables


void setup()
{
    Tracker::instance().init();
    Tracker::instance().location.regLocGenCallback(locationGenerationCallback);

    Particle.connect();

}

void loop()
{
    Tracker::instance().loop();
}

void locationGenerationCallback(JSONWriter &writer, LocationPoint &point, const void *context)
{
    writer.name("speed").value(point.speed, 2);
    writer.name("temp").value(get_temperature(),1);
    writer.name("drop").value(point.stable,2);
}

Thanks,

Chip

It took a while but I did see an update get pushed to my device which is now showing “imu_g” for the trigger. Thank you for your advice on this @rickkas7

1 Like