Asset Tracker Accelerometer + GPS problem

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

If you look in build.sh you’ll see that the contents of the gps-library folder gets copied alongside the main .ino file.
That .ino file needs to include the respective header files

// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_GPS.h"
#include "Adafruit_LIS3DH.h"
#include "GPS_Math.h"

// optional - e.g. for the motion-tracker demo
#include <math.h>
#include <ctype.h>

That’s the whole magic when building in the cloud via CLI.

If you want to build with Particle Build (Web IDE) and the desired lib is not available, you need to copy-paste the code into seperate file tabs added via the (+) icon in the top right corner.

See docs
https://docs.particle.io/guide/getting-started/build/photon/#adding-files-to-your-app

I did get that. That works building locally with the dfu-util build, right? How do you wire that up in the cloud? Is there a way? Thanks

Nope, there is no local building without a full local toolchain, and particle compile does have nothing to do with dfu-util.

CLI sends the source files into the build farm (cloud) where the binary gets built and sent down to you again for flashing.

dfu-util is only for flashing via particle flash --usb (and some other direct flash access to the device), but having that and OpenSSL too on your machine will become handy for other things too.

But you can still flash without dfu-util via particle flash --serial

Ah, that worked. this is helpful. I tried flashing using --serial earlier (around 3am [yikes!]) but got an error. But the compile did succeed. Based on your comments, I tried again just now and it worked! I must have fat fingered something.

I appreciate your patience. I am learning.

Thanks again,

~dab

1 Like

Rickkas7

Noticed you added the wakeonmove functionality to the main asset tracker library (thanks!). Forgive the inexperience - how we include that functionality with other two basic examples? As simple as adding all the requisite files to the particle IDE?

All you should need to do when using the 0.3 or later version of the official AssetTracker library is include a call to t.setupLowPowerWakeMode(movementThreshold) in your code, where t is he AssetTracker object used in the examples. The default movement threshold is 16, making it smaller makes it more sensitive, making it larger less sensitive.

Then, when you go to sleep it should automatically wake up if moved.

1 Like

Hi,

this is still a problem i.e. the accelerometer shutting off. I noticed that if I init the accel before activating the GPS, it doesn’t work. While if the accel init happens after GPS activation then it works a couple fo times after which (when the GPS init sequence precedes accel init) the accel shuts down.

My code is a shorter version of rickkas library. Note : I am not putting my electron to sleep - just shutting down the GPS.

am I doing something wrong? Pls help

thanks

can anyone help?

Hi, I am having the same problem :frowning:

It wakes up a couple (maybe three times) after boot and then it never wakes up again from the accelerometer.

Does anybody have any ideas of what might be going on ?

Thanks!

Which library are you using? The official asset tracker library wake on move does not work properly. I think I fixed it in AssetTrackerRK; you can read more about it here: https://github.com/rickkas7/AssetTrackerRK

Thanks rickkas7,

Yep, I am using the AssetTrackerRK present in the Particle Library Manager. The only change I made was on System.Sleep to go into deep sleep (removed the last parameter of System.Sleep call: “SLEEP_NETWORK_STANDBY”).

Any ideas ?

Touch a wire briefly between 3V3 and WKP when it’s in the state where it won’t wake up. If it wakes up, the problem is that the accelerometer isn’t correctly signaling the processor. If it doesn’t, then something is preventing the processor from waking up. That won’t really solve the problem, but at least it will narrow it down.

Thanks! I will try to replicate the problem here and post back.

Hi rickkas7,

Touching the WKP with 3.3V does not wake up the processor when it is in this state…

Is this a hardware problem ? Do I have a faulty unit ?

Well it could be a hardware problem, but the most likely problem is a code structure or state machine issue. The most common cause is some code path that causes the Electron to immediately go back to sleep when it wakes up. It happens so fast it looks like nothing happened.

2 Likes

I have problem about using this. It wake when I hit the reset button but then it never wake. And everything is worse when I add GPS. It seem like GPS is not wake when I shake. It work even the electron still sleep.

In the latest firmware+library the wake on movement seems to work fine. At least a half dozen times or so I tested it so far.

But, does anyone know how to undo what the t.setupLowPowerWakeMode(movementThreshold) function does? It seems to put the accelerometer into a low-power mode that’s just for waking up the device so I can’t use other functions to read the current values.

What I’m doing is waking on movement, and then turning on the GPS. I want it to remain on as long as there has been recent movement.

So I have to switch the chip from the Low Power Wake Mode to normal mode (while on), and then back. But, I can’t seem to find the function that puts it back.