Open EDsteve opened 6 months ago
Just to link the discussion from here
@OOHehir Yes. You got it right. If the device is ON, and not doing anything (No BT connection, no recording, no EI) it should go to sleep. Let's say after 5 minutes or so for now. With the firmware before the merge. The device wakes up from the knock sensor on GPIO12 (This might not help in the walking-through-jungle scenario). But let's keep it for now like that.
If i remember correctly some pins are able to wake up the ESP32 from deep sleep. Maybe that's the reason the ESP32 still uses 6mA instead of <1mA in deep sleep? @LIFsCode
Hi @EDsteve @OOHehir Let me intervene at this point ;-)
deep sleep @EDsteve asked for a intruder alarm based on accelerometer repeated action that will cause the buzzer to constantly beep. If that's still the case, I doubt that anyone would carry around the ELOC with forgetting to turn off.
Anyway if the deep sleep option remains a requirement we should be very careful with condition for entering deep sleep to avoid other problems, e.g. a ranger won't notice that the device entered deep sleep and wandering why it won't respond.
Concerning wakeup source: I assume a simple power cycle by the on/off switch would be the more stable (I know and less elegant ^^)variant. It avoids accidentally turning it on by something pressing on the button in the backpack. The on/off switch is a bit more robust.
Light sleep This is already enabled by the power config. The freeRTOS is automatically entering light sleep, once no wake locks are taken. Light sleep means that the main system clocks are stopped and only the low power RTC clock is running.
That means the following modules prevent light sleep:
- Bluetooth (unless provided with an external crystal
- I2S (as mentioned above)
Besides that there is an effect of the PSRAM on power during light sleep, but I would treat this as negligible as it's in the range of a few 10s uA.
Sorry it has been a long post, but the power management is quite a topic. I hope I've been comprehensible
@EDsteve Based on the above do you still think this feature is a requirement?
@LIFsCode If this is a requirement perhaps this could be implemented by a simple task that:
- sleeps for 30 sec then,
- wakes & checks to see if the wav file writer, Bluetooth & EI inference tasks are running.
- if they're all inactive/ disabled increment a simple counter
- if any are active clears the counter
- sleeps again & repeats the above
- if counter gets to X, enters deep sleep & doesn't return, requires a power cycle to exit.
@LIFsCode @OOHehir
Intruder alarm:
I doubt that anyone would carry around the ELOC with forgetting to turn off.
I had the same thought when making the buzzer table :) Therefore I was already thinking about a setting in the app "Arm device during record. ON/OFF". That would only have the device armed while recording after it's already set up and not while setting up or carrying around for example. It's not a mandatory feature. But I would love to test that because i am sure it will help with monkeys and humans.
Sleep: I have been out in the field with rangers. They will deal with 50 and more devices. Forgetting to turn some devices off is a common mistake. Then the battery gets drained while sitting in the basecamp or on the way in the jungle. Its no fun to realize that you carry around a few KG of empty batteries for a few days. (Not all ELOCs use solar panels)
But your doubts are true too. It can be confusing for the rangers when the device doesn't respond. It's similar with the BT time-out. Easy to get confused when i don't find the ELOC in the BT list of the app any more. And wonder what happened. (Yes. The app is online, but still work in progress.) That's because BT timout is now set to 60 sec just for testing. But later will be set to 30 minutes or more to give enough time setting up the device. (BLE could be always on and would make life easier in that regard. But that's a huge task if i see that right.) Also the sleep mode should happen after one hour or so and not after 5 minutes as i sugested earlier for testing. That should reduce the chances of confusion.
Waking up the device from the ON/OFF switch sounds good to me. I think that is the first thing everybody does when something doesn't respond: Restart :)
Deep sleep or intruder alarm are handy features which would make a difference in my opinion, but this feature might be more impartant which also uses deep sleep.
@LIFsCode Now i feel more sorry for a even longer post :) @OOHehir Thanks for the new commit. I will check it out soon.
@EDsteve @OOHehir I try to make a flow diagram to visualize this to bring things together.
@EDsteve any other conditions triggers which should enter deep sleep and/or wake it up?
@LIFsCode
any other conditions triggers which should enter deep sleep and/or wake it up?
Nothing i can think of right now.
Ok so If I understood you correctly @EDsteve we are talking about 2 different scenarios for deep sleep:
See comments above. This scenario leaves a lot of open questions:
Sleep mode Triggers:
Sleep mode Behavior:
This scenario is actually new to me, I interpret it the following way:
@EDsteve : is that correct?
Problems I see here:
@LIFsCode Sorry for the late reply. Was pretty busy the last days.
Since this (similar) feature was already implemented in the FW before the merge, I didn't expect it to become that big of an issue. I was assuming it will be a 30 minute fix or so. But i guess it never is and now i realize it needs some brainstorming :) This feature has lower priority and we can deal with it any time. But to answer your questions:
Sleep mode Triggers:
Sleep mode Behavior:
To resurrect the ELOC once the battery recovers is a very good feature to have in think. Specialy In detecting mode. If there is no need for the rangers to change SD cards every few weeks, it will stay in the jungle for months without being checked on. Not sure if the deep sleep solution is the best way to achieve that. But that's what came up in my mind.
Your flowchart shows exactly what i meant. I have added the SPIFFS-check in the flowchart. To make it complete.
Problems:
For the end-product (detector with LoRa) this feature (or similar) is a must have. But has no high priority for the next few weeks/months.
This is actually an important topic which i haven't talked about yet. And maybe challanging? I am not sure.
Scenario: The ELOC is running with solar power and recording in the jungle. Now there is 2 weeks no sun, the battery gets drained and the ELOC turnes off. After a while the battery recharges slowly and the ELOC starts again (if it does not get caught in some weired boot state?). But recording has stopped so it needs to be started manually through the app again. Rangers only check the devices every two or 4 weeks.
Wishful solution: The ELOC should put itself in deep sleep mode when the battery level is critical (Let's say <10%). In deep sleep it can stay in a stable state for a few days, wakes up every few hours to check the battery level and if the battery is full enough, the ELOC starts recording automatically.
Is that a realistic thought?