ESP01: power I2C sensor from board instead of battery

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Posts: 20
Joined: Sun Dec 01, 2019 3:04 pm

ESP01: power I2C sensor from board instead of battery

Post by djipey » Thu Jun 18, 2020 10:16 am


I recently made a small setup to report temperature, pressure and humidity every 10 minutes.
The system is made of:

- ESP01
- BME280 (it's an I2C sensor)
- Battery (CR 123, lithium). This battery provides a ~3.3V current during its lifetime, no need to level the voltage

I made some hardware modification on the ESP01: I soldered one of the small pins of the MCU to the reset pin (as mentioned in many tutorials on the web) to enable the deepsleep. The deepsleep works, I'm able to put the ESP01 in deepsleep mode, and I can wake it up every 10 minutes. I also removed the status LED.

Regarding the wiring:

Battery + -> pin Vin of the I2C sensor
Battery - -> GND pin of the I2C sensor

Battery + -> pin Vin of the ESP01
Battery - -> GND pin of the ESP01

ESP01 GPIO 0 -> SCL pin of the sensor
ESP01 GPIO 2 -> SDA pin of the sensor

This setup works, I'm able to read the sensor every 10 minutes, when the board gets out of deep sleep. No problem there.

However, I could only get this setup to work for 2 days, then the battery was depleted (I checked its voltage with a multimeter, it was around 2.6V).

My knowledge in electronics is pretty limited, but I suspect my wiring isn't correct: the sensor is powered from the battery directly and is ON all the time, and drains the battery. Could you please confirm this?

I then have a question: I think it's possible to power the sensor from the board directly, by connecting the Vin pin of the sensor to one of the GPIO of the ESP01. I could switch this GPIO to high to provide power. The sensor doesn't need much power so it should be doable, right?

However, all the GPIOs of the ESP01 are occupied in my setup. Is it possible to use either TRX, RDX or RST to power the sensor? If yes, how?

Post Reply