Chat freely about anything...

User avatar
By hulahulahu
#74258 Hi, I need my ESP to recover from deepsleep, send JSON file to server and then go back to the deepsleep. And I want to do it by using just one button.
I know that I can do it by simply connecting that button to reset pin, but I need ESP to send different JSON based on how many times was button pressed. Right now if I press button again, ESP will just restart one more time and JSON for one click will be send.
I was thinking about connecting that button to reset pin and also to one of the ESP's pins (for counting how many times was button pressed) and then using another pin with P-channel MOSFET as switch to "cut the connection" between button and reset pin.
Can you recommend me good,small and cheap P-channel MOSFET that is suitable for this application or do you know about better way of solving my problem ?
User avatar
By Luc Volders
#74349 KIS (keep it simple)

Write a variable to memory.
When the ESP boots (re-boots) get the variable and add 1 and wtrite it back
That way you can count how many times it has been reset and act on that.

Can be done very easily with ESP-Basic

Luc
User avatar
By schufti
#74374 no, I think you misunderstood.
He does not want to send a different file depending how often he did wake up.
He only has one button connected to reset and after wake-up wants same button to "enter" number of clicks to select file to be sent.

short reply:
don't use deep-sleep and/or reset, use EN and two gpios.
button (on gpiox and +3V3) pulls EN high via diode to start esp,
in setup() set gpioy connected to EN high to keep esp running.
now use gpiox to count button-presses.
after work set gpioy low.
User avatar
By hulahulahu
#74506
schufti wrote:short reply:
don't use deep-sleep and/or reset, use EN and two gpios.
button (on gpiox and +3V3) pulls EN high via diode to start esp,
in setup() set gpioy connected to EN high to keep esp running.
now use gpiox to count button-presses.
after work set gpioy low.


Thank you for your answer, but I don't know what EN means.