Lately I have been playing a lot with the amazing esp32. It is an amazing “microcontroller” for makers, and I add quotes to “microcontroller” because really, it’s an IoT do-it-all SoC; all for the low price of about US$5.
One of the main features of the esp32 is its ability to connect to the internet. Many people hardcode their home wifi into their program, but you don’t need to anymore. Enters esp32-wifi-manager, the project I have been working on these past few weeks!
Quick demo
esp32-wifi-manager automatically starts an access point and scans nearby wifis. You can then simply connect to a wireless network by using the web app. The esp32 will then automatically attempt to reconnect to the last saved wifi on boot. Simple and easy!
Complete source code is available here: https://github.com/tonyp7/esp32-wifi-manager
13 thoughts on “esp32-wifi-manager release!”
Your wifi manager looks very good. Will you have a port for the Arduino IDE?
Hi George,
I intend it to stay a native esp-idf project and I have no interest in the Arduino core for esp32 at this point. Thanks for the kind message!
Hi Tony,
I made a switch from using Eclipse in a VM to Notepad++ for a bit so that I can stay in Windows and to see why people like Notepad++. Great work on the wifi_manager btw and thanks for sharing it. I am new to ESP32 and your code, so there is a bit of a learning curve.
After the ESP32 connects to the wlan in Station Mode, how do I control that connection such as setting it up to listen to a port and accept JSON requests? Can you confirm the snippet below is where I should put my code and to address the connection?
#if WIFI_MANAGER_DEBUG
printf(“http_server_netconn_serve: wifi_manager_connect_async() call\n”);
#endif
wifi_manager_connect_async();
netconn_write(conn, http_ok_json_no_cache_hdr, sizeof(http_ok_json_no_cache_hdr) – 1, NETCONN_NOCOPY); //200ok
found = true;
// Code starts here to open port 5000 to listen for JSON requests
netconn_bind(conn, IP_ADDR_ANY, 5000);
netconn_listen(conn);
if ((err = netconn_recv(conn, &nb)) == ERR_OK) {
// copy data from buffer
netbuf_data(nb, &data, &datalen);
// check request
if (!strncmp(data, “GET “, 4)) {
split1 = data + 4;
split2 = memchr(split1, ‘ ‘, MAX_URI_LEN);
len = split2 – split1;
memcpy(uri, split1, len);
uri[len] = ‘\0’;
if (!strncmp(uri, “/open”, MAX_URI_LEN)) {
if (!busy && !test1 && !test2) {
xTaskCreate(task_open, “box_open”, 4096, NULL, 5, NULL);
}
netconn_write(client, http_index, strnlen(http_index, 512), NETCONN_COPY);
} else if (!strncmp(uri, “/close”, MAX_URI_LEN)) {
}
Thanks
Sorry I meant HTTP requests.
Hi Tony, I am trying to change the wifi signal strength graphic to a different color by replacing the greyscale ones in the project folder with the same names. However, I cant get the software to display the new ones and it keeps displaying the old greyscale graphic. What do I need to do to get the new graphic to show up? Thank you.
Hi Simon, the pictures are just there for reference. They are not included in the program. The images live inside the CSS file as base64. Check out the stylesheet!
Tony, thanks for that info. Do you hand code the webpage portion of the program or do you use a certain WYSIWYG application or IDE to make it easier? Whats the name of the helping application? Thanks in advance..
It’s all hand crafted in notepad++!
Hi, thanks for your amazing work with this example
Hi Tony,
I have used the WifiManager of your project.
The ESP32 correctly gets the IP from my router afer the web server configuration.
Now, I have some other tasks which I put in the second core using xTaskCreatePinnedToCore API and which make some http requests.
The problem is that this tasks seem to not reach the HTTP server. I get error from “mbedtls_net_connect” API calls.
The some code run with no problem without using the WifiManager (I can connect to HTTPS server ).
Did you face this problem ?
Hope you can help
Nico
Thank you for this! It’s exactly what I wanted from an ESP32 app skeleton.
Very much appreciated!
I have already working STA code in esp32 which hosts a webpage. Can you tell me how should i use your framework ?
Hi i have been working using your program for WiFi Manager the issue i am getting when i tries to use it in Power saving mode it does not goes to light sleep I am trying to maintain association with WiFi using WiFi Manager