Implementing the WiFiManager Library in the SparkFun ESP32 Thing

Advanced ESP32 Over The Air Programming in ESP32
8 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€67.62
List Price:  €96.60
You save:  €28.98
£55.92
List Price:  £79.89
You save:  £23.96
CA$100.73
List Price:  CA$143.91
You save:  CA$43.17
A$113.16
List Price:  A$161.66
You save:  A$48.50
S$95.66
List Price:  S$136.67
You save:  S$41
HK$543.65
List Price:  HK$776.68
You save:  HK$233.02
CHF 63.52
List Price:  CHF 90.76
You save:  CHF 27.23
NOK kr796.77
List Price:  NOK kr1,138.29
You save:  NOK kr341.52
DKK kr504.31
List Price:  DKK kr720.48
You save:  DKK kr216.16
NZ$125.13
List Price:  NZ$178.76
You save:  NZ$53.63
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,364.27
List Price:  ৳11,949.48
You save:  ৳3,585.20
₹5,989.59
List Price:  ₹8,556.93
You save:  ₹2,567.33
RM312.96
List Price:  RM447.10
You save:  RM134.14
₦108,427.10
List Price:  ₦154,902.50
You save:  ₦46,475.40
₨19,493.94
List Price:  ₨27,849.68
You save:  ₨8,355.74
฿2,404.21
List Price:  ฿3,434.73
You save:  ฿1,030.52
₺2,475.24
List Price:  ₺3,536.21
You save:  ₺1,060.96
B$432.88
List Price:  B$618.42
You save:  B$185.54
R1,322.80
List Price:  R1,889.80
You save:  R566.99
Лв131.89
List Price:  Лв188.42
You save:  Лв56.53
₩103,468.62
List Price:  ₩147,818.65
You save:  ₩44,350.03
₪254.88
List Price:  ₪364.13
You save:  ₪109.25
₱4,074.53
List Price:  ₱5,821.01
You save:  ₱1,746.48
¥11,013.47
List Price:  ¥15,734.21
You save:  ¥4,720.73
MX$1,460.62
List Price:  MX$2,086.69
You save:  MX$626.07
QR255.20
List Price:  QR364.58
You save:  QR109.38
P977.61
List Price:  P1,396.65
You save:  P419.03
KSh9,054.68
List Price:  KSh12,935.82
You save:  KSh3,881.13
E£3,558.38
List Price:  E£5,083.61
You save:  E£1,525.23
ብር8,953.40
List Price:  ብር12,791.12
You save:  ብር3,837.72
Kz63,830.88
List Price:  Kz91,190.88
You save:  Kz27,360
CLP$69,621.48
List Price:  CLP$99,463.52
You save:  CLP$29,842.04
CN¥510.78
List Price:  CN¥729.71
You save:  CN¥218.93
RD$4,276.94
List Price:  RD$6,110.18
You save:  RD$1,833.23
DA9,506.08
List Price:  DA13,580.69
You save:  DA4,074.61
FJ$162.84
List Price:  FJ$232.65
You save:  FJ$69.80
Q539.64
List Price:  Q770.95
You save:  Q231.30
GY$14,636.93
List Price:  GY$20,910.79
You save:  GY$6,273.86
ISK kr9,731.40
List Price:  ISK kr13,902.60
You save:  ISK kr4,171.20
DH707.09
List Price:  DH1,010.18
You save:  DH303.08
L1,286.61
List Price:  L1,838.09
You save:  L551.48
ден4,148.87
List Price:  ден5,927.21
You save:  ден1,778.34
MOP$559.92
List Price:  MOP$799.92
You save:  MOP$240
N$1,320.17
List Price:  N$1,886.04
You save:  N$565.87
C$2,575.84
List Price:  C$3,679.94
You save:  C$1,104.09
रु9,587.85
List Price:  रु13,697.52
You save:  रु4,109.66
S/262.99
List Price:  S/375.72
You save:  S/112.72
K284.34
List Price:  K406.22
You save:  K121.87
SAR262.90
List Price:  SAR375.59
You save:  SAR112.68
ZK1,945.83
List Price:  ZK2,779.87
You save:  ZK834.04
L336.42
List Price:  L480.62
You save:  L144.20
Kč1,703.58
List Price:  Kč2,433.80
You save:  Kč730.21
Ft27,824.12
List Price:  Ft39,750.45
You save:  Ft11,926.32
SEK kr774.84
List Price:  SEK kr1,106.96
You save:  SEK kr332.12
ARS$72,157.57
List Price:  ARS$103,086.67
You save:  ARS$30,929.09
Bs483.68
List Price:  Bs691
You save:  Bs207.32
COP$309,220.63
List Price:  COP$441,762.69
You save:  COP$132,542.06
₡35,635.58
List Price:  ₡50,910.16
You save:  ₡15,274.57
L1,778.41
List Price:  L2,540.70
You save:  L762.28
₲546,036.19
List Price:  ₲780,085.13
You save:  ₲234,048.94
$U3,057.32
List Price:  $U4,367.79
You save:  $U1,310.46
zł289.31
List Price:  zł413.32
You save:  zł124
Already have an account? Log In

Transcript

