ESP-IDF : ESP32 as SoftAP

We have connected to existing network using ESP32, we have sent messages to a TCP server running on different machine in our network. Now it is time for making ESP32 to create it’s own network. ESP32 has something called SoftAP mode, in which it can create WiFi network and can accept upto 4 clients. In this post we will learn how to put ESP32 in SoftAP mode and list the devices connected to our network (SoftAP mode also allows connected clients to communicate with each other)

ESP32 Soft AP
ESP32 Soft AP

This blog assumes that you already have ESP – IDF , to setup ESI – IDF check out this post. Most of the code for this blog has been adapted from here

Steps involved in making ESP32 as soft ap:

  • set static IP for AP
  • start DHCP server
  • Configure WiFi as AP
  • start WiFi

 

Using tcpip_adapter_set_ip_info we can configure our AP (config includes details such as netmask,gateway address etc.,). tcpip_adapter_dhcps_start will start the DHCP server

esp_wifi_set_config function lets us to set the details of access point. SSID name,its password etc., are some configurable items that can be set using esp_wifi_set_config.
Full code is available on git repo , following image shows the working of esp in access point mode.
ESP32 in SoftAP
ESP32 in SoftAP

 

Add a Comment

Your email address will not be published. Required fields are marked *