Only power sensor when not in deep sleep
Only power sensor when not in deep sleep
I'd like to only power my sensor (soil moisture) when the ESP8266 (ESP-01S) is awake, which will be very infrequently, perhaps a few seconds per day. I have been successful in using the TX GPIO to drive a FET to control the sensor, but I'd like to recover that GPIO for other purposes (the TX/RX GPIOs could run an I2C LCD, while GPIO0 reads the sensor value and GPIO2 drives the on-board LED for across-the-room visual feedback). It would be acceptable for my application to have the sensor always powered when the ESP is awake, and to then use deep sleep to put both the chip and the sensor to sleep most of the time. Is there an easy way to do this? I'm believe RST is always high while awake and low while in deep sleep. Could I connect RST directly to the FET's gate? I'm already using RST to send the wake-up interrupt (I had to solder the connection on the ESP-01S for this), but I'm not sure if I can also use RST in the way I'm describing. Would wiring RST to the FET make the sensor only receive power while the chip is awake? Aside from RST, is there another way to achieve the goal I'm describing here?
Thanks.
Thanks.
Re: Only power sensor when not in deep sleep
Why don‘t you use a simple GPIO Pin with a relay? On startup the Pin goes high and the relay (driven through a transistor) switches Power to the Sensor. On deepsleep the Pin goes into high impedance and the relay switches off. Maybe you can also use a FET directly instead of the relay.
Re: Only power sensor when not in deep sleep
I was trying to avoid an extra pin. I'm already using the TX pin to power the FET in the same as the relay you propose (to my limited understanding, I'm an electronics novice, more software oriented). The ESP-01S offers two native GPIOs (one hard-coded to the on-board LED) and two additional GPIOs so long as you don't need serial comms to your computer. So I'd like:
- GPIO 0 - sensor input
- GPIO 2 - LED indicator of sensor binary status
- TX GPIO - I2C clock or data to LCD
- RX GPIO - I2C data or clock to LCD
Re: Only power sensor when not in deep sleep
You could add an i2c port expander for more pins.
Or just get an ESP module with more pins... save yourself the hassle and complexity.
Or just get an ESP module with more pins... save yourself the hassle and complexity.
Re: Only power sensor when not in deep sleep
Jep, get an ESP Module with more Pins. ESP32 modules are not expensive!
Re: Only power sensor when not in deep sleep
I haven't found anything else as small as the ESP-01S with an integrated wifi antenna. Do you think there is an equivalent alternative, either ESP8266 or ESP32?
Re: Only power sensor when not in deep sleep
I think this is one of the smallest formfactors for the ESP32: Directly the module WROVER from Espressif!
https://www.aliexpress.com/item/33006996531.html
Bonus: It's got 4 MB of PSRAM. Thats a lot of memory for micropython.
On the negative side: It needs a regulated power source of about 3 / 3.3 Volts and a pullup on reset. But that's all what's really needed externally.
https://www.aliexpress.com/item/33006996531.html
Bonus: It's got 4 MB of PSRAM. Thats a lot of memory for micropython.
On the negative side: It needs a regulated power source of about 3 / 3.3 Volts and a pullup on reset. But that's all what's really needed externally.
Re: Only power sensor when not in deep sleep
That is pretty cool, but to be clear, that's a surface-mount (or snap-mount, I'm not sure of the technical term) device, which means it needs an entire support infrastructure before it can be used. Presumably there is a board with a snap-in slot built exactly for that to fit into, but then I'm back to my original question: how big is the surrounding board that it fits into.
But you do have me curious. I'll see if I can find the board that's supposed to pair up with. That's pretty tantalizing. I'm willing to believe that the ESP8266 is essentially outdated by the ESP32, if I can just find the right device.
Thanks.
But you do have me curious. I'll see if I can find the board that's supposed to pair up with. That's pretty tantalizing. I'm willing to believe that the ESP8266 is essentially outdated by the ESP32, if I can just find the right device.
Thanks.
-
- Posts: 169
- Joined: Fri Aug 19, 2016 11:55 am
Re: Only power sensor when not in deep sleep
Only slightly larger than an ESP-01 module, this is the smallest full-featured ESP8266 (actually, ESP8285 = ESP8266 + 1 MB flash) board I have: https://www.tindie.com/products/onehors ... ent-board/
For the ESP32, I would check out the TinyPICO: https://www.crowdsupply.com/unexpected-maker/tinypico
For the ESP32, I would check out the TinyPICO: https://www.crowdsupply.com/unexpected-maker/tinypico
Re: Only power sensor when not in deep sleep
Yeah. Thanks for pointing me that way. I admit, I'm interesting in cheaper options, but your comment pushed me in a whole direction. I was totally unfamiliar with the ESP8285 and the numerous boards built around it.