Author Topic: MotionMote sketch question - modify for SLEEP_MODE_PWR_DOWN, interrupt pin  (Read 2349 times)

labusr

  • NewMember
  • *
  • Posts: 34
Hello,
Regarding the MotionMote sketch, I was wondering if instead of sleeping the controller for 8 seconds and waking up to check the motion flag, can you just sleep indefinitely using SLEEP_MODE_PWR_DOWN, and let the interrupt pin from the motion sensor wake you up.  If you wake up at all, it means motion has been detected, so send the wireless data packet.

Is there some implication in using two interrupts (RFM69 on interrupt 0, motion sensor on interrupt 1) that prevents you from using SLEEP_MODE_PWR_DOWN?

If you sleep the microcontroller but forget to sleep the RFM69, will the RFM69's interrupt wake up your microcontroller?  I don't really know what the RFM69's interrupt pin is used for.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
It already does that. Which sketch are you referring to?

labusr

  • NewMember
  • *
  • Posts: 34
I was looking at this sketch:

https://github.com/LowPowerLab/RFM69/blob/master/Examples/MotionMote/MotionMote.ino

The motionmote uses the lowpower.h library, and it goes to sleep for 8seconds instead of doing a SLEEP_MODE_PWR_DOWN right?

Quote
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

I was wondering if I could go to sleep forever and use the PIR interrupt to wake up instead of using the PIR interrupt to set the motion flag to "true".

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
No you can't sleep forever. You can only sleep 8s at 1 time. Then you wakeup and go right back to sleep if you decide to do so. The interrupt will also wake up when it happens. At that point the flag is set TRUE and you know it was because of the PIR.

IOW the sketch does exactly what you're looking for already. It basically does sleep forever, but 8s at a time.