This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
CONSULTA ESP32 Wifi no conecta
#1
Buenas tardes a todos,

he adquirido recientemente un módulo HiGrow que incorpora un chip ESP32. 

[Imagen: 5566c3d5-da30-4b60-bc11-ec6e8d30b101.JPG]

Anteriormente tenía módulos con ESP8266 que conectaba sin problema a mi red WiFi, sin embargo, con este módulo no puedo realizarlo.

Estoy trabajando tanto con el IDE de Arduino como con ATOM+PlatformIO pero no hay manera.

Dejo por aquí el código de platformIO que es el que más me interesa por poder luego aplicarlo con MQTT.

Platformio.ini:

Código:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

main.cpp:

Código:
/*
 Programa que publica todos los sensores del HiGrow
 nodo/higrow/temperatura
 nodo/higrow/humedad
 nodo/higrow/suelo
 nodo/higrow/luz

 PINES:
 - Reset = 0;
 - LED = 16;
 - DHT = 22;
 - Suelo (soil) = 32;
 - Luz = 34;
*/

/* LIBRERIAS */
#include <PubSubClient.h>
#include <WiFi.h>
#include "DHTesp.h"

//----------------------- CONFIG PARAMETERS------------------------
//Con este parametro se construye todos los topics para el protocolo MQTT.
// Nombre del nodo.
String NodeName = "higrow";
String TopicMQTT; //Variable para construir el Topic de MQTT.
//El tiempo de sueño se especifica en el fichero funciones.h (sleeptime).
//-----------------------------------------------------------------

// On board DHT sensor pin
DHTesp dht;
//On board LED Connected to GPIO2
#define LED 16

// Update these with values suitable for your network.
//const char* ssid = "george";
char* ssid = "george";
const char* password = "RVVBQTHCTJTWTB";
const char* mqtt_server = "192.168.1.10";
const int WIFI_CONNECT_TIMEOUT_SECONDS = 10;

WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
char msg_temp[50];
char msg_hum [50];
char msg_suelo [50];
char msg_luz [50];
int value = 0;

/* WiFi connection */
boolean setup_wifi() {
 delay(10);
 // We start by connecting to a WiFi network
 Serial.println();
 Serial.print("Connecting to ");
 Serial.println(ssid);

 WiFi.begin(ssid, password);

 while (WiFi.status() != WL_CONNECTED) {
 //for (int i=0; i<WIFI_CONNECT_TIMEOUT_SECONDS && WiFi.status() != WL_CONNECTED; i++) {
   delay(500);
   Serial.print(".");
 }

 Serial.println("");
 Serial.println("WiFi connected");
 Serial.println("IP address: ");
 Serial.println(WiFi.localIP());
 if (WiFi.status() == WL_CONNECTED) {
   Serial.print(F("Connected to "));
   Serial.println(ssid);
   Serial.print(F("IP address: "));
   Serial.println(WiFi.localIP());
   return true;
 } else {
   Serial.println(F("Failed to connect to WiFi"));
   return false;
 }
}

/* Setup */
void setup() {
 pinMode(LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output
 Serial.begin(115200);
 setup_wifi();
 //client.setServer(mqtt_server, 1883);
 //client.setCallback(callback);

 //dht.setup(0, DHTesp::DHT11); // Connect DHT sensor to GPIO 17
}

void loop() {
}

Por otro lado, me sale el siguiente error, creo que del compilador, sin embargo el programa lo compila y lo sube sin ningún problema:

Código:
xtensa-esp32-elf-g++.exe: error: ESP32: No such file or directory
xtensa-esp32-elf-g++.exe: error: Dev: No such file or directory
xtensa-esp32-elf-g++.exe: error: Module": Invalid argument 
  

Pero no he encontrado nada sobre este error y más aún si no da ningún problema al subir el programa.

Muchas gracias.

Un saludo!!
  Responder
#2
Bueno, pues parece que he conseguido algo...

Me he vuelto al IDE de Arduino y probado el código anterior:

Código:
#include "WiFi.h"

const char* ssid = "george";
const char* password =  "************";

void setup() {

 Serial.begin(115200);

 WiFi.begin(ssid, password);

 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.println("Connecting to WiFi..");
 }

 Serial.println("Connected to the WiFi network");

}

void loop() {}

El código, como dije, se me subía correctamente, pero luego la terminal me empezaba a lanzar un montón de mensajes, pero no se conectaba a la red. El mensaje en cuestión era el siguiente:

Error: “Brownout detector was triggered”

Buscando un poco, di con la solución, la más simple posible:

  • Poor quality USB cable;
  • USB cable is too long;
  • Board with some defect (bad solder joints);
  • Bad computer USB port;
  • Or not enough power provided by the computer USB port.
Solution: try a different shorter USB cable (with data wires), try a different computer USB port or use a USB hub with an external power supply.

Espero que sirva de ayuda a alguien.

Un saludo,
  Responder
#3
Se te reseteaba en los intentos de conexión que es cuando coincide con los picos de mayor corriente. Lo has podido arreglar con el cambio de cable? Otra solución es meter un condensador grande en la entrada de la alimentación de la placa.
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder
#4
Buenas tardes Grafisoft, creo que solucioné esa parte, pero ahora me da un error de watchdog, pero creo que ese fallo se debe a algo de la configuración propia del ESP32 respecto al ESP8266. Aunque no he conseguido obtener nada claro.
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
Fotografía CONSULTA Error "timed out waiting for packet header" en ESP32 rod203 1 203 21-03-2023, 11:48 PM
Último mensaje: asesorplaza1
  CONSULTA Clones ESP32 y ESP8266 Anje 5 1,758 15-11-2020, 11:14 AM
Último mensaje: grafisoft
Fotografía Termostato wifi FINALIZADO jgarridc 13 8,461 02-11-2018, 09:36 AM
Último mensaje: jgarridc
  CONSULTA Red esp8266 esp32 wifi. Más de 50 dispositivos jandrito80 1 3,705 10-04-2018, 11:05 AM
Último mensaje: grafisoft
  WiFi direct en ESP32? Gwynbleidd 4 3,802 31-07-2017, 03:40 PM
Último mensaje: Gwynbleidd