GPIO problem with deep sleep

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
skittlez
Normal user
Posts: 13
Joined: 30 Apr 2019, 03:42

GPIO problem with deep sleep

#1 Post by skittlez » 27 May 2019, 03:14

Hi, great software, I am trying to do something pretty simple: I just want my device to wake up, send the sensor readings to syslog, and then power off.

I have a BME280 so it reads pressure, humidity, and temperature. Set to do this every 6 seconds

I really need the BME280 sensor to be powered down between readings (while in deep sleep) otherwise it will consume power and heat up.

Deep sleep setting is sleep awake = 10 seconds on, sleep time = 60 seconds.

The supply to the BME280 is on GPIO1 and I also have an LED on GPIO3 (I have also tried GPIO0 and GPIO2 with the same result)

So I am simply setting using these rules:

Code: Select all

On System#Wake do
  gpio,1,1
  gpio,3,1
endon

On System#Sleep do
  gpio,1,0
  gpio,3,0
endon
I have a Syslog server collecting messages (reverse order):

Code: Select all

05-27-2019	11:08:43	Kernel.Notice	192.168.0.61	 Controller EspEasy: SLEEP: Powering down to deepsleep...
05-27-2019	11:08:43	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: System#Sleep
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: System#NoSleep=30
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: SLEEP: Entering deep sleep in 30 seconds.
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: SW   : GPIO 3 Set to 0
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: ACT  : gpio,3,0
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: SW   : GPIO 1 Set to 0
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: ACT  : gpio,1,0
05-27-2019	11:08:13	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: System#Sleep
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: BME280#Pressure=990.39
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: BME280#Humidity=35.62
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: BME280#Temperature=23.84
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: BME280 : Barometric Pressure: 990.39
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: BME280 : Humidity: 35.62
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: BME280 : Temperature: 23.84
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: BME280 : Address: 0x76
05-27-2019	11:08:06	Kernel.Notice	192.168.0.61	 Controller EspEasy: BME280: dew point 7.68C
05-27-2019	11:08:03	Kernel.Notice	192.168.0.61	 Controller EspEasy: WD   : Uptime 1 ConnectFailures 0 FreeMem 18616 WiFiStatus 3
05-27-2019	11:08:03	Kernel.Notice	192.168.0.61	 Controller EspEasy: EVENT: System#NoSleep=10
05-27-2019	11:08:03	Kernel.Notice	192.168.0.61	 Controller EspEasy: Webserver: start
It's only occasionally that it says instead that it will go to deep sleep in 30 seconds (not sure why this is)

Anyway, they go off as promised by the Syslog, but as soon as it goes into full deep sleep, the GPIOs come back on again!! They stay on until it comes back out of deep sleep! Do I have to put in pull-down resistors?

Why is this??

Thanks for any help

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO problem with deep sleep

#2 Post by TD-er » 28 May 2019, 10:35

Please have a look at this page in the docs about pins to use: https://espeasy.readthedocs.io/en/lates ... on-esp8266

It does describe what the default condition of some of the pins is regarding pull-up or pull-down.
GPIO-0 and 2 need to be pulled up and GPIO-15 needs to be pulled down or else it would not boot. This means that almost any board out there will have these pins connected to pull-up resistors.
Some bare modules like the ESP12-S even have these pull up/down resistors embedded under the metal cover.

GPIO3 and 1 are mainly used for the serial0 port and thus also may have an undefined condition during boot.

skittlez
Normal user
Posts: 13
Joined: 30 Apr 2019, 03:42

Re: GPIO problem with deep sleep

#3 Post by skittlez » 29 May 2019, 11:46

Thanks very much, used the recommended pins and it works.

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: GPIO problem with deep sleep

#4 Post by kimot » 29 May 2019, 21:20

I am using this sensor too with deepsleep and no "heating" on my board.
It is placed along previously used DS18B20 and both temperatures are almost identical.
And I suppose, that BME280 plugin switch this circuit to power save mode between measurements.
But if not, 3.6 μA working current is not capable heat BME280 and is not significant for battery drain.

Current consumption
1.8 μA @ 1Hz humidity and temperature
2.8μA @ 1Hz pressure and temperature
3.6 μA @ 1 Hz humidity, pressure and temperature
0.1 μA in sleep mode

Outdoor - DS18B20
Outdoor_combo - BME280


chart.jpeg
chart.jpeg (59.25 KiB) Viewed 16626 times

skittlez
Normal user
Posts: 13
Joined: 30 Apr 2019, 03:42

Re: GPIO problem with deep sleep

#5 Post by skittlez » 30 May 2019, 07:01

Thanks for the reply, and very nice results, that's pretty much what I want to achieve

Would you mind sharing your setup?
What are your sleep/wake times? What is the timer set for BME280? Where are you logging the data?
Any info would be very helpful

Thanks!

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: GPIO problem with deep sleep

#6 Post by kimot » 05 Jun 2019, 19:36

Wemos D1 + power bank 2500mAh ( about 7 days working time )
Data are send every 5 min to Domoticz.
If I forgot recharge battery, Domoticz sends me email ( and SMS notification ) after 15 min without incoming data from sensor.

skittlez
Normal user
Posts: 13
Joined: 30 Apr 2019, 03:42

Re: GPIO problem with deep sleep

#7 Post by skittlez » 06 Jun 2019, 08:27

That sounds perfect.
Could i ask: what do you have these set to:

Image

And the Interval setting under devices?

Image

kamly12
New user
Posts: 1
Joined: 17 Sep 2020, 13:21

Re: GPIO problem with deep sleep

#8 Post by kamly12 » 17 Sep 2020, 13:24

hi, i am from Australia.wow great work, I was having this GPIO problem with deep sleep. thanks for the help. I will try this after taking some rest. I think my bed and bed sheets are calling me badly lol.
supreme Bed sheets in Australia https://www.elanlinen.com.au/bed-sheets

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO problem with deep sleep

#9 Post by TD-er » 17 Sep 2020, 21:29

kamly12 wrote: 17 Sep 2020, 13:24 hi, i am from Australia.wow great work, I was having this GPIO problem with deep sleep. thanks for the help. I will try this after taking some rest. I think my bed and bed sheets are calling me badly lol.
Make sure to have the correct pins connected before you go into deep sleep yourself :)

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests