SUMMARY:
This project is to create an open wifi Scanner which will indicate visually by an LED, when there is an open WiFi (i.e) a WiFi without Password or WiFi without authentication. Here an LED is connected to the GPIO pins of ESP8266-01 and it is used for the indication of Open Wifi availability. LED will be blinking while searching for an open WiFi, LED will be ON continuously when an open WiFi is Found. This is done by NodeMCU Firmware and Lua Scripting.
DESCRIPTION:
Prerequisites & Equipment:
-
ESP8266 with Flashed NodeMCU.(Flashing ESP8266 With NodeMCU)
-
EsPlorer for tutorial refer this link.
-
Open WiFi Scanner Coding
After Finished With Flashing of NodeMCU. You can connect the ESP8266 to USB-UART converter in normal mode by the following connection.
The connection details are as below:
WIFI Module |
USB-TTL
|
Vcc |
3.3v |
Gnd |
Gnd |
TX |
RX |
RX |
TX |
CH_PD |
Connected to 3.3v to enable chip firmware boot |
Don’t forget to pull up CH_PD HIGH, you won’t get a response from the module if it is not done.
Since two pins need to be connected to 3.3v it’s easiest to either use a breadboard with some connector cables. Connect LED to it, cathode (longer pin) to GPIO2 pin of the ESP8266 and anode (shorter pin) to the GND pin.
Fig. 1: Prototype of ESP8266 based Open WiFi Scanner
The above connection will set the ESP-01 in normal operating mode.
Now open ESPlorer, Copy the coding and Create a file named as init.lua.
The File name should be exactly the same since every time NodeMCU boots up it will execute init.lua.
Open the file by clicking open icon in the ESPlorer window.
Fig. 2: Screenshot of ESPlorer Window
Open init.lua and click on the open button in the ESP8266 portion. After the port is opened upload the code by clicking upload button at the bottom of Host portion.
After uploading, press “Run” button now the program will start executing. Each and every time ESP8266 is powered on, this program will start automatically. If you want to stop it you can format using Format Button in ESP8266 Side.
Program Description:
_DELAY_LIST = 30000
_DELAY_BLINK = 250
_TIMER_BLINK = 0
_TIMER_LIST = 1
_PIN_LED = 4
These are the variables declared for the program.
wifi.setmode(wifi.STATION)
This line will make ESP8266 in client mode.
gpio.mode(_PIN_LED, gpio.OUTPUT)
gpio.write(_PIN_LED, gpio.LOW)
ledState = false
These lines will make GPIO2 as OUTPUT and LOW at first.
function blinker()
if (ledState==false) then
ledState = true
gpio.write(_PIN_LED, gpio.HIGH)
else
ledState = false
gpio.write(_PIN_LED, gpio.LOW)
end
end
tmr.alarm( _TIMER_BLINK, _DELAY_BLINK, 1, blinker )
The above function is used for the Blinking LED when there is no Open WiFi.
function listap(t)
This function is for searching the Open WiFi.
The APs are listed as +CWLAP: ecn,ssid,rssi,mac
The Parameter are
ecn: It is a number denoting the security of the Access point
0 – OPEN
1- WEP
2 – WPA_PSK
3 – WPA2_PSK
4 – WPA_WPA2_PSK
isFree = string.sub(v,0,1)
if (isFree==”0″) then
foundFree = true
end
The above Function will search for “0” in the “ecn” Field and stop the LED blink and make it HIGH which will denote the availability of open WiFi.
Here is the video
Filed Under: Featured Contributions
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.