ESP01 retorna wifi status 7

Comprei uma esp01 e um adaptador usb ch340, programei a esp com um blink e funcionou, coloquei um WifiScan, que é um exemplo oferecido, funcionou. Quando eu coloco o exemplo WifiClient onde a esp01 tenta se conectar a alguma rede, a esp começa a travar e esquentar, antes disso acontecer ela consegue retornar o status de conexão wifi que é 7, andei pesquisando e achei q esse erro corresponde a este dado.
WIFI_EVENT_SOFTAPMODE_PROBEREQRECVED

Os códigos que usei são os exemplos, com uma alteração para retornar o valor do WiFi.status() para o serial monitor.

Eu tentei colocar ela como AP(com o programa exemplo oferecido), mas não aparece nenhuma rede com o nome dela.

Olá,

Qual a biblioteca que usaste? Instalaste a partir do gestor de bibliotecas (library manager)? Mostra o código que estás a usar. Antes de colocares o código clica no botão </> para ficar correctamente formatado.

1 Like

Eu segui um tutorial onde eles instalam todos os itens necessarios pelo board manager;
link:embarcados.com.br/gravando-o-esp8266-01-na-ide-arduino/

Tentei gravar este programa, exemplo HelloServer, que bate com o meu objetivo, mas não objtive sucesso.
Depois que eu gravo e tento conectar, acontece exatamente como antes, ela trava e começa a esquentar.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#ifndef STASSID
#define STASSID "asdfgh"
#define STAPSK  "12345678"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;

ESP8266WebServer server(80);

const int led = 13;

void handleRoot() {
  digitalWrite(led, 1);
  server.send(200, "text/plain", "hello from esp8266!\r\n");
  digitalWrite(led, 0);
}

void handleNotFound() {
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET) ? "GET" : "POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i = 0; i < server.args(); i++) {
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);
}

void setup(void) {
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  if (MDNS.begin("esp8266")) {
    Serial.println("MDNS responder started");
  }

  server.on("/", handleRoot);

  server.on("/inline", []() {
    server.send(200, "text/plain", "this works as well");
  });

  server.on("/gif", []() {
    static const uint8_t gif[] PROGMEM = {
      0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80, 0x01,
      0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00,
      0x10, 0x00, 0x10, 0x00, 0x00, 0x02, 0x19, 0x8c, 0x8f, 0xa9, 0xcb, 0x9d,
      0x00, 0x5f, 0x74, 0xb4, 0x56, 0xb0, 0xb0, 0xd2, 0xf2, 0x35, 0x1e, 0x4c,
      0x0c, 0x24, 0x5a, 0xe6, 0x89, 0xa6, 0x4d, 0x01, 0x00, 0x3b
    };
    char gif_colored[sizeof(gif)];
    memcpy_P(gif_colored, gif, sizeof(gif));
    // Set the background to a random set of colors
    gif_colored[16] = millis() % 256;
    gif_colored[17] = millis() % 256;
    gif_colored[18] = millis() % 256;
    server.send(200, "image/gif", gif_colored, sizeof(gif_colored));
  });

  server.onNotFound(handleNotFound);

  /////////////////////////////////////////////////////////
  // Hook examples

  server.addHook([](const String & method, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction contentType) {
    (void)method;      // GET, PUT, ...
    (void)url;         // example: /root/myfile.html
    (void)client;      // the webserver tcp client connection
    (void)contentType; // contentType(".html") => "text/html"
    Serial.printf("A useless web hook has passed\n");
    Serial.printf("(this hook is in 0x%08x area (401x=IRAM 402x=FLASH))\n", esp_get_program_counter());
    return ESP8266WebServer::CLIENT_REQUEST_CAN_CONTINUE;
  });

  server.addHook([](const String&, const String & url, WiFiClient*, ESP8266WebServer::ContentTypeFunction) {
    if (url.startsWith("/fail")) {
      Serial.printf("An always failing web hook has been triggered\n");
      return ESP8266WebServer::CLIENT_MUST_STOP;
    }
    return ESP8266WebServer::CLIENT_REQUEST_CAN_CONTINUE;
  });

  server.addHook([](const String&, const String & url, WiFiClient * client, ESP8266WebServer::ContentTypeFunction) {
    if (url.startsWith("/dump")) {
      Serial.printf("The dumper web hook is on the run\n");

      // Here the request is not interpreted, so we cannot for sure
      // swallow the exact amount matching the full request+content,
      // hence the tcp connection cannot be handled anymore by the
      // webserver.
#ifdef STREAMSEND_API
      // we are lucky
      client->sendAll(Serial, 500);
#else
      auto last = millis();
      while ((millis() - last) < 500) {
        char buf[32];
        size_t len = client->read((uint8_t*)buf, sizeof(buf));
        if (len > 0) {
          Serial.printf("(<%d> chars)", (int)len);
          Serial.write(buf, len);
          last = millis();
        }
      }
#endif
      // Two choices: return MUST STOP and webserver will close it
      //                       (we already have the example with '/fail' hook)
      // or                  IS GIVEN and webserver will forget it
      // trying with IS GIVEN and storing it on a dumb WiFiClient.
      // check the client connection: it should not immediately be closed
      // (make another '/dump' one to close the first)
      Serial.printf("\nTelling server to forget this connection\n");
      static WiFiClient forgetme = *client; // stop previous one if present and transfer client refcounter
      return ESP8266WebServer::CLIENT_IS_GIVEN;
    }
    return ESP8266WebServer::CLIENT_REQUEST_CAN_CONTINUE;
  });

  // Hook examples
  /////////////////////////////////////////////////////////

  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
  server.handleClient();
  MDNS.update();
}

edit:
Ela retorna alguns pontos, que corresponde ao loop while dentro do void setup mas depois para e começa a esquentar.

Com os exemplos blink e wifiscan o módulo funciona bem sem aquecer?

Como é alimentado o módulo? Fizeste as ligações como indicado nesse tutorial? Tudo a 3.3V? Se tiveres um multímetro mede a corrente com que o módulo está a ser alimentado. Se puderes experimenta com outra fonte de alimentação de 3.3V (colocando o GND comum a todos os dispositivos (módulo, fonte e conversor USB)).

Se funciona bem com os outros exemplos também deveria funcionar bem com o exemplo do WifiClient... Não tou a ver qual possa ser o problema. Verifica se existe algum mau contacto nas ligações e inspecciona a placa com uma lupa para ver se existe algum ponto de solda solto.

Se tens todas as ligações OK e os exemplos não estão a funcionar poderá ser defeito do módulo, se puderes experimenta com outro.

edit:
Sim, com os exemplos blink e wifiscan funcionam sem aquecer.

Eu estou usando um adaptador usb ch340, creio que não possa ter erro na alimentação, pois eu medi com um multímetro a tensão de saída dele e está correta, tanto que com os outros exemplos funcionam, exceto o wifiClient.
Eu testei hoje com outra placa esp01 e funcionou perfeitamente, creio q seja defeito mas não entendo como esse defeito está ocorrendo pois ele funciona com outros exemplos que não tentem uma conexão.

Se alguém conseguir explicar como isso é possível ou se até tiver uma solução para isso agradeço.

Para aqueles que tem o mesmo problema que o meu é possível que seja defeito, no meu caso eu tive que comprar outra esp01

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.