Hello,
I see many examples of Captive portal for ESP32 – however none seems to provide me a similar WiFi Setup that we have for esp8266 where portal scans available WiFi and user to select one and input password (https://nodemcu.readthedocs.io/en/dev/modules/enduser-setup/).
I found one at https://hieromon.github.io/AutoConnect/index.html and was very hopeful that it will work with my esp32 / Platformio setup. I installed all required libraries but running into errors such as following. Could some one help me out please, thank you
Compiling .pio\build\nodemcu-32s\libfac\AutoConnect\AutoConnectOTA.cpp.o
*** [.pio\build\nodemcu-32s\src\main.cpp.o] Error 1
*** [.pio\build\nodemcu-32s\libd09\HTTPUpdate\HTTPUpdate.cpp.o] Error 1
In file included from .pio/libdeps/nodemcu-32s/AutoConnect/src/AutoConnectUpdate.h:45,
from .pio/libdeps/nodemcu-32s/AutoConnect/src/AutoConnectExt.hpp:24,
from .pio/libdeps/nodemcu-32s/AutoConnect/src/AutoConnectConfigAux.h:20,
from .pio/libdeps/nodemcu-32s/AutoConnect/src/AutoConnectConfigAux.cpp:14:
C:/Users/mtufa/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:76:29: error: ‘followRedirects_t’ has not been declared
void setFollowRedirects(followRedirects_t follow)
^~~~~~~~~~~~~~~~~
C:/Users/mtufa/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:94:32: error: ‘HTTPClient’ has not been declared
t_httpUpdate_return update(HTTPClient& httpClient,
^~~~~~~~~~
C:/Users/mtufa/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:97:38: error: ‘HTTPClient’ has not been declared
t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String ¤tVersion = “”);
^~~~~~~~~~
C:/Users/mtufa/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:109:38: error: ‘HTTPClient’ has not been declared
t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false);
Hi.
What libraries and how did you install them?
Can you provide a link to the libraries you installed?
Regards,
Sara
Thanks Sara for following up, please review the info below and let me know your inputs – many thanks in advance.
Libraries are:
[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
lib_deps =
adafruit/Adafruit BME280 Library@^2.2.2
khoih-prog/ESP_WifiManager@^1.12.1
ottowinter/ESPAsyncWebServer-esphome@^3.0.0
arduino-libraries/ArduinoHttpClient@^0.4.0
hieromon/AutoConnect@^1.4.2
hieromon/PageBuilder@^1.5.6
bblanchon/ArduinoJson@^6.21.2
And here is main.cpp file is:
//https://hieromon.github.io/AutoConnect/gettingstarted.html
#include <WiFi.h> // Replace with WiFi.h for ESP32
#include <WebServer.h> // Replace with WebServer.h for ESP32
#include <AutoConnect.h>
#include <DNSServer.h>
#include <AsyncTCP.h>
#include “ESPAsyncWebServer.h”
#include “HttpClient.h”
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include “functions.h”
WebServer Server; // Replace with WebServer for ESP32
AutoConnect Portal(Server);
void rootPage() {
char content[] = “Hello, world”;
Server.send(200, “text/plain”, content);
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Server.on(“/”, rootPage);
if (Portal.begin()) {
Serial.println(“WiFi connected: ” + WiFi.localIP().toString());
}
}
void loop() {
Portal.handleClient();
}
though functions.h file has nothing to do with error, I am copying here for reference:
Adafruit_BME280 bme;
float env_Temp()
{
Serial.print(“Temperature = “);
float Temp = bme.readTemperature();
Serial.print(Temp);
Serial.println(“°C”);
Serial.println();
return Temp;
}
float env_Press()
{
Serial.print(“Pressure = “);
float Press = bme.readPressure() / 100.0F ;
Serial.print(Press);
Serial.println(“hPa”);
Serial.println();
return Press;
}
float env_Humid()
{
Serial.print(“Humidity = “);
float Humid = bme.readHumidity();
Serial.print(Humid);
Serial.println(“%”);
Serial.println();
return Humid;
}
Hi.
try using platform = espressif32@3.5.0 on your platformio file instead of platform = espressif32
let me know if this solves the problem.
regards
Sara
Hi Sara
I tried, but in vain.
I tested a different portal code (https://iotespresso.com/create-captive-portal-using-esp32/) and that seems to work. I edited it and now captures WiFi name and Password. I was really hoping that user does not have to input WiFi name (code scans all nearby WiFis and provide a list to user to select one).
As for my original question/issue, it could be board issue. I have ordered another one (ESP32 WROOM) and will retry https://hieromon.github.io/AutoConnect/index.html with the new board. Meantime, if you have suggestions for me, please share.
Amicalement
Mudassir
Hi.
No, I don’t think it is a problem with the board.
I think it might be an issue with the libraries or dependencies of the configuration of your platformio.ini file.
When creating the Arduino project on VS Code, try selecting the DOIT board instead. Then, test the code again.
Regards,
Sara
THANK YOU Sarah, I changed to DOIT board and it worked flawlessly.
Now moving on to adding other functionalities that I need for the project.
Appreciate your help,
Regards
Mudassir