This is a simple project on how to scan the available wifi networks using esp8266 wifi module, join one and post a request to an online web server. I am posting data on an online Thingspeak server. Its a stand alone esp8266 wifi module project. No external microcontroller or any other control system is attached with esp8266. I am using ESP-01 module in this project. Code is written in arduino ide and module is programmed using ft232 usb to uart converter. Before beginning further i assume that you are familiar with esp8266 programming in arduino ide and you installed esp8266 support for arduino ide. If you did not installed the arduino ide esp8266 plug in and do not now how to program esp8266 wifi module using ft232 usb to uart module, i suggest to first take the below tutorial. It will help you in understanding this project more effectively and easily.
SSID and Password saved in the EEprom of the esp8266 module
When the module is powered up it will join the network who’s ssid and password is already saved in the eeprom of esp8266 module. If the module is new than you have to assign it a SSID and Password of the network, you wish to join using the below explained method.
Scanning available wifi networks and joining one
The hardware end module has two buttons. Both the buttons are used as inputs. Pressing the one will scan all the wifi networks available in the range. Store the networks SSID’s in an array and will present the SSID in an HTML page. The HTML page displays all the networks SSID’s and contains two text boxes with a button. Text boxes are named as SSID: and Paswoord: Enter the SSID of network to which you wish to connect and password of the network in the text boxes. Press the Submit button to join the network. Its so easy. Next time when you power the module it will join the same network automatically.
How to connect to esp8266?
Connect your pc/laptop with esp8266 wifi network if your esp8266 is brand new and the program below is uploaded in it. The SSID is “Metro” and password is”1234“. After joining the esp8266 wifi access point now its time to join the new available wifi networks. Open your browser and enter the ip “192.168.4.1“ in the browser. “192.168.4.1” is default ip that esp8266 is on during access point mode. After hitting the ip an html page will be loaded in the browser.
Note: Some user commented that the esp8266 did not originated with ssid ‘Metro‘ rather it pops up with an open network. So if you did not find the ssid ‘Metro‘ join the new network which is open and has no password restriction. Most probably the new network name contains the word “esp” in it. Rest of the steps are same
Note: Some user commented that the esp8266 did not originated with ssid ‘Metro‘ rather it pops up with an open network. So if you did not find the ssid ‘Metro‘ join the new network which is open and has no password restriction. Most probably the new network name contains the word “esp” in it. Rest of the steps are same
To join any network enter its SSID and Password in the text fields and press Submit button. Please make sure to enter the correct ssid and password. After you press Submit button the esp8266 will save the new SSID and Password in its eeprom and joins the new wifi network automatically. After saving the new settings in eeprom, esp8266 module will respond you with the confirmation message.
After getting the confirmation message reset the module, it will now join the new wifi network. The function below scans all the available wifi networks in the esp8266 module range and present them on an HTML page.
Saving SSID and Password in eeprom of esp8266 module
First the code checks that valid data arrived form the html page and SSID and Password feilds are not empty. It then clears/delete the previous ssid and password stored in the eeprom. After clearing the previous settings it stores the new ssid and password in the eeprom. Now when ever the esp8266 is rebooted it will join the same network. If you wan to change the network repeat the same process again.
The second button when pressed sends an HTTP post request to a Thingspeak server containing raw data. The Thingspeak server extracts the data and display it on a grape that we made in our account. Thingspeak an IOT (internet of things) platform/server that store sensors, actuators data in a cloud and lets you analyze the data in graphical and tabular form. I created a field in Thingspeak account with name “field1” to which i am sending/Writing the raw data. I am not going to explain each and every step of creating account on Thingspeak and post data. Just see the tutorial below for it. Don’t forget to include your account API Key in the code below.
Download the project code .ino file. Code is written in Arduino ide and uploaded to esp8266 using ft232 usb to uart programmer. Please give us your feed back on the project. If you have any queries write them below in the comments section.
Filed Under: Arduino Projects, Microcontroller Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.