I'd agree about the first, but the second is debatable: the Light Sleep (0.9 mA) mode may be applicable depending on the application. Take a system running off alkaline AA cells: capacity is 2600mAH. So the run time in this mode is about 2600/(0.9*24*31) = 3.9 months. Of course this will be reduced as the device will presumably wake up and do some work from time to time Another option might be to run off a 2AH rechargeable LiPoly cell.kfricke wrote:...The first two are not that applicable for a battery powered scenario...
How do you properly handle external interrupts?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: How do you properly handle external interrupts?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: How do you properly handle external interrupts?
This discussion is very interesting, but I think it's a bit off topic. Should we move to another thread?
I'd love to hear more about powering options..
I'd love to hear more about powering options..
Re: How do you properly handle external interrupts?
To be honest I have not noticed that Pin.irq(...) method before. Did you see that it seems to return a callback object? Where did you read about the argument for the handler method?Rf3w8 wrote:...Code: Select all
def call_this(change): print(change) p2 = Pin(2, Pin.IN) p2.irq(trigger=Pin.IRQ_FALLING, handler=call_this)
Did you also pull the Pin up (towards VCC via a resistor) to define the idle (non-pressed) state?
This is a busy loop which does not return idle time to the RTOS running on the ESP. Not giving idle time back to the RTOS will sooner or later trigger the WDT and reset the ESP.......Code: Select all
while 1: pass
Re: How do you properly handle external interrupts?
My story about the dash button was meant for your scenario, tbh. You do have GPIOs available, so why not use those to implement an external circuitry like that?Rf3w8 wrote:This discussion is very interesting, but I think it's a bit off topic. Should we move to another thread?
I'd love to hear more about powering options..
Re: How do you properly handle external interrupts?
Yes but either way it's too slow? I guess?kfricke wrote:My story about the dash button was meant for your scenario, tbh. You do have GPIOs available, so why not use those to implement an external circuitry like that?Rf3w8 wrote:This discussion is very interesting, but I think it's a bit off topic. Should we move to another thread?
I'd love to hear more about powering options..
By they way, the approach you were referring to is probably the same used by this guy here: https://www.youtube.com/watch?v=nbMfb0dIvYc
Last edited by Rf3w8 on Sun Mar 05, 2017 12:59 am, edited 1 time in total.
Re: How do you properly handle external interrupts?
I did some testing to see how much it takes to connect to a wifi network, comparing normal boot vs. reset from deep sleep:
Deep sleep with static ip addressing is instantaneous.
This, together with the approach shown in the video I put above, would allow making a pretty great remote for controlling lights.
- Normal boot - DHCP Enabled: 5 seconds
- Deepsleep - DHCP Enabled: 3 seconds
- Normal boot - Static IP addressing: 2 seconds
- Deepsleep - Static IP addressing: 0 seconds
Deep sleep with static ip addressing is instantaneous.
This, together with the approach shown in the video I put above, would allow making a pretty great remote for controlling lights.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: How do you properly handle external interrupts?
How did you determine connectivity in these tests? It would be informative to do this by retrieving some actual content from the network. It may be that with static IP the ESP reports connectivity instantly, but the access point may need time to respond.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: How do you properly handle external interrupts?
This is true, I didn't test for internet connectivity, because it is not needed for what I need. You could do:pythoncoder wrote:How did you determine connectivity in these tests? It would be informative to do this by retrieving some actual content from the network. It may be that with static IP the ESP reports connectivity instantly, but the access point may need time to respond.
Code: Select all
import socket
info = socket.getaddrinfo("google.com", 80)
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: How do you properly handle external interrupts?
Then you'd be timing your ISP and the local internet in addition to the wakeup time. I'd go for accessing a local resource such as the router or a server. This should return a time as near as possible to that between waking and actually having connectivity. The results would be interesting.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.