Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wake on Significant Motion #48

Open
scath999 opened this issue Feb 16, 2022 · 8 comments
Open

Wake on Significant Motion #48

scath999 opened this issue Feb 16, 2022 · 8 comments

Comments

@scath999
Copy link

Wondering how I can configure this device to fire an interrupt on significant motion, per page 45 of the datasheet (here)?

The goal is to be able to set an alarm in CPy to wake when pin D3 is set high - according to the schematics for the Feather Sense (which I'm developing on), this is the GPIO connected with INT1 on the LSM6DS33.

Something like

pin_alarm = alarm.pin.PinAlarm(pin=board.D3, value=True, pull=True)
alarm.light_sleep_until_alarms(pin_alarm)

The datasheet seems to indicate that setting register 0x0D on the device to 64 (bin 01000000) will accomplish this.

Thoughts?

@tekktrik
Copy link
Member

Looks like this should be an easy addition. I don't have the hardware but I can submit a PR with this functionality if you'd like to help me test it!

@tekktrik
Copy link
Member

I plan to get one anyways to work on some other issues, so no worries!

@caternuson
Copy link

Seems related to:
#5
which I appear to have totally forgotten about and abandoned. :(

@tekktrik I can try picking this up. There's a similar outstanding issue on the Arduino side as well.

@tekktrik
Copy link
Member

Sounds good! I was going to see about doing #17 so I can just try that when the sensor arrives!

@caternuson
Copy link

This library supports multiple devices with a common base class LSM6DS defined in __init__.py. There is some variability in the enabling and use of Significant Motion Detection between the devices. Here's a summary taken from several app notes.


LSM6DS33 (?? guessing ??) STM doesn't seem to acknowledge its existence anymore
LSM6DS3TR-C (AN5130)

image


ISM330DHCX (AN5398)
LSM6DSOX (AN5272)
LSMM6DSO32 (AN5473)

image

@caternuson
Copy link

caternuson commented Mar 16, 2022

@scath999 In AN5398, it describes the "significant motion" detection as:

It generates an interrupt when the difference between the number of steps counted from its initialization/
reset is higher than 10 steps.

Is that what you are expecting? Or were just wanting something like shake detection?

EDIT: Also checkout the comment here:
#5 (comment)
It may not be what you're expecting it to be?

@scath999
Copy link
Author

scath999 commented Mar 17, 2022

Hi Everyone,

Sorry for the late replies - busy at work.

I've managed to solve this issue for now by creating a Pin.Alarm on D3. This works, though less well than I'd like: The sensor has to be moved pretty quickly and repeatedly to wake.

Thoughts?

@scath999
Copy link
Author

@scath999 In AN5398, it describes the "significant motion" detection as:

It generates an interrupt when the difference between the number of steps counted from its initialization/
reset is higher than 10 steps.

Is that what you are expecting? Or were just wanting something like shake detection?

EDIT: Also checkout the comment here: #5 (comment) It may not be what you're expecting it to be?

Exactly - @ladyada is having the same experience I'm having.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants