Failed connection, ESP32 and iphone WiFi

My ESP32 (MH ET Live ESP32 Mini kit) is not connecting with my iphone.
This has happened with multiple example sketches,
currently Blynk, ESP32_WiFi example from the Arduino IDE
Blynk library examples. The only change I have made is to paste in real values for
char auth, char ssid and char pass.

I have run the WiFiScan example from Arduino IDE WiFi examples and the ESP32 showed
my phone in ther serial monitor, along with other WiFi networks.

I have previouly had contact between several different ESP32 boards and my iphone.
I deleted all Blynk libraries from my arduino library folder an reinstalled them today.

The serial monitor doesn’t put out any debug information, untill you press the reset button on the board, then there is some.
ESP32 board is currently powered by USB cable from laptop. The WiFi network I chose is my phone WiFi hotspot, exactly as named in the WiFi Scan

I have also attempted collection with quickStart as well with similar results

Serial monitor outpup, none untill reset on board is pressed;

!⸮⸮:0⸮LB⸮=]⸮ON⸮M⸮T)I⸮⸮⸮:0⸮3⸮i⸮}ST⸮*⸮H_⸮⸮Q%
22:14:37.973 -> ⸮˙⸮gsZ⸮b⸮A%]⸮:0⸮⸮5
22:14:37.973 -> cl⸮E⸮v:⸮⸮0)}⸮⸮v:⸮⸮0,d⸮⸮⸮i0x⸮,⸮.⸮⸮rv'⸮⸮0,h⸮E⸮⸮:0⸮0⸮}⸮rv⸮⸮⸮0
22:14:37.973 -> [⸮iDI⸮	⸮oc-"⸮⸮:1C!⸮+⸮⸮0x3⸮⸮018⸮+⸮i4
!녑:0⸮f⸮⸮⸮⸮⸮⸮YK⸮⸮4⸮C!⸮+⸮⸮0x4⸮7⸮⸮⸮b╹i10L&SH⸮⸮⸮d:⸮⸮0⸮0⸮⸮bb⸮⸮⸮585S⸮⸮⸮⸮ 0⸮⸮‚6⸮j
22:14:38.207 -> ```


Code;
```  /*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on ESP32 chip.

  Note: This requires ESP32 support package:
    https://github.com/espressif/arduino-esp32

  Please be sure to select the right ESP32 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "a5eN2TZKo4kIYq4v3CCg0bs26-M-CjCH";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Vere's iphone";
char pass[] = "ta35eeymp64fd";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

@vere please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

OK, I guess the backtick is the one under the “tithe”, I was using the apostrophe. should I do something special with the serial output as well?

Yes, it’s good to put triple backticks before and after your serial output too.

I’d start by using 115200 as the baud rate for your serial output instead of 9600…

as that is probably the native baud rate for your ESP32 and will turn your current start-up messages from your device into something intelligible.

I’d also chose an SSID for your phone hotspot that doesn’t include apostrophes or spaces.

You may find that your phone’s hotspot software or mobile carrier blocks some of the Blynk traffic, but you should at least be getting some feedback about failed connection to blynk.cloud in your serial monitor.

Pete.

Thanks, will make those changes tonight.

Hello Pete,
1 removed an apostrophe from my SSID
2 Change baud rate to 115200

New serial output. No start up message, after pressing on board reset button get the following.

19:05:10.855 -> 
19:05:10.855 -> rst:0x1 (POWE⸮⸮⸮%UMQ⸮,boot:0x13 (SPI_FAST_FLASH_BOOT)
19:05:10.855 -> configsip: 0, SPIWP:0xee
19:05:10.855 -> clk_drv:0x00)}⸮⸮⸮⸮0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:05:10.900 -> mode:DIO, clock dZ⸮⸮j
19:05:10.900 -> load:0x3fff0018,len:4
19:05:10.900 -> load:0x3fff001c,len:1044
19:05:10.900 -> load:0x40078000⸮⸮⸮⸮10124
19:05:10.900 -> load:0x40080400,len:5856
19:05:10.900 -> entry 0x400806a8
19:05:11.133 -> [28] Connecting to VeresiPhone

code


/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "VeresiPhone";
char pass[] = "xxxxxx";

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

Are you using an iPhone 12 or later?

If so, do you have the “Maximise Compatibility” switch set to On in your hotspot configuration screen?

Pete.

iPhone 7.
This was working a few months ago. Wondering if there are libraries that are corrupted that I didn’t find. I only found Blynk libraries in Arduino/Libraries

Not progressing beyond this message tells us that you aren’t managing to connect to the WiFi hotspot.

Post a screenshot of your hotspot setup screen.

Pete.

Is this the one? There doesn’t seem to be much information here.

Yes, that’s what I wanted. Just wanted to check that the credentials you are using are correct.

Have you tried restarting your phone?

Pete.

Rebooted my phone and now completely different serial output

21:33:39.876 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
21:33:41.929 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:33:41.929 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
21:33:43.984 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:33:43.984 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
21:33:46.035 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:33:46.035 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
21:33:48.088 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:33:48.088 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
21:33:50.136 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:33:50.136 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND

If I press the onboard reset buttom

21:36:41.378 -> load:0x400⸮⸮⸮⸮blen:5856
21:36:41.378 -> Y⸮⸮⸮0x400806a8C⸮[27] Connecting to VeresiPhone
21:36:41.751 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
21:36:41.751 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
21:36:43.805 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:36:43.805 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
21:36:45.861 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
21:36:45.861 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND

Is this with debugging enabled in the IDE when you compiled the sketch?

Pete.

Verbose debugging was on, but because this is an example on the Arduino IDE, I expected it to boot OK, I can post the whole debug output but there are no errors mentioned.

the serial output was with this code section enabled for max debug output.

Comment this out to disable prints and save space 
#define BLYNK_PRINT Serial

I have tried to read about these errors but haven’t found much relevant yet

20:55:58.621 -> [W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 201 - NO_AP_FOUND
20:56:00.661 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED

It looks to me like you’ve enabled debugging in the IDE Tools me I and selected a debug level that includes WiFi debugging.
I guess that with this turned off, your serial monitor output would be identical to what you were seeing originally.

Pete.

I have made some progress.
It seems that the token I am using was generated when I was using Quickstart,
presumably once you generate a token that way, it has to be used with the appropriate TEMPLATE ID
even when using sketch that came from elsewhere (in this case from examples in the Blynk library)

After another iphone reset. (maybe I changed the SSID after the 1st reset and it required another ??)
with Blynk template commented out the Serial monitor output was ;
23:03:19.294 → [20655] Connecting to blynk-cloud.com:80
23:03:19.900 → [21269] Invalid auth token
23:03:37.282 → [38655] Connecting to blynk-cloud.com:80
23:03:38.118 → [39486] Invalid auth token

When I un-commented the Blynk template line, the serial monitor gave no output, **intill **
I pressed the on-board reset button, then got this serial monitor output below.

I have repeated this several times and I don’t get serial output till I do a manual reset.

serial monitor output;

23:07:38.185 -> 
23:07:38.185 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
23:07:38.230 -> configsip: 0, SPIWP:0xee
23:07:38.230 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
23:07:38.230 -> mode:DIO, clock div:1
23:07:38.230 -> load:0x3fff0018,len:4
23:07:38.230 -> load:0x3fff001c,len:1044
23:07:38.230 -> load:0x40078000,len:10124
23:07:38.230 -> load:0x40080400,len:5856
23:07:38.230 -> entry 0x400806a8
23:07:38.463 -> [28] Connecting to VeresiPhone
23:07:38.603 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
23:07:38.603 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
23:07:40.789 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 4 - STA_CONNECTED
23:07:40.789 -> [D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
23:07:40.789 -> [D][WiFiGeneric.cpp:419] _eventCallback(): STA IP: 172.20.10.12, MASK: 255.255.255.240, GW: 172.20.10.1
23:07:41.116 -> [2649] Connected to WiFi
23:07:41.116 -> [2650] IP: 172.20.10.12
23:07:41.116 -> [2650] 
23:07:41.116 ->     ___  __          __
23:07:41.116 ->    / _ )/ /_ _____  / /__
23:07:41.116 ->   / _  / / // / _ \/  '_/
23:07:41.116 ->  /____/_/\_, /_//_/_/\_\
23:07:41.116 ->         /___/ v1.0.1 on ESP32
23:07:41.116 -> 
23:07:41.116 -> [2656] Connecting to blynk.cloud:80
23:07:42.145 -> [3701] Ready (ping: 304ms).

Current code;



 
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID   "xxxx"  //try uncommenting


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxx";
char pass[] = "xxxxx";

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

The Template ID, Device Name and Auth Token should be copied and pasted from the device screen…

You can’t mix and match Auth token from different templates.

You should probably close the serial monitor then re-launch it.

I’ll mark this topic as closed now that you’ve identified and corrected your mistake.

Pete.

Thanks heaps for your help