APDS9960 - Gesture Sensor and MySensors Sleep
-
I'm trying to build a gesture sensor switch using adps9960 module that runs on battery and also accommodates temp/humidity via dht11.
Setup works with examples provided with Sparkfun library - so electronics ok. I see the gesture sensor activate interrupt 0 from pro-mini 3.3v. Device works fine in non-sleep mode as MySensors to Webthings.io
Sleep mode using the interrupt and FALLING only wakes after ms sleep, not from interrupt activity.
The difference between example code and MySensor example code https://www.mysensors.org/download/sensor_api_20#sleeping is- No allocation of INPUT pin for interrupt pin - assume its done in MySensors
- No specification of attach interrupt - assume its done in MySensors
- No definition of an ISR - again assume its done in MySensors
Anyone had success with this - the adps 9960 sets off the interrupt - tested by the Sparkfun example code ... device tech specs says it pulls low after an action detected on the proximity sensor engine..
-
I did more investigation played around with sleep outside of mysensors and found a bit of code in a proximity sensor example:
// Reset flag and clear APDS-9960 interrupt (IMPORTANT!) isr_flag = 0; if ( !apds.clearProximityInt() ) { Serial.println("Error clearing interrupt"); }I then needed to play around with delays to allow the sensor to catchup..
void loop() { delay(1000);Recoding back to MySensors
if ( !apds.clearProximityInt() ) { Serial.println("Error clearing interrupt"); } wakeupReason = sleep(digitalPinToInterrupt(INT_PIN), FALLING, sleepTime);setting up the interrupt pin with a pullup forced the FALLING when pin dragged down by the sensor.
void setup() { pinMode(INT_PIN, INPUT_PULLUP);All this is on caveat it makes it through some more testing.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login