Video implementing the weifare manager library in the sparkfun ESP 32 thing. In this video, we will learn about the Wi Fi manager library and its working. Then we will learn about captive portals. And finally, we will implement the weifare manager on the sparkfun ESP 32 thing. In the last few videos, we looked at the different ways of implementing ot updates in the sparkfun ESP 32 thing. The ultimate aim of ot updates is to provide new features and security patches to your products on the market with minimum customer effort.

But let's say we deploy an IoT product based on the ESP 32 to market. The first thing any customer would want to do is to connect that device to their Wi Fi network to explore its IoT features. But until now, all the three OTA update methods we had to manually enter the Liferay credentials in the code before an OT update does, we need to implement an intuitive and easy way for the customer to enter the Wi Fi credentials during the initial boot up. This is where the wiser manager library is useful. Before going in depth into Wi Fi manager library, let's install it in Arduino it. Click on include library option under sketch and select Manage libraries to open the Library Manager.

Then search for Wi Fi manager. Now scroll down till you find this library. Select the latest version and install. Now let's look at the working of this library. Basically, the ESP 32 will automatically join a known network or set up an access point that you can use to configure the network credentials. Let's go in depth to understand the process.

When your ESP 32 boots, it is set up in station mode and tries to connect to a previously saved access point. If this process fails, it sets the ESP 32 into access point mode and creates a DNS and a web server. using any Wi Fi enabled device with a browser, connect to the newly created access point. After establishing a connection with the access point, you will be automatically redirected to the configuration portal. This was done with a captive portal. I will explain about captive portal later in this video.

Now the user will enter the Wi Fi credentials of the network to be connected to once a new SSID and password are set. The ESP 32 reboots and tries to connect If successful, it relinquishes control back to your app. If not, it goes back to access point mode and waits for the user. to reconfigure. Now, coming back to the explanation of step four. A captive portal is a web page that the user of a network is obliged to view and interact with before the full network access is granted.

Implementation of captive portals can be seen in public Wi Fi access points, like those in airports, coffee shops, hotels, etc. When the connection is established, you can see a pop up coming on your pc or smartphone asking you to sign into WiFi network. Even if you ignore this and try to go to some other sites, you will be redirected to the capital portal again. Thus, capital portals provide great network security and customer experience, especially for the public WiFi network. Now let's test out the Wi Fi manager library on our sparkfun ESP 32 thing. You can go through the example codes for this library.

But to make everything crystal clear and easy to learn, I have provided a simplified code for its implementation in the resources section. You can also find this in the downloaded get up code repository. Open the minimal underscore WiFi underscore manager dot inf o in the Arduino ID and upload the code to a sparkfun ESP 32 thing. Keep the serial monitor open to track the different phases of the configuration. I will be keeping the serial monitor running on the side throughout this implementation. Now, on your smartphone or your PC, connect to the Wi Fi access point created by the ESP 32.

Call the ESP config AP. Once successfully connected, you will be redirected automatically to the configuration web page by the captive portal is by any reason the captive portal didn't redirect you to the configuration page. Just copy and paste the IP address of the HTTP server mentioned in the serial monitor. You can now see two buttons on this weifare configuration web server. The first one is to scan the WiFi networks nearby, and then select one and enter the Wi Fi credentials. The other one is to add the SSID and password manually.

Here, I'm using the second option to connect it to my personal life and network. After entering the credentials, click the Save button and another message will be shown telling you that the credentials are saved and the board will try to connect to that network. Once the boat connects to the Configure network, you can see this message printed on the serial monitor. Next, we will look at how the code works. This code is a bare minimum implementation for wife a manager and it does nothing else than connect to a WiFi network. But by knowing The basic building blocks to implement the weifare manager, you can incorporate this in your own project or product.

This allows for customers or users of your product or project to change the Wi Fi credentials without coding in Arduino ID. In the code, we will first import the following libraries. You are already familiar with the first three libraries here from the previous videos. We handle the Wi Fi, the DNS, the capital Boto, and the web server for the wife and manager. The import wife a manager dot hatch inputs, the libraries for the weifare manager inside the void setup loop. First, the serial monitor is enabled.

Then an object is named weifare manager created to access the different functions or methods inside the Wi Fi manager library. Please check out the resources section to explore the differences. offered by the wife a manager. Here we have just used the wifey manager dot auto Connect ESP conflict AP this method will create a Wi Fi access point with SSID as first parameter and password as the second parameter. Here, I have not implemented password protection, feel free to add a password to improve security. This method also handles the following processes one creation of the HTTP web server two implementation of the captive portal with the DNS three saving of Wi Fi credentials to the EEPROM memory for automatically established connection on both or after configuring.

Coming back to the code. You can see that the setup loop is ended with a message signifying that the connection has been established. You can paste your project code in the word loop and incorporate the wireframe Manager to your project summary. In this video we have covered the following topics. Why use the Wi Fi manager library? How does the Wi Fi manager library work?

The captive portal, implementing Wi Fi manager on the sparkfun ESP 32 thing. In the next video, we will create a weather station project with an OLED screen and a DHT 11 sensor to learn how to implement Wi Fi manager and Octa to your projects.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.