Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266 cannot run Deep Sleep function #13

Open
rcomellas opened this issue Jul 9, 2020 · 13 comments
Open

ESP8266 cannot run Deep Sleep function #13

rcomellas opened this issue Jul 9, 2020 · 13 comments

Comments

@rcomellas
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

sadamyne commented Aug 1, 2020

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
Copy link
Author

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
Copy link

sadamyne commented Aug 2, 2020

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 <SoftwareSerial.h>

#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
Copy link
Author

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
Copy link

gaijinsr commented Aug 3, 2020

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
Copy link
Author

Hi @gaijinsr,
what is STATUS_LED? Which GPIO?

@gaijinsr
Copy link

gaijinsr commented Aug 5, 2020

Hi, I use
#define STATUS_LED 2 // ESP12 builtin LED on GPIO2
this is the blue LED on the ESP module.

@sadamyne
Copy link

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
Copy link

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
Copy link

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:

  • I got ESP8266 and GY85 hardware. And CP2102 UART to USB convertor.
  • I linked 3V3 of CP2102 with 3V3 of ESP8266.
  • I linked GND of CP2102 with GND of ESP8266
  • I linked TXD of CP2102 with RX of ESP8266
  • I linked RXD of CP2102 with TXD of ESP8266
  • I linked EN of ESP8266 with 3V3 of ESP8266
  • I linked GND of EPS8266 with GPIO0 of ESP8266
  • I used Arduino with all necessary steps (specifying port from computer manager, and speed..etc)
  • I tested by blink, Upload Completed.
    THE PROBLEM:
  • I tried different codes to start motion capture by wireless but it didn't work
    What is the suitable code / Codes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants