Cut power completely to the ESP8266 and other parts by code?
Posted: Sun Jul 24, 2022 3:17 pm
Hi,
im working on a simple project that is pressing a button, the ESP-01S plays a message via a speaker, then it needs to shut down, as it going to be powered by AA bats or a 3.7v Lithium.
The problem i have is that im good at coding but not at electronics, so i went ahead and by using the examples of the ESP8266 audio lib i quickly managed to have the ESP-01 playing a flac audio file stored on LittleFS via the software delta-sigma DAC using just a NPN transistor and a 1K resistor. It is recomended to use a 2n3409 but i found that a 2n2222 produces a higher volume.
This part is fine, but after the audio is played i need everything to shutdown in order not to drian the battery. I tried to use ESP.deepSleep();, but i found out that cant be used while the ESP is wired to a transistor, the pin state after during deepSleep causes the transistor to be active and a constant current passing trought the speaker. This also overheats the transistor to the point it may burn it, i didnt allow it to get to the point.
If the 8266 could be placed into sleep mode i trought maybe just a push button wired to RST and GND may be enoght, but that is impossible it seems. Also that would leave the 3.3v regulator and the 5v step up active.
So im not sure how to do this, maybe a mosfet? something that is enabled by pressing the button, then a GPIO enables to maintain it so when the audio is done i can just change the GPIO state?
im working on a simple project that is pressing a button, the ESP-01S plays a message via a speaker, then it needs to shut down, as it going to be powered by AA bats or a 3.7v Lithium.
The problem i have is that im good at coding but not at electronics, so i went ahead and by using the examples of the ESP8266 audio lib i quickly managed to have the ESP-01 playing a flac audio file stored on LittleFS via the software delta-sigma DAC using just a NPN transistor and a 1K resistor. It is recomended to use a 2n3409 but i found that a 2n2222 produces a higher volume.
This part is fine, but after the audio is played i need everything to shutdown in order not to drian the battery. I tried to use ESP.deepSleep();, but i found out that cant be used while the ESP is wired to a transistor, the pin state after during deepSleep causes the transistor to be active and a constant current passing trought the speaker. This also overheats the transistor to the point it may burn it, i didnt allow it to get to the point.
If the 8266 could be placed into sleep mode i trought maybe just a push button wired to RST and GND may be enoght, but that is impossible it seems. Also that would leave the 3.3v regulator and the 5v step up active.
So im not sure how to do this, maybe a mosfet? something that is enabled by pressing the button, then a GPIO enables to maintain it so when the audio is done i can just change the GPIO state?