Page 1 of 1

How to make a functional wifi access point with wifi connection.

Posted: Sat Aug 19, 2017 8:45 pm
by Pyshco
This would very basic, but, i'm new working on the wifi side of the ESP32, Can you guys help me with a example or else?

Re: How to make a functional wifi access point with wifi connection.

Posted: Sat Aug 19, 2017 10:38 pm
by permal
This should get you started: https://esp-idf.readthedocs.io/en/lates ... /wifi.html

Edit: Oh, just say this is in the Arduino section of the forum. Then that link might not help you.

Re: How to make a functional wifi access point with wifi connection.

Posted: Sat Aug 19, 2017 10:42 pm
by wahed-bd
Search with ESP32 MODE APSTA (Access Point and Station). or follow this link:
https://esp32.com/viewtopic.php?f=13&t=538

Re: How to make a functional wifi access point with wifi connection.

Posted: Sat Aug 19, 2017 11:29 pm
by wahed-bd
here you go.. just tested and it works fine.. It first sets the wifi mode to both access point and station. then starts the access point and then connects to a network.. However, If I use a configuration like accesspoint name and secret it doesn't work when set the mode as WIFI_AP_STA 'needs some work here'. Otherwise it is working perfectly fine..

Arduino code for esp32:

Code: Select all

#include <WiFi.h>
#include <WiFiAP.h>


const char* ssid     = "home wifi name"; // the ssid/name of the wifi, the esp will be connected to
const char* password = "home wifi password"; // the password of that wifi

const char* assid = "espAccessPoint";
const char* asecret = "hello";

void setup(){
  Serial.begin(115200);
  
  WiFi.mode(WIFI_AP_STA);
 

  //access point part
  Serial.println("Creating Accesspoint");
  WiFi.softAP(assid,asecret,7,0,5);
  Serial.print("IP address:\t");
  Serial.println(WiFi.softAPIP());

  //station part
  Serial.print("connecting to...");
  Serial.println(ssid);

  WiFi.begin(ssid,password);

  while(WiFi.status() != WL_CONNECTED){
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());   
  
}

void loop(){
  
 
 }
Hope that helps

Re: How to make a functional wifi access point with wifi connection.

Posted: Sun Aug 20, 2017 12:12 am
by Pyshco
Thanks!

Re: How to make a functional wifi access point with wifi connection.

Posted: Sat Oct 20, 2018 8:31 am
by jumpjack
Once I successfully set up an AP on my ESP32 and connected it to my router, can I log the data I am receiving and re-sending? Or it can only act as a bridge between the external device and my router?
The device is a Sonoff Pow, which sends its readings to chinese servers without logging them, and which I usually can only read by an android app, but I would like to add a local logging feature.

Re: How to make a functional wifi access point with wifi connection.

Posted: Mon Apr 01, 2019 5:51 pm
by mdtparedes
I am a bit new in using ESP32, but I need to use it's AP+STA capabilities. The problem is that when I tried the code that you give, there was an error. The error happened when I tried to connect my android phone to the ESP32 via wifi.

The error is as follows:

E (28543) event: mismatch or invalid event, id=63
E (28544) event: default event handler failed!
dhcps: send_nak>>udp_sendto result 0
dhcps: send_offer>>udp_sendto result 0

Any help is very much appreciated. Thank you in advance.