• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » ESP32 Arduino Wi-Fi Access Point with Wi-Fi Connection (Station)

By Abhishek Ghosh April 28, 2019 12:18 am Updated on April 28, 2019

ESP32 Arduino Wi-Fi Access Point with Wi-Fi Connection (Station)

Advertisement

It is possible to setup ESP32’s Wi-Fi to access point and station. ESP32 can connect to another hotspot and share the connection. An access point (AP) is a networking hardware device which allows other Wi-Fi devices to connect to a network. Some basic theory required to know for making basic code better.

An AP is different from a hotspot.
Hotspot is the physical location (and the device) where Wi-Fi access to a WLAN is available. SoftAP or software enabled access point is software enabling a
device which is not router but creates access point by software/coding. Wireless access has special security considerations. Many wired networks base the security on physical access control. Modern access points come with built-in encryption. The first generation encryption scheme, WEP, proved easy to crack; the second and third generation schemes, WPA and WPA2, are considered secure if a strong enough password or passphrase is used.

ESP32 Arduino Wi-Fi Access Point with Wi-Fi Connection

What is the usage? If we have one ESP32 running as an access point (AP) and a second ESP32 running as a station (STA). When the access point (AP) ESP32 starts up and the STA ESP32 connects to it, then we should be able to form a connection from a client application running on AP. This actually increase the range in some specific use-case.
We can set a soft AP using the ESP32 and the Arduino core. This way, other devices can connect to the ESP32 without the need to connect to a router. This is soft AP :

Advertisement

---

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "WiFi.h"
const char *ssid = "MyESP32AP";
const char *password = "testpassword";
void setup() {
  Serial.begin(115200);
  WiFi.softAP(ssid, password);
  Serial.println();
  Serial.print("IP address: ");
  Serial.println(WiFi.softAPIP());
}
void loop() {}

Basic example code for ESP32 Arduino is like below :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <WiFi.h>
#include <WiFiAP.h>
 
 
const char* ssid     = "wifi name"; // the esp will be connected to
const char* password = "wifi password"; // the password of it
 
const char* assid = "AccessPoint"; // devices will connect
const char* asecret = "something"; // password for it
 
void setup(){
  Serial.begin(115200);
  
  WiFi.mode(WIFI_AP_STA);
 
  //access point
  Serial.println("Creating Accesspoint");
  WiFi.softAP(assid,asecret,7,0,5);
  Serial.print("IP address:\t");
  Serial.println(WiFi.softAPIP());
 
  //station
  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(){
  
}

ESP32 WIFI_AP_STA mode has known issues which results to the condition of not working as intended. This is related to the fact that STA will switch to the channel of the AP it is trying to connect to, and SoftAP will have to switch to the same channel. So the client will have to reconnect to the SoftAP on its new channel. In most cases this causes TCP connections to be reset.

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include "esp_log.h"
 
const char* ssid = "your ssid";
const char* password = "password";
 
WebServer server(80);
 
void setup(void) {
 
Serial.begin(115200);
esp_log_level_set("*", ESP_LOG_VERBOSE);
WiFi.mode(WIFI_AP_STA);
WiFi.softAP("new_TEST","43255234",6);
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
 
void loop(void) {
}

Tagged With arduino wifi access point , esp32 wifi , esp32 connect wifi , duino softap , arduino wifi begin , esp32 arduino baord wifi access point , esp32 wifi SSID , Node js Aduino ESP32 AP , esp32 access point , esp32 arduino wifi example

This Article Has Been Shared 790 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to ESP32 Arduino Wi-Fi Access Point with Wi-Fi Connection (Station)

  • Arduino and LED Bar Display : Circuit Diagram, Code

    Here is a Guide Explaining the Basics, Circuit Diagram, Code on Arduino and LED Bar Display. LED Bar Display is Actually Like Multiple LED.

  • How to Develop Android App for Arduino

    You Can Develop Small Android Apps and to Control Arduino Projects for DIY Home, Car etc Automation. Here is How to Develop Android App for Arduino.

  • Which Kind of Multimeter Electronics Beginner Should Buy?

    Which Kind of Multimeter Electronics Beginner Should Buy? Any Multimeter Which Works. Technically You Should Know Formulas, Coding and Use Multimeter For Confirmation.

  • All the Sensors of Android Smartphone on Arduino With 1Sheeld+ Shield

    Use All the Sensors of Android Smartphone on Arduino With 1Sheeld+ Shield. You Can Literally Avoid Buying Few Hundred Dollar Worth Extra Shields.

  • High Quality ESP32 Development Boards Vs Cheap ESP32 Clones

    In High Quality ESP32 Development Boards Vs Cheap ESP32 Clones Comparison, High Quality is the Winner. Cheap China Clones May Be Good For Limited Projects.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Ways To Make Sure Your Online Course Outshine Others July 3, 2022
  • Will Smart Factories Become the New Assembly Line? July 2, 2022
  • The Cost of Doing Business as a Handyman July 1, 2022
  • Samsung Galaxy S22 Ultra: Long Term Review June 30, 2022
  • How to Make the Most of Your S Pen (S22 Ultra) June 29, 2022

About This Article

Cite this article as: Abhishek Ghosh, "ESP32 Arduino Wi-Fi Access Point with Wi-Fi Connection (Station)," in The Customize Windows, April 28, 2019, July 4, 2022, https://thecustomizewindows.com/2019/04/esp32-arduino-wi-fi-access-point-with-wi-fi-connection-station/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy