Electron wake on interrupts

I want to use interrupts generated by the LIS3DH to wake up the Electron. But I also want to be able to wake up the Electron with interrupts generated by other sources (other than the LIS3DH) too. For greater clarity, I want to wake up the Electron if it receives interrupt A OR interrupt B.

The documentation states that the LIS3DH interrupts are connected in the AssetTracker to the Electron WKP pin. If this is the case, the WKP pin is both an input (for the Electron) and an output (for the LIS3DH). If this is the case, doesn’t this mean that it is not possible to simultaneously use the A7/WKP pin for any other purpose (for fear of frying the LIS3DH)?

The LIS3DH library accepts an argument for intPin, implying that the interrupt can be directed to pins other than WKP. Is this true? Or is it only possible when using the bare LIS3DH (not as part of the AssetTracker)? Which AssetTracker pins can be used as destinations for interrupts generated by the LIS3DH?

The System.sleep command will accept interrupts on any of the pins D1, D2, D3, D4, A0, A1, A3, A4, A6, A7. Therefore I could send the LIS3DH interrupts to WKP, connect WKP to, for example, A6 via a diode, connect my other interrupt source to A6 via another diode, and tell System.sleep to wake the Electron on interrupts received on A6. Should this work? Or is there a simpler way to do it?

@fguptill, the LIS3DH is connected to the WKP since a high transition on WKP is the only way to wake the Electron from deep sleep. If you don’t use deep sleep, the WKP pin can be used like any other GPIO interrupt input.

There is an open issue regarding using multiple interrupts for waking from sleep. Using a diode OR may work but you will not know the source of the interrupt, if that’s important.

1 Like

Thanks for the reply @peekay, but the documents say System.sleep command will accept interrupts on any of the pins D1, D2, D3, D4, A0, A1, A3, A4, A6, A7. Is this something other than “deep sleep”?[quote=“fguptill, post:1, topic:36760”]
System
[/quote]

@fguptill there are different sleep modes with deep sleep being the lowest power one. Read the sleep section thoroughly to understand the different modes, especially in regards to the Electron.

1 Like

Hi @peekay. I followed your suggestion and gave a thorough read to the docs about sleep mode.

I plan to use a diode OR to combine two or three interrupts. I realize that this will obscure which interrupt has caused the wakeup. That’s a nuisance, but I can deal with it by performing other tests when the electron awakes.

I cannot use a diode OR on the A7 pin because I cannot break the connection between the LIS3DH and the Electron in order to insert a diode. However, I CAN interpose a diode if I direct the LIS3DH interrupt to a pin other than A7.

Rick’s LIS3DH.h file includes a comment “If the INT pin is connected to a pin, specify which one with intPin”, which seems to imply that the LIS3DH interrupt can be sent to pins other than A7/WKP. If this is true, I can then connect my diode between that new pin and WKP. If that only works in modes other than deep sleep mode that is OK.

The sleep mode that I am using is the one invoked by the statement

System.sleep(wakeupPin, RISING, SLEEP_TIME_SEC, SLEEP_NETWORK_STANDBY);

As I understand it, this is not a deep sleep mode because of my use of the SLEEP_NETWORK_STANDBY option. In that case, I am not restricted to using only WKP, but should be able to choose from any of the pins D1, D2, D3, D4, A0, A1, A3, A4, A6, A7 as the wakeupPin.

So this brings me to my key question: Can I direct the LIS3DH interrupt to a pin other than A7/WKP? If so, which pins?

I appreciate your help.

Not quite. SLEEP_NETWORK_STANDBY is also available for deep sleep.
The distinction between Stop Mode Sleep (the one you are using) and deep sleep (Standby in STM terms) is in the first parameter. It's either a pin designator or the keyword SLEEP_MODE_DEEP (doc sample calls 2 & 4).

And the ability to use other pins for the accelerometer to wake the device leads just over jumper wires to parallel route to any desired pin.

1 Like

Thanks guys. :slight_smile:

1 Like