IOT-MCU / ESP-12S-A9-A9G-GPRS-Node-v1.0

63 stars 27 forks source link

ESP8266 cannot run Deep Sleep function #13

Open rcomellas opened 3 years ago

rcomellas commented 3 years ago

I was trying to run the Deep Sleep function of the ESP8266 to save energy between GPS readings. The problem is that according to Espressif specifications pin GPIO16 of the ESP should be tied to RST pin, but in IOT-MCU board GPIO16 is already connected to A9G PWRKEY (pin 9). This makes impossible to use deep sleep in this module. Am I right?

sadamyne commented 3 years ago

Hi, I'm no expert but i couln't find a way to change the gpio 16, i think another problem would be the reset pin, from what i can tell you would have to solder a wire to the reset switch. So i think you can only do modem sleep and light sleep with this board.

gaijinsr commented 3 years ago

I use the ADC functionality to monitor the battery voltage, so I don't need the external ADC pin. I removed the two resistors that form the voltage divider for the ADC pin and soldered a little jumper from the reset pad of the ESP to the resistor pad that connects to the external ADC pin. Much cleaner and less prone to mechanical failure than soldering a pin to the reset switch (which I tried earlier).

gaijinsr commented 3 years ago

Maybe I should mention that I did this because I use an ADXL345 acceleration sensor to wake up the ESP in case of movement. It is possible to program the ADXL interrupt pin to active low, so it can be used to drive the reset pin of the ESP.

sadamyne commented 3 years ago

I have been trying to enter a sleep mode and reduce the battery consuption. I need to wake the module each hour, read a value a send it. Have you manage to turn the gprs/gsm module off to reduce consumption?

rcomellas commented 3 years ago

I have been trying to enter a sleep mode and reduce the battery consuption. I need to wake the module each hour, read a value a send it. Have you manage to turn the gprs/gsm module off to reduce consumption?

According to the documentation, to turn the module A9G off you have to pull the power off pin of the A9g high for 3 seconds and then pull it LOW for 5 seconds. The code could look something like:

    #define A9G_POFF 15  //ESP12 GPIO15 A9/A9G POWOFF 
    digitalWrite(A9G_POFF, HIGH);
    delay(3000);
    digitalWrite(A9G_POFF, LOW);
    delay(5000);`
sadamyne commented 3 years ago

Hi, Thanks for the ansker, could you please point me to the docs, can't seem to find any usefull one.

I tried this sketch: `#include

define DEBUG TRUE

define BAUD_RATE 115200

define A9_BAUD_RATE 9600

/***/

define A9G_PON 16 //ESP12 GPIO16 A9/A9G POWON

define A9G_POFF 15 //ESP12 GPIO15 A9/A9G POWOFF

define A9G_WAKE 13 //ESP12 GPIO13 A9/A9G WAKE

define A9G_LOWP 2 //ESP12 GPIO2 A9/A9G ENTER LOW POWER MODULE

SoftwareSerial swSer(14, 12, false);

void setup() { // Start serial ports Serial.begin(BAUD_RATE); swSer.begin(A9_BAUD_RATE);

// A9G control pins pinMode(A9G_PON, OUTPUT);//LOW LEVEL ACTIVE pinMode(A9G_POFF, OUTPUT);//HIGH LEVEL ACTIVE pinMode(A9G_LOWP, OUTPUT);//LOW LEVEL ACTIVE Serial.println("Turn on"); digitalWrite(A9G_PON, LOW); digitalWrite(A9G_POFF, HIGH); digitalWrite(A9G_LOWP, LOW);

delay(5000); //ESP12 GPIO15 A9/A9G POWOFF

delay(3000); digitalWrite(A9G_POFF, HIGH); Serial.println("HIGH"); delay(3000); digitalWrite(A9G_POFF, LOW); Serial.println("LOW"); delay(5000);

Serial.println("Setup ended"); }

void loop() { // put your main code here, to run repeatedly:

}` But i still have a power consultion of aroung 100 mA. Any ideias?

Thanks in advance

rcomellas commented 3 years ago

https://github.com/IOT-MCU/ESP-12S-A9-A9G-GPRS-Node-v1.0 there are some examples of how to turn off the module. This turns off A9G module but not the ESP8266.

gaijinsr commented 3 years ago

Hi, I do it like this:

if ( millis()-lastmove > 15*60000 ) { Serial.println("No movement for more than 15 min - going to deep sleep."); digitalWrite(STATUS_LED, HIGH); // switch off status led A9GPOWEROFF(); delay(1000); A9GPOWEROFF(); // just making sure delay(100); // activate reset from movement detection interrupt adxl.setActivityXYZ(1, 1, 1); adxl.getInterruptSource(); // before we go to sleep: clear interrupts delay(100); ESP.deepSleep(0); }

rcomellas commented 3 years ago

Hi @gaijinsr, what is STATUS_LED? Which GPIO?

gaijinsr commented 3 years ago

Hi, I use

define STATUS_LED 2 // ESP12 builtin LED on GPIO2

this is the blue LED on the ESP module.

sadamyne commented 3 years ago

Hi,

Thanks for the info. Have you guys measured the power consuption of the board? Using a USB meter, the minimum i was able to got (without batery) was 27 mA using the esp light sleep.

LucaDanelutti commented 3 years ago

Hi, I do it like this:

if ( millis()-lastmove > 15*60000 ) { Serial.println("No movement for more than 15 min - going to deep sleep."); digitalWrite(STATUS_LED, HIGH); // switch off status led A9GPOWEROFF(); delay(1000); A9GPOWEROFF(); // just making sure delay(100); // activate reset from movement detection interrupt adxl.setActivityXYZ(1, 1, 1); adxl.getInterruptSource(); // before we go to sleep: clear interrupts delay(100); ESP.deepSleep(0); }

Could you please share the functions for movement detection interrupts?

Nasir664Ahmed commented 2 years ago

Hello every body, I have an other problem with esp8266, I will be glad if anyone can figure out the solution. Outlines: I am trying to implementing Motion Capture System for 3D Animation, based on ESP8266 and GY85 (ADXL345), to transfer X,Y,Z in runtime to java script program on PC and also to run directly (in runtime) in 3ds max character. It is perfect and cheap I saw this in Ragesh tutorial: Video URL: https://youtu.be/6DK1hjSuteA Done steps: