NodeMCU-32S ESP32 problem

I bought a new NodeMCU ESP32 and trying to use with DHT22 or BMP180 sensors but after I upload the sketch I always have the below error messages.
The same sensors were working fine with UNO R3 but somehow not with the ESP. I connect the same without resistor.
Is the ESP32 faulty or I do something wrong?

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0xffffffff,len:-1
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

Could you post your whole code, with the words

you may be using the wrong pins on the ESP32.

I uploaded the code again and now the error is only this:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0xffffffff,len:-1
ets Jun 8 2016 00:22:57

The DHT DOUT is connected to P17 as also set in the code. The code I use is the ESP32 sketch:

#include "DHTesp.h" // Click here to get the library: http://librarymanager/All#DHTesp
#include <Ticker.h>

#ifndef ESP32
#pragma message(THIS EXAMPLE IS FOR ESP32 ONLY!)
#error Select ESP32 board.
#endif

//
/* Example how to read DHT sensors from an ESP32 using multi- /
/
tasking. /
/
This example depends on the Ticker library to wake up /
/
the task every 20 seconds */
/
/

DHTesp dht;

void tempTask(void *pvParameters);
bool getTemperature();
void triggerGetTemp();

/** Task handle for the light value read task /
TaskHandle_t tempTaskHandle = NULL;
/
* Ticker for temperature reading /
Ticker tempTicker;
/
* Comfort profile /
ComfortState cf;
/
* Flag if task should run /
bool tasksEnabled = false;
/
* Pin number for DHT11 data pin */
int dhtPin = 17;

/**

  • initTemp
  • Setup DHT library
  • Setup task and timer for repeated measurement
  • @return bool
  • true if task and timer are started
  • false if task or timer couldn't be started
    */
    bool initTemp() {
    byte resultValue = 0;
    // Initialize temperature sensor
    dht.setup(dhtPin, DHTesp::DHT11);
    Serial.println("DHT initiated");

// Start task to get temperature
xTaskCreatePinnedToCore(
tempTask, /* Function to implement the task /
"tempTask ", /
Name of the task /
4000, /
Stack size in words /
NULL, /
Task input parameter /
5, /
Priority of the task /
&tempTaskHandle, /
Task handle. /
1); /
Core where the task should run */

if (tempTaskHandle == NULL) {
Serial.println("Failed to start task for temperature update");
return false;
} else {
// Start update of environment data every 20 seconds
tempTicker.attach(20, triggerGetTemp);
}
return true;
}

/**

  • triggerGetTemp
  • Sets flag dhtUpdated to true for handling in loop()
  • called by Ticker getTempTimer
    */
    void triggerGetTemp() {
    if (tempTaskHandle != NULL) {
    xTaskResumeFromISR(tempTaskHandle);
    }
    }

/**

  • Task to reads temperature from DHT11 sensor
  • @param pvParameters
  • pointer to task parameters
    */
    void tempTask(void *pvParameters) {
    Serial.println("tempTask loop started");
    while (1) // tempTask loop
    {
    if (tasksEnabled) {
    // Get temperature values
    getTemperature();
    }
    // Got sleep again
    vTaskSuspend(NULL);
    }
    }

/**

  • getTemperature
  • Reads temperature from DHT11 sensor
  • @return bool
  • true if temperature could be aquired
  • false if aquisition failed
    */
    bool getTemperature() {
    // Reading temperature for humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
    TempAndHumidity newValues = dht.getTempAndHumidity();
    // Check if any reads failed and exit early (to try again).
    if (dht.getStatus() != 0) {
    Serial.println("DHT11 error status: " + String(dht.getStatusString()));
    return false;
    }
float heatIndex = dht.computeHeatIndex(newValues.temperature, newValues.humidity);

float dewPoint = dht.computeDewPoint(newValues.temperature, newValues.humidity);
float cr = dht.getComfortRatio(cf, newValues.temperature, newValues.humidity);

String comfortStatus;
switch(cf) {
case Comfort_OK:
comfortStatus = "Comfort_OK";
break;
case Comfort_TooHot:
comfortStatus = "Comfort_TooHot";
break;
case Comfort_TooCold:
comfortStatus = "Comfort_TooCold";
break;
case Comfort_TooDry:
comfortStatus = "Comfort_TooDry";
break;
case Comfort_TooHumid:
comfortStatus = "Comfort_TooHumid";
break;
case Comfort_HotAndHumid:
comfortStatus = "Comfort_HotAndHumid";
break;
case Comfort_HotAndDry:
comfortStatus = "Comfort_HotAndDry";
break;
case Comfort_ColdAndHumid:
comfortStatus = "Comfort_ColdAndHumid";
break;
case Comfort_ColdAndDry:
comfortStatus = "Comfort_ColdAndDry";
break;
default:
comfortStatus = "Unknown:";
break;
};

Serial.println(" T:" + String(newValues.temperature) + " H:" + String(newValues.humidity) + " I:" + String(heatIndex) + " D:" + String(dewPoint) + " " + comfortStatus);
return true;
}

void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println("DHT ESP32 example with tasks");
initTemp();
// Signal end of setup() to tasks
tasksEnabled = true;
}

void loop() {
if (!tasksEnabled) {
// Wait 2 seconds to let system settle down
delay(2000);
// Enable task that will read values from the DHT sensor
tasksEnabled = true;
if (tempTaskHandle != NULL) {
vTaskResume(tempTaskHandle);
}
}
yield();
}

You know the ESP32 has an OS called freeRTOS, you do not need to run a muli-tasker on top of a multi tasking, multi processing OS.

That is not an error.

I did not really undertsand your multi tasking comment. This is my fault beccause I am not an expert on this.
I just would like to see the data in the Arduino serial monitor that I cannot for any sensor. Even the Wifi scan exapmle sketch brings the same error message. This simple wifi scan code should not show the SSID's in the serial monitor?

My aim to send the data to Influxdb. I bought the ESP32 because it has wifi modul and Uno R3 did not. But struggle with the ESP.

Wifi sketch:

/*

  • This sketch demonstrates how to scan WiFi networks.
  • The API is almost the same as with the WiFi Shield library,
  • the most obvious difference being the different file you need to include:
    */
    #include "WiFi.h"

void setup()
{
Serial.begin(115200);

// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);

Serial.println("Setup done");

}

void loop()
{
Serial.println("scan start");

// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
Serial.println("scan done");
if (n == 0) {
    Serial.println("no networks found");
} else {
    Serial.print(n);
    Serial.println(" networks found");
    for (int i = 0; i < n; ++i) {
        // Print SSID and RSSI for each network found
        Serial.print(i + 1);
        Serial.print(": ");
        Serial.print(WiFi.SSID(i));
        Serial.print(" (");
        Serial.print(WiFi.RSSI(i));
        Serial.print(")");
        Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
        delay(10);
    }
}
Serial.println("");

// Wait a bit before scanning again
delay(5000);

}

The code you are using to read the sensors is way overcomplicated.

I have done a lot of complex ESP32 projects and never had to use
multitasking like the code above.

sadly the DHT22 example delivered with the arduino-ESP32-core does it this way

Read this tutorial

You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

best regards Stefan

I already tried this code too but I got the same probelm. However in my circuit I do not have the 10K resistor. Could that cause such error? I have doubts because a simple wifi scan code runs the same error.
My serial monitor is on 115200 baud to show normal carachters. As it wrote in the tutorial I should set 9600. If I do that that shows charachters like thi "⸮⸮\⸮d⸮ ,⸮⸮$⸮B;3"

You can change back the baudrate in the program to 115200 baud.
On power-up it is normal that an ESP32 prints messages like you have posted above.

To check if the ESP32 is running properly you should use a much more simpler demo-code than
a WiFi-Scan or reading a sensor.

The simple "Hello world" with blinking an LED will do to check if the ESP32 is running at all.

So here is a demo-code that let's the onboard-LED on IO-pin 2 blink at 2Hz and sends a
"Hello World" message once every second to the serial monitor

void PrintFileNameDateTime() {
  Serial.println("Code running comes from file ");
  Serial.println(__FILE__);
  Serial.print("  compiled ");
  Serial.print(__DATE__);
  Serial.print(" ");
  Serial.println(__TIME__);  
}


boolean TimePeriodIsOver (unsigned long &periodStartTime, unsigned long TimePeriod) {
  unsigned long currentMillis  = millis();  
  if ( currentMillis - periodStartTime >= TimePeriod )
  {
    periodStartTime = currentMillis; // set new expireTime
    return true;                // more time than TimePeriod) has elapsed since last time if-condition was true
  } 
  else return false;            // not expired
}

unsigned long MyTestTimer = 0;                   // variables MUST be of type unsigned long
const byte    OnBoard_LED = 2;


void BlinkHeartBeatLED(int IO_Pin, int BlinkPeriod) {
  static unsigned long MyBlinkTimer;
  pinMode(IO_Pin, OUTPUT);
  
  if ( TimePeriodIsOver(MyBlinkTimer,BlinkPeriod) ) {
    digitalWrite(IO_Pin,!digitalRead(IO_Pin) ); 
  }
}


void setup() {
  Serial.begin(115200);
  Serial.println("Setup-Start");
  PrintFileNameDateTime();

}

void loop() {
  BlinkHeartBeatLED(OnBoard_LED,250);

  if ( TimePeriodIsOver(MyTestTimer,1000) ) {
    Serial.println( F("Hello World") );
  }  
}

The serial output after pressing the reset-button looks like this

10:16:54.533 -> ets Jun  8 2016 00:22:57
10:16:54.533 -> 
10:16:54.533 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
10:16:54.533 -> configsip: 0, SPIWP:0xee
10:16:54.533 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
10:16:54.533 -> mode:DIO, clock div:1
10:16:54.533 -> load:0x3fff0018,len:4
10:16:54.533 -> load:0x3fff001c,len:1216
10:16:54.533 -> ho 0 tail 12 room 4
10:16:54.533 -> load:0x40078000,len:10944
10:16:54.533 -> load:0x40080400,len:6388
10:16:54.533 -> entry 0x400806b4
10:16:54.672 -> Setup-Start
10:16:54.672 -> Code running comes from file 
10:16:54.672 -> F:\MyPortable-PRgs\arduino1.8.13\portable\sketchbook\Simple-ESP32-Demo-Blink-Hello-World-001\Simple-ESP32-Demo-Blink-Hello-World-001.ino
10:16:54.672 ->   compiled Jul  4 2021 10:14:39
10:16:55.608 -> Hello World
10:16:56.627 -> Hello World
10:16:57.605 -> Hello World
10:16:58.627 -> Hello World

So give this a try and report in detail what your ESP32 is showing
best regards Stefan

If you still got no serial output we have to go through a lot of details to check if everything is alright:

  • did you install the ESP32-board by adding the additional board URL in the preferences?
    Post this board-url

  • did you restart the Arduino-IDE after installing the ESP32 board?

  • did you choose an ESP32 board under the "tools"-menu of the Arduino-IDE

  • which ESP32 board did you choose? I usally use the ESP32 dev module regardless of which ESP32-board I'm using

What adjustements are shown for all the board-Options?

I use these

What does the compile and upload-window at the bottom if the Arduino-IDE show?
it should show something similar to this

esptool.py v3.0-dev
Serial port COM5
Connecting....
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:6f:28:22:b6:90
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 5957.9 kbit/s)...
Hash of data verified.
Compressed 18656 bytes to 12053...
Writing at 0x00001000... (100 %)
Wrote 18656 bytes (12053 compressed) at 0x00001000 in 0.2 seconds (effective 956.7 kbit/s)...
Hash of data verified.
Compressed 205264 bytes to 106523...
Writing at 0x00010000... (14 %)
Writing at 0x00014000... (28 %)
Writing at 0x00018000... (42 %)
Writing at 0x0001c000... (57 %)
Writing at 0x00020000... (71 %)
Writing at 0x00024000... (85 %)
Writing at 0x00028000... (100 %)
Wrote 205264 bytes (106523 compressed) at 0x00010000 in 1.6 seconds (effective 1055.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 1755.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

best regards Stefan

I think my configs are ok but send you some printscreen. I use the "NodeMCU-32S" from the boards since that is the type of mine. I chose the dev module that you use but the same message I got.
115200 baud rate was also tried by me before but did not work out either.

My configs:


Board manager URL is: https://dl.espressif.com/dl/package_esp32_index.json, https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

I will try this Hello World that you suggest

Hello World also not work. Led is not blinking and the same message in Serial monitor. Something is very wrong on my side...

I beg you post the code with this method
You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

You can do the same for the compile-output window:
simply click into the window and press Ctrl-A, Ctrl-C to copy everything into the clipboard
then paste the clipboard-content in a new *.ino-file and delete the details and only keep the bottom-lines

Post a picture of how your ESP32 looks like and how it is connetced to your computer
best regards Stefan

Did you open the serial monitor?

Do you know what the serial monitor is?

Please post what does the serial monitor show
after pressing the reset-button

I don't have this second board-url in my preferences
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
I'm just using
https://dl.espressif.com/dl/package_esp32_index.json

what is the board-version that you have installed?

Ctrl+Sht+M Board manager. I attached the printscreen about that

for some reason I cannot find in the borad manager the ESP32 by Espressif...

I don't understand what you want to say with this
Do you mean where to finde the board manager?
The board manager is here

Your boot-message starts to differ in this line

load:0xffffffff,len:-1

A len smaller than zero makes no sense

google came up with this

best regards Stefan

I have the same version installed

read what is written in the links of post #17

Thanks for the links Stefan and also your support. Unfortunatelly I do not know what I can do with the message "There was a LL mosfet gate connected to GPIO11 shortening the CS signal through it's capacitance.". Try to search on the net still