Waking up Electron

I have problem about waking up the electron even I tried to reduce the delay. It never wake up. Here it is.

		// 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.
	    Serial.printlnf("awake=%d", awake); 
	      if(t.readXYZmagnitude() >= accelThreshold ){
        // Send that acceleration to the serial port where it can be read by USB
             awake = ((t.clearAccelInterrupt() & LIS3DH_INT1_SRC_IA) != 0);
             Serial.println("Fall !!"); 
             state = PUBLISH_STATE; 
	         state = SLEEP_WAIT_STATE;

You mean it doesn’t wake even if you pull WKP to 3v3?

And just to be sure, I’d add a Particle.connect() just before waitUntil(Particle.connected)

I don’t know what 3v3 mean. By the way I learn from the example called wake on move, so I shake the electron when I try to wake it.

There is a pin on the Electron that is called 3v3 and it stands for 3.3V :wink:

This would be some info for the initial post tho’

If you are trying this with the Asset Tracker Shield, you should use the AssetTrackerRK library to get that feature to work properly.


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?
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. :wink:

1 Like

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.

1 Like

Thank you so much to both of you :slight_smile: @rickkas7 @peekay123

1 Like

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.

Any ideas for how to do this?

1 Like

@blbryant In the library, this config code sets the interrupt sensitivity which is currently set at 16.

Here are the other options, the more force the less sensitive it should be.

I think you could use values, 16, 32, 62, or 186 but I have not tried this.

1 Like

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:

LIS3DHConfig config;

His example had it hard-coded to 16.

Thanks for confirming that!

I did notice it was hard coded but forgot about it already.

I have an LIS3DH chip arriving tomorrow so looking forward to getting it working so it wakes on movement and sleeps when still.