I have problem about waking up the electron even I tried to reduce the delay. It never wake up. Here it is.
case SLEEP_STATE:
// Sleep
System.sleep(WKP, RISING);
// This delay should not be necessary, but sometimes things don't seem to work right
// immediately coming out of sleep.
delay(50);
waitUntil(Particle.connected);
Serial.printlnf("awake=%d", awake);
if(t.readXYZmagnitude() >= accelThreshold ){
Particle.connect();
delay(50);
// Send that acceleration to the serial port where it can be read by USB
//Serial.println(pubAccel);
awake = ((t.clearAccelInterrupt() & LIS3DH_INT1_SRC_IA) != 0);
Serial.println(t.readXYZmagnitude());
t.updateGPS();
Serial.println("Fall !!");
state = PUBLISH_STATE;
}
else{
state = SLEEP_WAIT_STATE;
}
break;
}
Thank You, for your answer. I just take a look on “wake on move” of AssetTrackerRK and it seem similar to what I want. May I check my understand that it will wake when I shake and then publish GPS, isn’t it?
And,
const uint8_t movementThreshold = 16
is it the same threshold as
// Threshold to trigger a publish
// 9000 is VERY sensitive, 12000 will still detect small bumps
int accelThreshold = 9000;
[quote="GookgikPagornsirikul, post:5, topic:31331"]
May I check my understand that it will wake when I shake and then publish GPS, isn't it?
[/quote] Yes, that is correct.
Yes, functionally it is the same but the values are obviously different. You will find a value of 16 is quite sensitive.
The advice to use AssetTrackerRK for wake on move is good. I actually wrote both versions, and the wake on move in the official AssetTracker library doesn’t work quite right. I wrote a completely new version in AssetTrackerRK, but because you have to call it differently, I haven’t merged the change into the official library yet.
The reason is that I didn’t initially understand how gravity cancellation worked on the LIS3DH. Because it’s not automatic, you have to wait for it to stop moving so you can figure out the device’s orientation before going to sleep.
For the “AssetTrackerRK” library, what is the range of values that would work for the “movementThreshold” variable? I would like my asset tracker to wake upon the movement of a vehicle going maybe 5 miles/hour. However, no matter what value I change the variable to be, the tracker wakes on the slightest movement. I would like it to be a lot less sensitive.
It’s not possible to wake on speed or velocity using the LIS3DH accelerometer.
You can only trigger on the magnitude of acceleration, or the rate of change in velocity. Velocity is the integral of acceleration, but the LIS3DH isn’t able to do that math in hardware.
I understand that, however, if I wanted to trigger a particle event only after a sustained minimum acceleration over a certain amount of time, would that be possible. So the movement threshold would wake the photon, but no event would be published unless that threshold was sustained?
Are the above values usable to change the wake sensitivity?
I have this sensor arriving tomorrow and I'm using it with the Electron and GPS sensor and plan on merging your code with my current code that pushes data to a Losant.com dashboard.
After testing them myself, those values do in fact change the wake sensitivity. However, make sure that the following line of code has the “movementThreshold” variable placed inside the “config.setLowPowerWakeMode()” function: