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

User avatar
Pyshco
Posts: 28
Joined: Wed Jul 19, 2017 2:36 pm

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

Postby Pyshco » Sat Aug 19, 2017 8:45 pm

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?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

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

Postby permal » Sat Aug 19, 2017 10:38 pm

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.

wahed-bd
Posts: 4
Joined: Sat Aug 19, 2017 9:15 pm

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

Postby wahed-bd » Sat Aug 19, 2017 10:42 pm

Search with ESP32 MODE APSTA (Access Point and Station). or follow this link:
https://esp32.com/viewtopic.php?f=13&t=538

wahed-bd
Posts: 4
Joined: Sat Aug 19, 2017 9:15 pm

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

Postby wahed-bd » Sat Aug 19, 2017 11:29 pm

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

User avatar
Pyshco
Posts: 28
Joined: Wed Jul 19, 2017 2:36 pm

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

Postby Pyshco » Sun Aug 20, 2017 12:12 am

Thanks!

jumpjack
Posts: 6
Joined: Sat Mar 24, 2018 4:35 pm

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

Postby jumpjack » Sat Oct 20, 2018 8:31 am

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.

mdtparedes
Posts: 1
Joined: Mon Apr 01, 2019 5:43 pm

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

Postby mdtparedes » Mon Apr 01, 2019 5:51 pm

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.

Who is online

Users browsing this forum: No registered users and 51 guests