-->
Page 1 of 1

ESP8266 connect to router wifi via iOS application?

PostPosted: Sun Jul 23, 2017 9:09 am
by Truc
is it possible? ESP8266 connect to router wifi via iOS application?
I want to make an application control something by ESP8266. My workflow bellow:

- Open the app, on the device connected to wifi router.
- Connect to ESP8266 and give it SSID and PASSWORD info from current Wifi.
- ESP8266 receive this infos and auto connect to Wifi router.

Thank for your advices first.

I tried this way but I get user experience. Because user has to do many steps.
- Using WiFiManager, make ESP8266 as wifi router.
- Go to Wifi setting from device to connect to ESP8266 Wifi.
- Give Wifi infos (SSID, PASSWORD) by go to 192.168.4.1 from web browser.
Just note here to avoid this way :D

Re: ESP8266 connect to router wifi via iOS application?

PostPosted: Wed Jul 26, 2017 8:31 am
by martinayotte
Don't expect to much wizardry ...

Re: ESP8266 connect to router wifi via iOS application?

PostPosted: Thu Jul 27, 2017 1:49 am
by Truc
martinayotte wrote:Don't expect to much wizardry ...


Dear Martinayotte,

I know that it is possible, I have a demo (Board include ESP8266, an application). But I don't have any source code. Poor me.

Btw, thank for you response.

Re: ESP8266 connect to router wifi via iOS application?

PostPosted: Sun Jul 30, 2017 3:31 am
by Truc
I found the way to do that:
This is code on iOS application:
https://github.com/EspressifApp/EsptouchForIOS

This is code on ESP8266 run on Arduino:
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

WiFiUDP Udp;

void setup() {
int cnt = 0;
//Allocate baud 115200
Serial.begin(115200);
//Set Mode wifi is station
WiFi.mode(WIFI_STA);
//Waiting for connect
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
if(cnt++ >= 10){
WiFi.beginSmartConfig();
while(1){
delay(1000);
//Checking the connection success and print inform message
if(WiFi.smartConfigDone()){
Serial.println("SmartConfig Success");
break;
}
}
}
}

Serial.println("");
Serial.println("");

WiFi.printDiag(Serial);

//Allocate server
Udp.begin(49999);
Serial.println("Server started");

//Print IP address
Serial.println(WiFi.localIP());
}

void loop() {
//Receiving package from ESPTouch
Udp.parsePacket();
//Print IP of ESP8266
while(Udp.available()){
Serial.println(Udp.remoteIP());
Udp.flush();
delay(5);
}
}