Use notehub API to enable/disable notecard motion and geofence (without an MCU)

Hi All,

I would very much like to know how to use the notehub API to enable/disable a single notecard’s motion detection and/or geofence…and do it without an MCU. Just the notehub talking to the notecard. I think this would be very valuable. If this isn’t currently possible…let’s upvote this!

2 Likes

Hey @PostThis, thanks for the question! The behavior you described isn’t currently supported, but this is a great feature request and we’ll log it for future consideration. If others would find this useful, chime in here and let us know!

1 Like

Hey guys yes I came on looking for a similar option - it’d be great if it were possible to avoid the extra power draw and cost of an external device for use cases similar to this, e.g.

  • Configure two outbound GPS reporting periods - eg once per hour (either the single latest fix or X latest) when not moving, then once per 10 minutes when movement is detected

As a slightly broader point too (apologies if I’ve missed this somewhere), I was wondering if it were worth making the configuration parser slightly smarter, for example to be able to have simple conditionals - based on board state such as accelerometer movement, or time of day, or battery voltage etc - to allow for auto switching between different configured modes

This would cover the example above if the accelerometer state could be thresholded and used to trigger transition to a different GPS reporting state

I was actually going to ask too (sorry again if this is in the docs - I can’t seem to find it explicitly mentioned anywhere) if we can develop the firmware ourselves - perhaps even if there is just part of the firmware accessible for users, ie excluding sensitive parts like the cellular control/encryption/whatever. I was going to have a crack at the above but can’t find anything on actually developing and compiling ourselves

Thanks and apologies in advance for daisy-chaining all these thoughts :slight_smile:

1 Like

Regarding the above the notecard already has this feature, though not exactly as you describe.
GPS is very power hungry - a single GPS fix consumes the same amount of power as multiple days of standby operation, and ,surprisingly, a GPS fix consumes more power than transmitting that fix to Notehub.

Therefore if there is no motion (as measured by the accelerometer) the Notecard assumes it has remained in place and does not turn on the GPS. Periodic reporting of this type (I’m still here) is referred to as the heartbeat and is enabled using card.location.track:

https://dev.blues.io/reference/notecard-api/card-requests/#card-location-track

The configuration shown below will capture and sync GPS once every 10 minutes when there is motion, and will send a heartbeat once per hour when no motion is detected.

{"req":"card.location.mode","seconds":600,"mode":"periodic"}
{"req":"card.location.track","start":true,"hours":1,"heartbeat":true,"sync":true}

Oh, good one - thanks Sean. Somehow I’d missed the fact that configuration is persistent across restarts. Thanks for the reply, that’s great

Hey @bsatrom , any updates on this? This would be a big difference maker for me.

Hi @PostThis, not at this time. It’s on the list, but I don’t have a timeline for implementation to share.

1 Like

@PostThis
You may be able to achieve your aim by setting the environment variable _gps_secs at Notehub. This will override the setting in card.location.mode,seconds. When the environment variable is deleted the Notecard will resume using card.location.mode,seconds.

By setting _gps_secs to a very long duration (e.g. a week or a month) you would effectively be temporarily disabling the GPS.
thanks
Sean

1 Like

@seant Interesting method. Can I set the variable with an API call?

Hello bsatrom. It has been a while since this discussion. I was inquiring/seeking the same concept of the notecard configured standalone without an MCU. Simply persist the commands in a set that activates at boot. Do I understand in general this is not how the card is intended to operate and it is only a slave to an external MCU?

Thanks

Hi @Steve and welcome to the Blues Wireless community!

Can you explain more about what you are trying to accomplish with the Notecard? In a more general sense, there are a few things I can suggest:

  1. As mentioned above, the use of environment variables does allow for management of some Notecard settings without a host MCU.
  2. There are ways to utilize the AUX GPIO pins on the Notecard to autonomously report state changes as of the 3.3.1 firmware. Check out this doc for more info.
  3. Finally, it’s important to remember that the Notecard is a low-power device (~8uA of draw when idle). It’s not meant to be powered off and on (restarted). However, configurations are saved and retained after power cycling.

Thanks,
Rob

thanks Rob. and thanks for the welcome. so for example I see where there is an off the shelf script to essentially make the card an asset tracker for purposes of a proof of concept. once the script is loaded into the card through the cli the card runs on its own without the need for any interface from the CLI. so…is it possible to have that script pre-loaded into the card to simply apply power without a CLI interface and auto run that script from bootup?

Hi @Steve,

Yes - you can send commands to the Notecard with the Notecard CLI through a terminal/command prompt, or using a serial terminal application (e.g. CoolTerm), or via the browser-based terminal interface provided at dev.blues.io. Any commands sent to the Notecard persist across restarts, so if you configured a number of asset trackers one at a time they would all start acting as trackers again when powered on and deployed.

Does that answer your question?

Rob

it does. and I am learning that. but yesterday (my first day) I was NOT seeing that commands were being retained. It seems more stables now. I do have other questions I will post in another thread.