snusmumriken
Active member
I'm a wildlife biologist working in a conservation context where we need to determine which predators home-in on the sounds made by hatching bird chicks. I want my Teensy 3.2 working on a battery pack to play a WAV file through a mono amp and speaker at intervals, but to sleep to conserve battery power when the device is idle. The interval between play events is to be configurable between 1 and 60 minutes. The volume and the sound file played can obviously be varied at will too, perhaps iultimately n response to PIR sensors detecting approaching predators - I can build increasing levels of sophistication over time.
I have got the WAV-playing part working (with help from forum members), and now need to implement the sleep and interrupt routines. I can put the amp to sleep OK from one of the Teensy's digital pins, it's just the CPU I now need to attend to. I've successfully used Arduinos before for other purposes, but evidently the SAMD sleep behaviour is very different.
I'm looking to use library functions because I'm not competent enough to use low-level commands. What is my best option:
Also, I'm not clear what will be retained in CPU memory with the different sleep levels? Where can I find that information, please? I would like everything that's established in the set-up loop to be retained.
I have got the WAV-playing part working (with help from forum members), and now need to implement the sleep and interrupt routines. I can put the amp to sleep OK from one of the Teensy's digital pins, it's just the CPU I now need to attend to. I've successfully used Arduinos before for other purposes, but evidently the SAMD sleep behaviour is very different.
I'm looking to use library functions because I'm not competent enough to use low-level commands. What is my best option:
- Use Snooze library, with a timer interrupt, and use the RTC to check whether enough minutes have elapsed every time the CPU wakes? I will be calling the RTC anyway in order to record a date/time stamp in a file on the SD card for each play event - this is to allow comparison with data on nearby cameras; and to let me see when the last play event was before batteries expired. (I haven't added the crystal and button cell yet, but will be doing so.)
What is the maximum value for the timer interrupt? - Use a watchdog? If so, how? Is that essentially what timer is in the Snooze library?)
Also, I'm not clear what will be retained in CPU memory with the different sleep levels? Where can I find that information, please? I would like everything that's established in the set-up loop to be retained.