Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to design an ESP32 WiFi manager using MicroPython

By Nikhil Agnihotri July 17, 2023

Nearly all the devices we use today — from smartphones, tablets, wearables, and even many of our appliances — connect to the Internet via a home (or office) WiFi network. Internet access to smart devices is typically managed through a web interface or mobile app.

Similarly, when we’re out and about, we’ll access WiFi for our mobile devices by connecting to a specific network and inputting the password. However, managing Internet access can be more challenging with self-built Internet of things (IoT) devices. This is because these credentials are usually hard-coded in IoT devices.

But what if a MicroPython port as simple as ESP32 could serve as a universal WiFi manager? This would allow all IoT-connected devices (including our smartphones, laptops, and wearables) to connect to random WiFi networks — without inputting passwords each time.

A WiFi manager configured on ESP32 will scan for the available networks and store the credentials for current and future use, saving time and energy.

Components required

  • ESP32 or ESP8266 board x1

Prerequisites
You must have uploaded MicroPython firmware to ESP32/ESP8266 and installed uPyCraft IDE or Thonny IDE on your computer. Click here to learn how to install uPyCraft IDE and upload MicroPython firmware to ESP32/ESP8266.

Circuit connections
There are no connections required. It’s only necessary to set up and configure ESP32/ESP8266 to work as a WiFi manager.

The MicroPython library
For this project, we’ll use the WiFi manager library built by Tayfunulu. It’s available on Github via this link. The source code of the library is below.

To upload the WiFi manager library to ESP32/ESP8266, connect the ESP board to your computer via a Micro-USB cable. Open uPyCraft IDE and navigate to File->New. Copy the WiFi manager library’s source code to the new file and click the save button.

Name the new file ‘WiFiManager.py,’ and save it by clicking OK.

Click the ‘Download and Run’ button to upload the library to the ESP board.

The MicroPython script
The WiFi manager library must be implemented in the main application code in the MicroPython firmware. To do so, create a new file by navigating to File->New and save it as ‘main.py.’

Copy the code below to main.py. Then, upload it to the ESP board by clicking the ‘Download and Run’ button.

How the WiFi manager works
When the ESP board boots for the first time after the code is uploaded, it’s set as a WiFi access point. This point is seen as the ‘WiFiManager,’ which can be connected to a computer or mobile. 

The password to connect with the WiFiManager is ‘tayfunulu.’ The password and SSID of the ESP WiFiManager can be changed by modifying the WiFiManager.py. 

After connecting to the WiFiManager, open its dashboard by going to the IP address 192.168.4.1. The available WiFi connections will be displayed on the webpage. Select a WiFi connection and enter its network key to configure the connection with the ESP board. After the correct credentials are entered, the WiFi connection can be accessed by any device by connecting to the WiFiManager.  

The code
The main application code imports the WiFiManager library. The available WiFi connections are scanned by calling the WiFiManager.get_connection() method. If there is no WiFi network available, the message “Could not initialize the network connection” is printed to the console. Otherwise, the WiFi connections will be accessible on 192.168.4.1. 

When the ESP board first boots as an access point, it leaves a socket open — which can crash the ESP board. To prevent this, the socket connection is managed by a ‘try-except’ exception handling routine. 

The main application code then hosts the webpage for connecting with an available WiFi connection, as well as a webpage that controls the LED on the ESP board.  

Testing the WiFi manager
After uploading the main application code, reset the ESP board by pressing the RESET button. The ESP WiFiManager will be activated, and a message will be printed to the MicroPython console. 

Next, open the WiFi settings on your computer or smartphone and connect to the WiFiManager network.

Once you’ve connected to the WiFiManager network, open the URL 192.168.4.1 in a web browser. You’ll see the available WiFi network connections. Select one and enter its password. Then, save the credentials to the WiFiManager by clicking the submit button.

The ESP board is now connected to the WiFi network. Any other devices you have can also directly access all the available WiFi networks by connecting to the WiFiManager without putting in a password or hard coding the credentials in the application code. 

Conclusion
The WiFi manager built in this project saves time, making WiFi easily accessible to all of your smart devices, including laptops and smartphones. So, you will no longer have to input the username and password into each one; nor will you have to hard code the WiFi credentials into each device. A WiFi manager configured on ESP32 scans for the available networks and stores the credentials for current and future use.

 

You may also like:


  • The top mobile app development tools for IoT and electronics

  • How to manage data on ESP32 for IoT projects

  • The top IoT platforms of 2023

  • How to build a portable WiFi repeater using ESP32 or…

  • How to send SMS alerts from ESP32 without a GSM…

Filed Under: Electronic Projects, ESP8266
Tagged With: ESP32, internet, internetofthings, IoT, MicroPython, wifi, wifimanager, wireless
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS feed: EDABOARD.com Discussions. EDABOARD.com Discussions.

  • Trying to Understand Solid-State Transformers for AI Data Centers
  • Creating a Behavioral SPICE Model for a Custom VCXO/Oscillator
  • Microwave chamber monitoring
  • 3 stages ldo stability
  • How to Effectively Prevent Memory Leak & Fragmentation in RTOS-Based Embedded Systems

RSS feed: Electro-Tech-Online.com Discussions Electro-Tech-Online.com Discussions

  • Advice for an ESP32 Soil Tensiometer project with 5V sensors
  • Marantz SR4500 – CS49400 DSP reverse-engineering / custom active crossover
  • How does an air tag work?
  • Cheap ways to link 5 Keithley units and 4 BNC units?
  • Sony KV-29VL40 - 4 Blink error - IC001 Pin 17 high

Featured Tutorials

VHDL Series (1-24)

  • VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
    VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
  • VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
    VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
  • VHDL Tutorial – 19: Designing a 4-bit binary counter using VHDL
    VHDL Tutorial – 19: Designing a 4-bit binary counter using VHDL
  • VHDL Tutorial – 20: Designing 4-bit binary-to-gray & gray-to-binary code converters
    VHDL Tutorial – 20: Designing 4-bit binary-to-gray & gray-to-binary code converters
  • VHDL Tutorial – 21: Designing an 8-bit, full-adder circuit using VHDL
    VHDL Tutorial – 21: Designing an 8-bit, full-adder circuit using VHDL
  • VHDL Tutorial – 22: Designing a 1-bit & an 8-bit comparator by using VHDL
    VHDL Tutorial – 22: Designing a 1-bit & an 8-bit comparator by using VHDL
More Tutorials >

Recent Articles

  • ITG Electronics adds 300 VAC common mode chokes
  • Morse Micro introduces USB adapters for Wi-Fi HaLow connectivity
  • AOS adds 600 V top-side-cooled MOSFETs
  • TDK adds 100 V, 10 μF MLCC
  • Teledyne e2v adds 1K and 8K sensors

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2026 Arrowfly LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of Arrowfly
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertise
  • Subscribe