Change & Store ESP32 WiFi credentials in EEPROM without uploading code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hey Guys, Welcome back to electronicsInnovation. In this video, I'm gonna show you how you can Change & Store ESP32 WiFI Credentials into EEPROM without uploading a single line code from Arduino IDE. This feature will make your IoT Projects easily accessable and more reliable. So, without wasting time let's get started. PCB Way ADD: If you want to convert your prototype projects to realtime applications & deploy in the realtime field, You need to design a PCB, because Devices with these Veroboards will not last long. PCB way is one of the best way to convert your prototypes into realtime applications. I have used their services to convert my prototypes into the realtime Applications. PCBWAY is one of the best PCB manufacturers in the current industry. At PCBway.com we can get 10 pieces of 2 layered PCBs at just $5 with 24 hours build time & also PCB way offering PCB assembly services at just $30 along with Free shipping. I have provided link in the description do check out their website for more details. Electronics Innovation Intro In all of my previous tutorials, I used to enter WiFi credentials in the program and hard code into the module as shown here. In case If I wanted to change SSID or password, I should take out the module from the project and connect with my laptop to dump the updated code. But, while working with Sonoff, I found that there is a provision to enter and change the wifi credentials through the mobile itself. So I have decided to implement the same thing on ESP32 module. I have already developed the same feature on ESP8266. but so many people have approached me for the same feature on ESP32, So I have decided to make this tutorial to help you all. Required components: 1. Breadboard 2. ESP32 Module 3. 10k Resistor 4. Push-button 5. Connecting wires 6. Data Cable to Program ESP32. Here is the Circuit diagram. I have added this external trigger circuit to add " On-Demand Credentials update feature" If we wanted to update the wifi credentials, we can trigger the ESP32 by simply holding this push-button for 2 to 3 seconds. The push-button is used to generate an external trigger at GPIO15 of ESP32 with a High pulse. This 10k resistor is used to pulldown the GPIO15 to 0 at the absence of high Pulse. After all connections. The circuit will be something like this. Coming to the programming part, Here is the code for ESP32_WiFi credential update wirelessly. This code will be available on the Project Page which is mentioned in the description below. As we are using the ESP32 camera module, we should have the esp32 addon installed in our Arduino Ide. I have already installed it. You can install it by following the above tutorial. These are the libraries we are using, all these libraries are pre-installed. you don't have to install them again. These are the global variables, If you wanted to have default wifi, you can provide the credentials here. any way it can be changed later. Declaration of functions, testWifi, launchWeb, setupAP Establishing local server at port 80 Coming to the Void Setup, Initializing serial monitor with baud rate 115200 for debugging. Disconnecting from the current WiFi network initializing EEPROM Memory Configuring GPIO15 as input to read the external trigger. Reading SSID from the EEPROM, and storing it into the esid, Reading password from the EEPROM, and storing into the epass. Then beginning the WiFi with SSID and Password which are read from the EEPROM. Coming to the void loop, Checking the wifi connection status, If WiFi is connected, a status message is Printing on the serial monitor. this message will be printed over 10 times using this for loop. You can add your main project code here. for example you wanted to read temperature data frm a sensor, and post it to the AWS server or Ubidots. That project code can be integrated here. Testing the wifi connection and External Trigger If both are true, printing a message "Connection status positive" on the serial monitor. If either Test WiFi or External trigger is false, Calling functions Launchweb and Setup Accesspoint along with printing a message on the serial monitor. handling server-client, if not connected to any wifi. Here is the function to test WiFi, it will return True or false based on the connection status. Here is the function to launch a web server, This will print the IP and call another function to create a Web server. Here is another function to Setup Accespoint and scan the available WiFi networks. You can enter the Accesspoint SSID here, I have entered ElectronicsInnovation. if you want your network to be secured, you can enter the password, if you want to keep it open, just leave it blank. Here is the most important function to create a basic web server, where we can enter the updated SSID and password. this will also write the newly received WiFi Credentials into the EEPROM memory. Let's upload this code to ESP32 Module. Connect the ESP32 module with a laptop. Check the Uploading configurations like board: ESP32 Wroover Module, Uploading Speed, and select the right port. If everything is okay Upload it. Till then the code gets uploaded I wanted to let you know one thing about our channel, as you can see here, 95.8% of the people who are watching videos in our channel are not subscribed, If you are new to this channel, or you didn't subscribe yet, i request you to subscribe and opt to recieve notifications if and only if you find this video is something informative & usefull to you. While Arduino log shows like this, press and holds the boot button until it turns as writing at some address, then release it. After successful uploading opens the serial monitor. On the serial monitor, we can see ESP32 read the SSID and Password from EEPROM, but there is nothing. So, with that Empty SSID and Password, it tried to connect but failed. So, the connection status is negative.  now created its own Access point to allow us to update the WiFi Credentials with IP address 192.168.4.1 and then Started server. Copy this IP Address, Connect to the freshly created access point, in my case it's ElectronicsInnovation. After successful connection, point your browser to the copied Ip address which is 192.168.4.1 Here you can see the all available wifi networks, I wanted to connect to my home wifi which is The Dark Knight Rises. Enter the SSID and password then submit the query. As soon as you submit, you can see the same data has been written into the EEPROM. Then Disconnected from the current wifi connection and Read freshly updated credentials from EEPROM and Successfully connected to it. Now, it started printing a message " Connected to the Dark Knight Rises Successfully" Let's see On-Demand Credentials Update feature. As soon as I click on the Push button, It read the external Interrupt from GPIO15 and disconnected from the current Wifi Network. Also started the webserver with IP 192.168.4.1 Copy this Ip, Connet to Electronics Innovation. Point your browser to Copied IP. Here you can see the all available wifi networks, I wanted to connect to my mobile wifi which is EI. Enter the SSID and password then submit the query. As soon as you submit, you can see the same data has been written into the EEPROM. Then Disconnected the current wifi connection and Read freshly updated credentials from EEPROM. This time, it got EI as SSID and Subscribe as a password. So, using these updated credentials, it successfully connects to the new WiFi network and started printing a message " Connected to EI Successfully" as expected. You can also do the same process on the Mobile, Simply takeout your mobile and point your favorite browser to 192.168.4.1 and update the WiFi credentials seamlessly. So, That's it for this tutorial. This how we can Change & Store ESP32 WiFI Credentials into EEPROM without uploading a single line of code from Arduino IDE. I hope you like this On-demand WiFi credentials update feature. Try integrating this feature in your existing projects, or Upcoming projects and let me know your thoughts in the Comments section. If you feel this feature will help you to make your IoT Projects more handy and reliable, give a big thumbs-up to the video and share it with your IoT Partner. See you soon on the next interesting project, bubyeee... మరిన్ని ఆసక్తికరమైన ప్రాజెక్ట్స్ తో మీ ముందుకు వస్తాను, అంత వరకు సెలవు, నమస్కారం.  
Info
Channel: Electronics Innovation
Views: 21,530
Rating: undefined out of 5
Keywords: esp32 wifi code, esp32 wifi configuration, esp32 wifi connection, esp32 wifi connect, esp32 wifi programming, esp32 wifi setup, esp32 wifi provisioning, esp32 save wifi credentials, esp32 reset wifi credentials, esp32 clear wifi credentials, esp32 delete wifi credentials, esp32 erase wifi credentials, esp32 wifi example code, esp32 wifi stack, esp32 wifi manager, electronicsinnovation, wifi manager, smart config, esp32 smart config, esp32 html wifi manager
Id: jfr2vNlyKmg
Channel Id: undefined
Length: 10min 55sec (655 seconds)
Published: Mon Sep 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.