• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

turn on the oled display for 10 secundes with NodeMCUesp32 and then off

Q&A Forum › Category: ESP32 › turn on the oled display for 10 secundes with NodeMCUesp32 and then off
0 Vote Up Vote Down
Jwan asked 4 years ago

Hello, everyone, I have the following problem. I want that my NodeMCU esp32 to read the temperature sensor data and send it to thingspeak every 10 minutes. Then go to deep sleep. This works fine. With a push button I want also to wake up the esp32 from deep sleep and show the  temperature value on the display for 10 seconds. Then the display should switches off to save power until I press the push button again. The problem is when I wake up the esp 32 from deep sleep with the push button (GPIO33 with pull down) to show the  temperature value on the display, it does not work. I mean the ESP32 wakes up but doesn’t show any data on the display. What am I doing wrong here. Please It would be very nice if someone could help me. Many Thanks
Here is the pastebin link

1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
You’re implementing external wake-up wrong.
You can’t implement it like this:

if (esp_sleep_enable_ext0_wakeup(GPIO_NUM_33, 1) == true) //if the push button pressed then wake up and display temperature value on oled display

 
You have to add the following in the setup(), so that the ESP know that that wake up mode is activated:

esp_sleep_enable_ext0_wakeup(GPIO_NUM_33, 1);

 
Then, to check whether it was awaked by timer or by an external wake-up, you can create something based on the following function:

void print_wakeup_reason(){
  esp_sleep_wakeup_cause_t wakeup_reason;

  wakeup_reason = esp_sleep_get_wakeup_cause();

  switch(wakeup_reason)
  {
    case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break;
    case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
    case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;
    case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;
    case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;
    default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;
  }
}

See the complete example in our tutorial: https://randomnerdtutorials.com/esp32-external-wake-up-deep-sleep/
I hope this helps.
 
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.