ESP32 Application Note #01 – WiFi Scanner

Welcome to AnalogLamb WordPress Blog. Today I am glad to share ESP32 Application Notes with you. ESP32 is Espressif new product, which has WiFi and Bluetooth. It is very suitable for IoT Applications. We hope you can learn about more details of ESP32 from the series – ESP32 Application Note.

Let us begin ESP32 Application Note #01 – WiFi Scanner.

What is the WiFi Scanner?

It can scan the environment to find out the wifi access points SSID,RSSI and Auth Mode. I believe that every smart phone, notebook computer and PAD have this function. Here is an example as below:

WiFi Scanner

ESP32 WiFi Scanner of XiaoMi

How to Make WiFi Scanner with ESP32?

Event and Event Handler

There is an important concept: event. After completing WiFi Scan, An event – SYSTEM_EVENT_SCAN_DONE  is occurred. Then a callback function will be handled. So we usually declare a function to process all events. For example, esp_err_t event_handler(void *ctx, system_event_t *event). And the function esp_event_loop_init() will add event_handler() to the system.

ESP32 WiFI Operation Mode

ESP32 can either be a station in the network, an access point for other devices or both. Here for WIFI scanner, It is in Station Mode.  Function esp_wifi_set_mode() to set up.

Scanning for Access Points

esp_wifi_scan_start() function will start the work. After completed it, the SYSTEM_EVENT_SCAN_DONE is occurred. Then esp_wifi_scan_get_ap_records() function will get results of a WiFi scan which are stored in ESP32 dynamically allocaed storage.

The Example: Github

ESP32 Wifi Scanner

The result of ESP32 Wifi Scanner

Buy ESP32 Modules & Boards in AnalogLamb 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s