I'd appreciate if someone could explain to me why my ESP32 module does not power down when in deep sleep mode? The ESP32 is connected to a battery shield like this: https://www.aliexpress.com/item/4000200 ... web201603_ When I measure the output of 3.3v pin it does not powe down during deep sleep. My code as follows:
Code: Select all
#include "DHT.h"
#include <SPI.h>
#include <LoRa.h>
//define the pins used by the LoRa transceiver module
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
//915E6 for North America
#define BAND 915E6
// How many minutes the ESP should sleep
#define DEEP_SLEEP_TIME 5
// defines poll frequency
unsigned long previousMillis = 30000;
const long interval = 30000;
//loop counter
int counter = 0;
void goToSleep()
{
// Configure the timer to wake us up!
esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME * 60L * 1000000L);
Serial.println("Going To Sleep Now...");
// Go to sleep! Zzzz
esp_deep_sleep_start();
//esp_light_sleep_start();
}
void setup() {
Serial.begin(115200);
Serial.println("Welcome");
//SPI LoRa pins
SPI.begin(SCK, MISO, MOSI, SS);
//setup LoRa transceiver module
LoRa.setPins(SS, RST, DIO0);
while (!LoRa.begin(BAND)) {
Serial.println(".");
delay(500);
}
Serial.println("LoRa Initializing OK!");
delay(2000);
}
void loop() {
// Wait a few seconds between measurements.
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
counter++;
Serial.print("Pass #: ");
Serial.println(counter);
if (counter >= 2) {
Serial.println("Sleep Time?...");
goToSleep();
}
}
}