Turn off i2c sensor when esp is in deep sleep

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

Turn off i2c sensor when esp is in deep sleep

#1 Post by karl222 » 23 Aug 2017, 17:22

Hi all,

Has anyone developed a solution to run a esp8266 with espeasy and an i2c sensor, where the sensor is switched of, when esp is in deep sleep. When sensor is not turned off, it will empty the battery.

Any ideas or plans ho to realize that.

Best regards
Karl

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Turn off i2c sensor when esp is in deep sleep

#2 Post by grovkillen » 23 Aug 2017, 18:32

You can always use a relay that cut the incoming current to the sensor(s).
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: Turn off i2c sensor when esp is in deep sleep

#3 Post by LisaM » 23 Aug 2017, 22:49

grovkillen wrote: 23 Aug 2017, 18:32 You can always use a relay that cut the incoming current to the sensor(s).
A Relay??? Doesn't that eat a LOT of precious power?
Google is your friend:
sensor sleep.jpg
sensor sleep.jpg (171.7 KiB) Viewed 14166 times

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Turn off i2c sensor when esp is in deep sleep

#4 Post by grovkillen » 24 Aug 2017, 06:12

LisaM wrote: 23 Aug 2017, 22:49 A Relay??? Doesn't that eat a LOT of precious power?
Yes you are right but that depends on the battery. Here's a low power consumption relay: http://www.azettler.com/ultra-low-power ... lications/
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: Turn off i2c sensor when esp is in deep sleep

#5 Post by karl222 » 24 Aug 2017, 10:32

Of course i can switch it off via relay. Thanks for the transistor solution!

How should parameters for espeasy should look like? How can i configure espeasy in order to activate a gpio for lets say 15 sec.or for uptime of esp...

By the way, i am using that kind of battery shield, which works very well https://www.aliexpress.com/item/Wemos-1 ... st=ae803_2
Regards
K

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Turn off i2c sensor when esp is in deep sleep

#6 Post by grovkillen » 24 Aug 2017, 10:53

karl222 wrote: 24 Aug 2017, 10:32 ...
By the way, i am using that kind of battery shield, which works very well https://www.aliexpress.com/item/Wemos-1 ... st=ae803_2
...
Thanks for that link! Ordered 2 straight away! :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Turn off i2c sensor when esp is in deep sleep

#7 Post by papperone » 24 Aug 2017, 12:09

what is the difference between this "shield" (whic is not a shield :) ) and a normal power bank for 1x18650 that can be found for 1€ or less?
as well I built for testing purpouses a simple "shiled" with a 18650 battery holder and a TP4056 module which gives same functionality of this one and as well GND separation betweek charing circuit and output pins
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: Turn off i2c sensor when esp is in deep sleep

#8 Post by LisaM » 24 Aug 2017, 14:11

karl222 wrote: 24 Aug 2017, 10:32 Of course i can switch it off via relay. Thanks for the transistor solution!

How should parameters for espeasy should look like? How can i configure espeasy in order to activate a gpio for lets say 15 sec.or for uptime of esp...

By the way, i am using that kind of battery shield, which works very well https://www.aliexpress.com/item/Wemos-1 ... st=ae803_2
Regards
K
I agree with papperone: The battery shield doesn't make any sense to me, since you're using an usb cable anyway why not use an usb battery pack? You can buy them anywhere cheap and it will last a lot longer then an AA battery...

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Turn off i2c sensor when esp is in deep sleep

#9 Post by Shardan » 24 Aug 2017, 15:13

As far as i know the ESP does a reboot when waking from deepsleep.
If I remember this correct then any solution with a relay or transistor to switch an I²C sensor will fail.
On startup the I²C init runs before the rules start. But it needs a rule to switch the relay or transistor
so the I²C init runs before the sensor is powered. So no values will be shown ever.

It might be possible if the driving GPIO is set to high by hardware settings. I don't know how these settings behave in deepsleep.

The best way would be using the built-in sleep functions of the sensor.

Anyways the question is if these efforts pay at all. A view into datasheets helps to decide.

