WiFiManager with ESP32 - Stop Hard-coding WiFi Credentials!

578,855
0
Published 2022-03-20
Stop hard-coding your WiFi connection information in your ESP32 Sketches - use WiFi Manager instead!

Article with code samples: dronebotworkshop.com/wifimanager
More articles and tutorials: dronebotworkshop.com/
Join the conversation on the forum: forum.dronebotworkshop.com/
Subscribe to the newsletter and stay in touch: 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

All Comments (21)
  • @Dronebotworkshop
    Hi everyone - It's come to my attention that there has been someone masquerading as myself, responding to some comments here with a link to a Telegram chat to win a prize from me. THIS IS A SCAM, I am not holding a contest, nor do I have a Telegram account. PLEASE DO NOT RESPOND TO THESE MESSAGES!! It's happening on a lot of my videos, I'm taking steps to remove them manually, but as I have 162 videos, it will take some time. If you do run across a suspicious comment, I would appreciate you letting me know at info@dronebotworkshop.com/ Thanks! Bill (The real one!)
  • These are seriously the most well-explained and detailed videos in youtube about electronics and programming.
  • Nice addition to your videos! I see you've been churning them out quite frequently, lately. Good work! I have been going back through some of your older videos, the one for the HC-SR501 PIR sensor, specifically, just yesterday! Great stuff! Excellent work in the Workshop!
  • You have a wonderful talent for being able to simplify complex topics and present them in a way most people can comprehend. Nice work as ususal.
  • Hi Bill, I'm a big fan of your videos, not only for the clear, organized, detailed and rich graphic information, but for your generosity in sharing your knowledge.... Big thanks 👍
  • @KG4JYS
    I like your ESP32 based videos a lot. I recently did a project where I needed far more performance than Arduino could provide. I tried Seeduino XAIO, Artemis, and esp32. Settled on the ESP32 and I'm going to continue using them for projects in place of Arduino. Thank you!
  • @MiniStockpot
    Your videos are just outstanding - you don't leave anything unexplained and take the normal approach where people assume a certain level of knowledge (and where you do that you're most always link to a video you've already made showing how that bit works!) which can really easily alienate beginners. Your instructions are so clear that I can actually watch your videos on two-and-a-half times speed and still follow them easily - thanks for making such wonderful videos and keep up the good work!! 😃
  • @MakerFabio
    You are really good. You touched all the possible points needed when provisioning Wi-Fi and parameters instead of hardcoding. Many thanks, will use this on my IOT chicken coop!
  • I'm working working with the WifiManager for years on my ESP8266 projects, but because of your workshop video, I've learned some stuff again. So thanks a lot for that. Regarding the ESP32, there is a smaller version available, I'm using for my projects. It's the WEMOS D1 mini ESP32. It is small but powerfull. Greetings from the rhine-main-region, germany Alex
  • @sunpeter8260
    Thank you so much, Bill! The tutorial is concise and clear, you are a wonderful teacher! This is exactly what I've been looking for! Thank you again!
  • @sajanvraj
    Thanks a lot for your detailed videos which cover fundamentals all the way to advanced concepts for each topic. I am in awe of the efforts you put in for such high quality content! You are the BEST in this training space!
  • Another great video, Bill. Thanks. I had my ESP on my network in no time. I think using this library will be kind of a game changer to make the ESP much more useful in network applications. Might have to incorporate it into my 6wd robot with a small LCD display to report the same info the sample sketches show on the serial port.
  • @jamess.9930
    I literally found this knowledgeable gentleman's channel a few days ago. This channel is perfect for everyone with a beginner/basic sense of electronics. Very well spoken and highly recommend this.
  • @smidjepeter
    I've been watching your videos for a while, and I've learned a lot from them. Your personality is also nice to see and hear. The intro makes me laugh every time, nice to be able to follow your videos and learn something from them. thank you
  • @rdalemd76
    Hi, I finished coding a ESP-32 One Wire Reader and realized the WiFi credentials were hard coded. This was the exact video I was looking for. Excellent job in explaining the uses of WiFi Manager.
  • @ThumpinV
    Thanks! Love your videos. Very much appreciate the work that you put into these videos. They are FANTASTIC! I love that you take the time to explain the “why” details.
  • Thanks for all your work. I've been following you for a while - your videos and topics are the best.
  • Very concise, very well explained, thank you so much for sharing 🙏🏻
  • @paulmillard1130
    Marvellous full of clarity like all your videos. Helps me greatly as I'm getting on a bit and it helps remind me how to do this stuff. you're a real star ThankYou.