WiFiManager with ESP32 – Stop Hard-coding WiFi Credentials!

Stop hard-coding your WiFi connection information in your ESP32 Sketches – use WiFi Manager instead!

Article with code samples: https://dronebotworkshop.com/wifimanager
More articles and tutorials: https://dronebotworkshop.com
Join the conversation on the forum: https://forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: https://dronebotworkshop.com/subscribe/

The ESP32 is an amazing microcontroller. It’s a powerful 32-bit processor with multiple I/O ports. 12-bit A/D converters and a variety of interfaces. But the one thing that makes it stand out above the crowd is its built-in WiFi and Bluetooth capabilities.

When we experiment with the ESP32 WiFi we generally just hard-code our WiFi login information directly in our sketches. Some people use an external file, but it is just another way to accomplish the same thing.

In both cases, our code is compiled and loaded onto our ESP32, so the ESP32 is locked into using that WiFi SSID and password. If you want to change these parameters to use your device on another WiFi network, then you need to change your code and recompile.

This isn’t a great arrangement, especially if you want to move your creation to another network, share it with a friend or even create a commercial product.

Enter WiFiManager. This great library lets you avoid hard-coding your WiFi parameters. Instead, you use a web-based interface to configure your SSID and password, so you can use your ESP32 project anywhere.

You can also add additional parameters of your own, making WiFiManager an ideal solution for both private and commercial designs.

Today I’ll show you how to use WiFiManager with the ESP32 (it can also be used with the ESP8266).

Here is the Table of Contents for today’s video:

00:00 – Introduction
03:09 – WiFiManager
11:45 – WiFiManager Installation
13:29 – Using WiFiManager
18:05 – WiFiManager On-Demand
23:59 – Modifying Sketches to use WiFiManager
30:07 – Adding Custom Parameters
36:42 – JSON & SPIFFS
39:40 – Saving Parameter Data
53:04 – Conclusion

You’ll find WiFiManager is easy to use, and that you can quickly adapt your existing sketches to eliminate the hard-coded SSID and password. Give it a try and let me know what you think.

Hope you enjoy the video!

Bill

source

You might be interested in