For example the BME-280 driven in "auto-mode", (highest power consumption) metering all vallues once per second
has a power consumption of 3,6µA! From the datasheet:

Code: Select all

3.6 µA @ 1 Hz humidity, pressure and temperature
So a well prepared BME-280 or modified (voltage regulator removed) breakout board with BME-280 should run for long times.

A SI7021 (SHT21 Sensor) needs much more current, around 330µA. If the sensor is heated for reconditioning it may rise to 1,5 mA
so it will pay to put this sensor into sleep mode.

So at the end the way is to first take a look into datasheets and chose the sensor wisely.
This might make all of the changes and circuits obsolete.

Regards
Shardan
Regards
Shardan

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: Turn off i2c sensor when esp is in deep sleep

#10 Post by LisaM » 24 Aug 2017, 18:17

Shardan wrote: 24 Aug 2017, 15:13 As far as i know the ESP does a reboot when waking from deepsleep.
If I remember this correct then any solution with a relay or transistor to switch an I²C sensor will fail.
On startup the I²C init runs before the rules start. But it needs a rule to switch the relay or transistor
so the I²C init runs before the sensor is powered. So no values will be shown ever.

It might be possible if the driving GPIO is set to high by hardware settings. I don't know how these settings behave in deepsleep.

The best way would be using the built-in sleep functions of the sensor.

Anyways the question is if these efforts pay at all. A view into datasheets helps to decide.

For example the BME-280 driven in "auto-mode", (highest power consumption) metering all vallues once per second
has a power consumption of 3,6µA! From the datasheet:

Code: Select all

3.6 µA @ 1 Hz humidity, pressure and temperature
So a well prepared BME-280 or modified (voltage regulator removed) breakout board with BME-280 should run for long times.

A SI7021 (SHT21 Sensor) needs much more current, around 330µA. If the sensor is heated for reconditioning it may rise to 1,5 mA
so it will pay to put this sensor into sleep mode.

So at the end the way is to first take a look into datasheets and chose the sensor wisely.
This might make all of the changes and circuits obsolete.

Regards
Shardan
Just use gpio15, this pin goes to zero at bootup time therefore enabling the sensor by default... ;)
The MH-Z19 uses a LOT more power: upto 18mA average!

karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: Turn off i2c sensor when esp is in deep sleep

#11 Post by karl222 » 01 Sep 2017, 22:56

Hi,

many thanks for your input. the smartest way to get a long battery duration is to use a sensor with low current like the BME 280. I am going to use this one.

best regards
karl

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Turn off i2c sensor when esp is in deep sleep

#12 Post by Drum » 25 Sep 2017, 12:29

I have an outdoor unit, BME280, ESP8285, single 18650 battery, a small solar cell and charging circuit. I have not had a problem yet, but I am waiting to see if it will last through the winter without going down. There are a lot of cloudy days over the winter.

IF needed you could use soemthing like a MCP-1825 with enable pin as a separate power supply for the sensors and tie to CH_EN on the esp. When the ESP goes to sleep, it should pull the enable pin low and turn off the power supply.

I am also waiting for a new component, 512-KA75330ZTA, to keep the battery from getting drained down too far. When the battery voltage drops below 3.3V it should shut down the MCP1825 and when the power comes back up, it should turn on again. In theory, reality may be different. Should have some in my hands to try this week. :D

karl222
Normal user
Posts: 90
Joined: 23 Aug 2017, 17:18
Location: Vienna

Re: Turn off i2c sensor when esp is in deep sleep

#13 Post by karl222 » 30 Sep 2017, 15:16

interesting!
please keep me updated

with my solution I am running the sensor 6-8 weeks on one full 18650 cell... this is ok for me now.

regards
karl

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Turn off i2c sensor when esp is in deep sleep

#14 Post by Drum » 02 Oct 2017, 00:22

KA75330ZTA seems to be working. The 18650 was 3.3V when I replaced it today on a soil moisture sensor I have been testing. This one has a small solar cell in a window so it ocasionally runs out when we have cloudy days.

I need to do some more testing to make sure it will recover.

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests