ESP Easy and GPIO in deep sleep

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
pfuhsy
New user
Posts: 2
Joined: 16 Oct 2018, 15:13

ESP Easy and GPIO in deep sleep

#1 Post by pfuhsy » 16 Oct 2018, 15:46

Hello everybody,

i use the ESP12 together with the sensor HC SR04. The ESP12 is flashed with firmware ESPEasy "Release mega-20180606" by github. Btw, excellent work, thanks for this.
I woud like to design an electrical circuit with battery supply, in this part the power consumption is very important and i use an DC-DC-Converter also for the sensor. The sensor consumes electricity approximately 2mA in stand by, which is cleary too much.
Is it possible to use an gpio outpiut by the ESP12 to shutdown the DC-DC-Converter from the sensor before the ESP12 change to deepsleep mode ? According to the motto: I wake up, sensor will switched on. I'm done, sensor will switched off. I'll go back to sleep. Are there other possibilities to shutdown the supply of the sensor to save electricity, since I will not use another controller.

Here I am only concerned with the functionality of espeasy and not possibilities of the sensor or the converter.

Greetings

pfuhsy
New user
Posts: 2
Joined: 16 Oct 2018, 15:13

Re: ESP Easy and GPIO in deep sleep

#2 Post by pfuhsy » 16 Oct 2018, 21:11

Ok guys. Forget it, i did not think. By command i have possibility to switch an gpio output. When the ESP12 is in deep sleep, the outout is low automaticly.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: ESP Easy and GPIO in deep sleep

#3 Post by Wiki » 18 Oct 2018, 18:06

Hi,

I am running the HC SR04 on a battery powered node, too. My first solution has been the same as yours. But I noticed, that the state of the GPIO during deep sleep seems to be not clearly defined, sometimes I got a real voltage drop of the battery. Also I noticed, that the wakeup current of the SR04 sometimes is pretty high, I assumed thats the 470µF capacitor to be charged.

Now the SR04 gets its GND switched by a npn transistor, the 5V pin is directly connected to a low quiescent current voltage regulator. Additinonally I have set the rule

Code: Select all

On System#Sleep do
gpio,5,0
endon
and added a pulldown resistor to the gpio.

I think, now I'm safe.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

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

Re: ESP Easy and GPIO in deep sleep

#4 Post by grovkillen » 03 Nov 2018, 13:52

I added an example for how to handle rules during wake time:

https://www.letscontrolit.com/wiki/inde ... es_example
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:

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: ESP Easy and GPIO in deep sleep

#5 Post by EDsteve » 23 Nov 2019, 14:59

Hi,

I have a similar problem, but don't really understand how you guys solved that. Can you make a quick and dirty schematics of how you did that?
These rules seem to work only with added components i guess?:

Code: Select all

On System#Sleep do
gpio,5,0
endon
Trying to build a solar powered dust sensor. So i have a PMS7003 (dust sensor with fan) connected to a Wemos D1 with a battery shield. But every time the Wemos goes into deep sleep. All the GPIO pins are high which keeps the fan from the dust sensor on even in sleep mode.

I need to send a LOW to the SET or RESET pin of the dust sensor in order to turn off the fan. But in sleep mode all GPIO pins are HIGH on the wemos. So how do i do that?
Here is the pinout and infos of the dust sensor if needed: https://www.espruino.com/PMS7003

sobolkz
Normal user
Posts: 37
Joined: 12 Sep 2019, 16:30

Re: ESP Easy and GPIO in deep sleep

#6 Post by sobolkz » 24 Nov 2019, 12:54

EDsteve wrote: 23 Nov 2019, 14:59 Hi,
I need to send a LOW to the SET or RESET pin of the dust sensor in order to turn off the fan. But in sleep mode all GPIO pins are HIGH on the wemos. So how do i do that?
Here is the pinout and infos of the dust sensor if needed: https://www.espruino.com/PMS7003
Hi!
As described before (also in other topics) - there is two ways - you can use pull down resistor at SET or (and) Reset lines. Without external transistors you should switch it UP after waking up from deep sleep. It can fix software power down control for PMS7003. It's partially explained at https://www.espruino.com/PMS7003, but as I understand SW power controlling code of PMS7003 wasn't released in P053 code.
Another way - is to use external transistor as key at power line of PMS7003. There in tons of examlpes how to make this way work - for example (perfect guide here - https://randomnerdtutorials.com/latchin ... 6-arduino/). By the way - I'm using it's simplified version in my project.
BUT! As I see you are using Wemos D1 with a battery shield, is it old release 1.1 or newest one? Old one isn't perfect for external sensors powering, because voltage was dropping at all parts of this board before it was delivered to D1, and it can be dramatically decreased for external sensors. Therefore you CAN'T use ordinary n-p-n or p-n-p transistors for keys, it should be MOSFET due to low voltage drops.
For example - my searches in best schematic for D1 mini Pro + OLED Screen + BME280 + PMS7003 + (ideally) Senseair S8 with battery backup device was ended without Wemos Battery Shield due to it's low current and big voltage drops. Finally battery backup scheme was maked with one battery charging module and one boost up to 5V module (one powerbank module can be used instead this two modules). Boost up module was connected to battery through P-channel MOSFET and one free D1 pin. This pin was changing it's state after board going back from deep sleep. Therefore 5V line isn't powered in deep sleep and battery was not used for external sensors, that theoretically can save it's charge level.

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: ESP Easy and GPIO in deep sleep

#7 Post by EDsteve » 25 Nov 2019, 09:05

Thanks for your detailed answer. That should even help me :)
Somehow i am having problems to bring the Wemos into deep sleep now (Yes. GPIO 16 and RST is connected). Not really sure why... It just doesn't go to sleep...
But i will report back after i figured it all out :)

EDIT:
Working now. Faulty wire jumper gave me troubles... GRRR
I chose the simple solution and added 100Ohr resistor from Set to GND. It's solar powered. So i am okay if it's not super low power in sleep mode. But works like a charm now.

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests