Asset Tracker Accelerometer + GPS problem

Dick, Thanks for the pointer,

Dave..
I absolutely love the fancy asset code. Works great.. I do have a couple of questions..

  1. When I power up the shield, it works just like I would expect.. two bumps and it wakes up... .. What I notice is that after awhile (not sure exactly how long.. several minutes.. ) it goes into deep sleep and will not wake with a bump. Isn't the logic supposed to wake the electron even then ? I'm banking it as hard as I date.. and it won't wake. I have to hit reset to get it to turn on.. any thoughts on what might be happening ?
  2. i want to also record the maximum g forces the device was subject to. do either of you guys know that if I do an accel.x,accel.y,accel.z after the bump that woke me that I would be able to read the magnitude of that first bump ? I know how to read it and keep max while the tracker is in motion
  3. (electron noob question) you are currently publishing a single combined sentence with all the gps info. I would prefer to have that info query able as a particle variable so it can also be queried whenever. I was thinking of setting a variable with lat/lon and max acceleration at the point in the code that you do the publish. Is there some power tradeoff in using a variable vs a publish ? I suspect there is.

thanks again for the excellent work !!!!
-jc

.

LL,
Adding some simple serial debug it looks to me like the Wake on Pin from deep sleep is not working. I can get it to wake once from deep sleep my thwacking the accelerometer… but it comes up in a mode i don’t understand. It has a breathing white status light but It does not seem either to hit the serial debug in the Setup or Loop code… Whats more… it eventually falls asleep from that and won’t wake less i push reset no matter how many times i hit the accelerometer.
I saw that there were some firmware issues related to this in versions of the Photon. is it possible that Wake on Pin is not working in the Electron ? Thanks
-jc

You can not wake from PIN using Deep Sleep.

System.sleep has the wake from Pin functionality but its currently not working correctly.

Code has been fixed for System.sleep so you can wake from PIN but there are reported issues with not being able to Particle Publish if you sleep longer than 25 mins.

This issue has been raised here: https://github.com/spark/firmware/issues/888

Hmmm… thats too bad… Does anyone know if there’s a fix in the works for the Sleep timeout ?
Also Can anyone help me figure out how to use the System.sleep in a way that does wake on pin, but does not hit the 25 min limit. I was trying something like System.sleep(D1,RISING,20*60); .but that doesn’t seem to work. I can’t tel from the ASEET TRACKER code or the board what Electron pin is used as a wakeup interrupt form the accelerometer and what direction it transitions to signal a bump. Does anyone know whee thats documented ? Sorry to be a little slow here.
-jc

Hey All,

Thanks for checking out that demo!

To answer the questions from earlier:

  1. When I power up the shield, it works just like I would expect.. two bumps and it wakes up... .. What I notice is that after awhile (not sure exactly how long.. several minutes.. ) it goes into deep sleep and will not wake with a bump. Isn't the logic supposed to wake the electron even then ? I'm banking it as hard as I date.. and it won't wake. I have to hit reset to get it to turn on.. any thoughts on what might be happening ?

-- I also noticed I'm getting weird behaviors on wake. The first few wakes work normally, and then they seem to stop working. I'm not sure yet if this is an issue with my code, or with the system firmware. I had originally assumed this was the battery running out, but I think it's a wakeup issue.

  1. i want to also record the maximum g forces the device was subject to. do either of you guys know that if I do an accel.x,accel.y,accel.z after the bump that woke me that I would be able to read the magnitude of that first bump ? I know how to read it and keep max while the tracker is in motion

The accelerometer is reading very fast (5000 reads per second). So if you call accel.read() right before Serial.println("BUMP!");, you just might catch the high value. There is probably a better way to do this, but I'm not an accelerometer expert, hopefully someone else can suggest a better solution (probably something something interrupts). :slight_smile:

  1. (electron noob question) you are currently publishing a single combined sentence with all the gps info. I would prefer to have that info query able as a particle variable so it can also be queried whenever. I was thinking of setting a variable with lat/lon and max acceleration at the point in the code that you do the publish. Is there some power tradeoff in using a variable vs a publish ? I suspect there is.

With publish you can send the data into the cloud and quickly go back to sleep, which is nice for things that come on and offline. You will use less data, and you'll have a better chance of catching the event. If you used a variable you'd need to listen for the online event, and then have something actively getting the variable value, instead of just always passively listening for events, or using a webhook.

Thanks!
David

1 Like

@Dave If your missing published events after waking from System.sleep(); then its the current firmware bug.

See here for more info about it: Electron not publishing after Sleep (Stop Mode)

1 Like

Hmm, I managed to wake my electron from one of these “comatose” states by leaving the WKP pin higher for longer using a jumper wire… I wonder if maybe the signal from the accelerometer isn’t HIGH long enough, or maybe the WKP pin is somehow checked less frequently during sleep states? (I realize this isn’t how interrupt pins are meant to work, but that seems to reflect what I just saw)

Thanks,
David

Have had some of the same issues with wake on motion. I had a vibration sensor (SW-18010P) on hand, and tried it across the WKP and 3.3 pins.

You have to orient it for max sensitivity, but it seems to trigger wake reliably when I have a board in the “comatose” state.

@Dave did you found out the solution for the problem?

I think I have a duplicate question out Confusion on waking up Electron Asset Tracker
I will try with a jumper wire as well to test.

Having
System.sleep(WKP, RISING, seconds);
when I connect WKP with 3.3 with a jumper - the board gets up. So I guess the problem is in embedded accelerometer. Maybe it doesn’t hit some threshold, but how to set it?

Anyway - for now I treat the embedded wake up from motion as not working and going to use something like SW-18020P - I will try in a few days what is the result of that.

Can anyone confirm that with Electro Asset Tracker board - he is able to wake electron on motion?

@mohit @Dick have you tested wakeup on motion using the accelerometer?

I just implemented wake on move for the Electron Asset Tracker accelerometer; it works great!

There’s a lot of setup that needs to be done for the LIS3DH to enable movement interrupts, but once you do it does work. I encapsulated all of that code in a library so you can make a single method call to enable it:

That’s the library repository (also available in the community libraries), but the example program inside wakes the Electron when moved.

Also, there’s code in there to get wildly inaccurate temperature readings of the temperature of your AssetTracker from the LIS3DH chip! The accuracy is the fault of the chip, not the library; it’s just not a very accurate thermometer.

Rick

1 Like

jc, or anyone - how’d you include the fancy-asset-tracker library?

thx,

~dab

How are you building? What IDE are you using?
In order to get a proper answer, fundamental info should be provided immediately.

I can use the cloud build or the CLI. What do you recommend? Thx

CLI is also cloud build, just like Particle Dev or Particle Build.

But I’d recommend CLI since that’s the suggested way in the library repo
https://github.com/dmiddlecamp/fancy-asset-tracker

But the bash scripts for building will not run on all OSs - which one are you on?

Can you read the scripts to get the idea what’s required to get them ported to your OS (if required)?

If you look at the samples, you’ll also see how you’d import the actual library into your own projects.

BTW, what version Asset Tracker Shield have you got? I’ve got a v002 which seems to lack ability to wake on movement as used by motion-tracker demo.
@rickkas7, you got the LIS3DH working, what shield version have you got?

I’m not positive, but I think I have the v002 version, and I did get wake-on-move to work, though I also wrote my own LIS3DH driver to do it.

From my possibly incorrect interpretation of the Eagle board file: with the AssetTracker sitting with the 3V3 rail away from you, Electron on the right.

v002: the coin cell battery holder is closest to you, on the GND rail side.
v003: the coin cell battery holder is away from you, on the 3V3 rail side.

Is that correct?

I looked for something more obvious like a version number silk screened on the board somewhere, but I didn’t see one. I might just have missed it.

My v002 (version number on top side silk just next to the coin cell holder on the edge of the board and bottom side directly under :particle: ASSET TRACKER SHIELD) has the coin cell holdet next to GND rail.
I’ll have to give your code a shot since @Dave’s doesn’t wake my Electron - not even thrown against the wall :wink:

I’m working on a pull request to merge my wake on move code into the official asset tracker library. It also fixes the bug in hardware SPI support in the LIS3DH driver port so that works now too.

3 Likes

But the bash scripts for building will not run on all OSs - which one are you on?

I'm on a Windows box - Win 10. But I have a Win 7 and a Mac if that easier.

Can you read the scripts to get the idea what's required to get them ported to your OS (if required)?

Thanks for the clue, that helped a little. I was able to execute the commands in the CLI up to the flash - I've not installed the dfu-util yet.

If you look at the samples, you'll also see how you'd import the actual library into your own projects.

I did. I don't know where all the pieces go. I've been compiling in the cloud and flashing with the CLI to serial. I see the include, but don't know how to get that into my project in the cloud when you can't import it from the IDE.

I guess I'll have to do some more digging - was hoping I was just overlooking something obvious. Or maybe get a link to a how-to.

Appreciate your help,

Dean