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
djipey
Posts: 21
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

Hi,

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?

User avatar
Roberthh
Posts: 2759
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP01: power I2C sensor from board instead of battery

Post by Roberthh » Sun May 23, 2021 10:16 am

It is unclear to me what prevents you from using MP with an ESP01. It might not be the best suited MCU for that, and especially the 512k models w/o USB bridge are uncomfortable to handle. But not different than with C/C++. But it's your choice which platform and language to use, and not need to spam all forum threads with that opinion.

karfas
Posts: 33
Joined: Sat Jan 16, 2021 12:53 pm

Re: ESP01: power I2C sensor from board instead of battery

Post by karfas » Mon May 24, 2021 1:47 pm

djipey wrote:
Thu Jun 18, 2020 10:16 am
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 don't think so. See the datasheet for the BME280 - it uses ~0,7 mA during measure, less when no measure is in progress.

A CR123 has (according to Wikipedia) between ~700 and 1500 mAh (CR123A), so the sensor and the ESP in deep sleep will drain the battery in approx. 700..1500 hours.

Either you have some horrible mistake in the wiring or the ESP doesn't enter deep sleep.

You should measure the current from the battery into your circuit and verify yourself what causes the battery drain. I would expect that your circuit uses 10-20 mA (700mAh/48 hours).
My repositories: https://github.com/karfas

Post Reply