Get Arduino Wifi rev.2 to join an iPhone AP

Can Arduio WiFi Rev.2 acting as a client (or station) join an iPhone8 acting as a personal hotspot (or wifi access point (AP))? Problem is it won’t connect. Progress so far - the Arduino can successfully join my home LAN over its FiOS WiFi router. An iPhone11 as a client can successfully join the iPhone8 AP personal hotspot. I’ve put code into the Arduino to scan the wifi network it sees for status and Serial print the results (see below). It sees iPhone8’s ssid as well as some of my neighbors’ networks. The Arduino code has valid credentials to join three different networks. The code makes three attempts, each waits 10s while it’s WiFi.status != WL_CONNECTED then tries the next ssid. Two of the routers are temporarily shut down or out of range so I expected it to join the iPhone8 AP. When it fails to join a network it prints out a Reason Code = 201. I can’t find a list of reason codes for what that means, but all failed attempts report the same 201 reason code. I expected a different reason code for the iPhone8 AP join failure because the Arduino can at least detect iPhone8’s ssid, whereas the other two networks are not even advertising an ssid because the FiOS wifi is shut down and the other one is out of range. To me that should result in a unique reason code. Here’s the Serial.print() output.
12:01:53.898 → scan start
12:01:58.912 → scan done
12:01:58.912 → 7 networks found
12:01:58.958 → 1: Sue DeLuca’s iPhone Signal -38 dBm Encryption type: 4 Channel: 1
12:01:59.005 → 2: NETGEAR79 Signal -73 dBm Encryption type: 4 Channel: 6
12:01:59.099 → 3: fatboyjackPOSXfin Signal -87 dBm Encryption type: 4 Channel: 1
12:01:59.145 → 4: Fios-fP6e3 Signal -87 dBm Encryption type: 4 Channel: 1
12:01:59.239 → 5: DIRECT-DB-HP … Signal -90 dBm Encryption type: 4 Channel: 6
12:01:59.286 → 6: DIRECT-BF-HP … Signal -91 dBm Encryption type: 4 Channel: 6
12:01:59.379 → 7: SullyWireless Signal -92 dBm Encryption type: 4 Channel: 1
12:01:59.472 →
12:02:04.372 → Attemptiong to connect to Network named: FiOS-SO2CY
12:02:07.402 → Reason code: 201
12:02:17.354 → Attemptiong to connect to Network named: FiOS-SO2CY
12:02:20.354 → Reason code: 201
12:02:30.341 → Attemptiong to connect to Network named: FiOS-SO2CY
12:02:33.331 → Reason code: 201
12:02:43.311 → Attemptiong to connect to Network named: Fairpoint 864C
12:02:46.295 → Reason code: 201
12:02:56.281 → Attemptiong to connect to Network named: Fairpoint 864C
12:02:59.267 → Reason code: 201
12:03:09.236 → Attemptiong to connect to Network named: Fairpoint 864C
12:03:12.264 → Reason code: 201
12:03:22.200 → Attemptiong to connect to Network named: Sue DeLuca’s iPhone
12:03:25.227 → Reason code: 201
12:03:35.193 → Attemptiong to connect to Network named: Sue DeLuca’s iPhone
12:03:38.216 → Reason code: 201
12:03:48.176 → Attemptiong to connect to Network named: Sue DeLuca’s iPhone
12:03:51.183 → Reason code: 201
12:04:01.170 → Attemptiong to connect to Network named: FiOS-SO2CY
12:04:04.176 → Reason code: 201
12:04:14.134 → Attemptiong to connect to Network named: FiOS-SO2CY

The iPhone is reported to be on Channel 1. What channel does the FiOS router use, I wondered. Hypothesis1: Arduino is not trying the iPhone’s Channel.
There are things wrong with this hypothesis: The Arduino sees the ssid of the iPhone; doesn’t that mean it is looking at the iPhone’s channel? b) Assuming channels are frequencies, if tuned to the wrong frequency Arduino wouldn’t even see the iPhone8 ssid.
Couldn’t find any way in the WiFiNINA library to change the Wifi channel of the Arduino anyway.
To find out what channel the FiOS router was using I reactivated it. It’s ssid is FiOS-SO2CY and scan reported: FiOS-SO2CY Signal -40 dBm Encryption type: 4 Channel: 11
The router uses channel 11. I think the Arduino is capable of using any channel.
Hypothesis2: The neighbors’ signals on channel 1 are interfering with Arduino’s acquisition of the iPhone8 on channel 1. This one seems wrong too because the signal strength on the iPhone8 is -38 dBm and the next strongest channel 1 potentially interfering signal from fatboyjack is -87 dBm, which is several orders of magnitude weaker than the iPhone8 signal. In fact the power ratio by my calculation is 79,000:1 in favor of the iPhone. The last but most obvious hypothesis is the password is wrong! Nope. I’ve checked that about 50 times. Plus when using the same password on my iPhone11 it joins with no problem. I even tried changing the password in both places. It was 8 alpha-numerics and I made longer. I can’t change the ssid that the iPhone8 advertises (it does have spaces in it) because the iPhone8 sets that. So I’m out of theories. Hence this post. Got any? Oh, I forgot to mention hypothesis0. I misspelled “Attempting” in the serial printout. :slight_smile: Thanks for reading.

This is a long shot but might be worth checking. I assume the Iphone 11 uses both the 2,4GHz range and the 5GHz range, I have had problems with some devices that are only 2.4GHz failing to connect if the AP is using both 2.4GHz and 5GHz. The way round it is to disable the 5GHz usage until the client is connected then re-enable the 5GHz. I don’t know whether this is your problem or not but certainly the symptoms are very similar.

I thought a little bit about this just as I was reinstating the router because one must choose 2.4, 5 GHz or both when enabling wifi and I chose both with this thinking:
The iPhones do both and can pick either.
The Verizon FiOS router does both 2.4 and 5 GHz obviously and Verizon has enabled the router to choose automatically based on signal strength whichever it thinks will be more effective. The Arduino has no problem talking to the router.
I’m my experiment the router wifi is disabled so it’s just the Arduino talking to the iPhone therefore I figured the router settings were irrelevant.
However your point about forcing the AP to the lowest common denominator is a good one. The iPhone8 is the AP and I don’t know any way to limit it to 2.4Ghz only. But given the phone can do either, how does it choose what to offer its clients when the personal hotspot is enabled? One way might be that it simply remembers what frequency it’s last wifi connection used and offers that.
So I could go back to the router, turn off 5Ghz, connect both the Arduino and the iPhone to it at 2.4 GHz, then disabled router wifi, turn on iPhone personal hotspot which if this guess is correct will now offer 2.4 GHz, then reset the Arduino and see if it can join the iPhone’s AP. That’s the plan. I’ll let you know what happens. Thanks.

Didn’t work. Primed both the iPhone8 and the Arduino to operate at 2.4Ghz with the Verizon router by configuring the router to only offer 2.4 GHz. Both the Arduino and iPhone8 were able to join the wifi network at 2.4 Ghz. Enabled personal hotspot iPhone8 and configured router with both bands off leaving only the iPhone hotspot. Arduino could not join iPhone8 AP. Turning the 2.4Ghz band back on at the router and the Arduino immediately finds it and joins. Tried reconfiguring the router to only offer the 5 GHz and the Arduino could no longer join the Verizon router wifi network. When the router offers 2.4 Ghz alone or both 2.4 and 5 GHz the Arduino joins.
So no solution yet to get Arduino to join an iPhone AP.

Thought it was a long shot.

I’ve since found that Iphones upto the 12 only use 2.4GHz as far as I can see for Hotspots (at least that what this article says iPhone Personal Hotspot: How to switch between 2.4GHz and 5GHz bands (idownloadblog.com)) and that the Iphone12 allows control of which band is used.

I realise that I got your Iphone8 and 11 mixed up - you said you were using the Iphone8 for the Hotspot - I thought it was the 11 for some reason. That raises the question will it work on the Iphone11 hotspot - just for testing? I would be surprised, but the software might be more advanced and have bug fixes.

Funny I just read that same article this morning. My iPhone 11 uses Sprint for the carrier so there is no capacity for using a personal hot spot. The iPhone 8 uses AT&T for the carrier which does allow the hotspot. As the article states, “Before the iPhone 12 lineup, Apple’s Personal Hotspot feature was limited to the slower 2.4GHz Wi-Fi bank,” so even the iPhone 11, if it had hotspot would be 2.4GHz.

The one thing I learned from this exercise is that the Arduino Wifi Rev.2 seems to be limited to the 2.4GHz band as it would not connect when the router was configured to 5GHz only and therefore band selection is not the problem. That’s some progress at least.

Can you switch the sims over to carry out a test or are the phones locked to the carrier over there?

The phones are locked.

OK, drop that idea then.

What security mode is being used? WPA? WPA2? WEP?

What do you have in mind. I might be able to find and old At&t phone.

The router uses WPA2 security.

I was wondering if the problem was specific to the iPhone8 or whether it appears on the 11 as well.
Might be worth trying an old phone that allows tethering just to try and see if the problem is iPhone specific.

If the router uses WPA2, what does the iPhone use? What is your Arduino using?
I presume the router is using WPA2 personal rather then enterprise since I don’t think the Arduino libraries support the Enterprise version.

Everything sounds like an incompatibility between the Arduino and the iPhone, which would suggest some setting is not as required for the Arduino to connect to the iPhone Hotspot.
You’ve ruled out the 2.4G vs 5G since the iPhone and Arduino both only support 2.4G.
That suggests the next thing to look at is the security method WPA etc. Can you set the iPhone to WEP (purely for testing short term) and see if the Ardino set to WEP will connect to it then?

Which version of WifiNina are you using? I remember someone else having problems and upgrading to the latest version resolved their problems. Upgrading was not straightforward as part of the system needed a not formally released version of something.

Both the phone and the Arduino connect successfully to the router so doesn’t that say they’re sharing the same security method? The router is set to WPA2 but I don’t know if its enterprise. I know the encryption is not AES because the router is old; it’s probably 3-DES. In any case I don’t see a way to set the iPhone’s WIFI to specific security methods. But there may be a negotiation that takes place that I’m unaware of so it’s possible that in the absence of the router, the Arduino and iPhone can’t agree on what security method to use.

I was able to borrow a Microsoft Surface tablet/laptop which, I’m told does WiFi AP when connected via Ethernet to the router/Internet. So I will try connecting to that from the Arduino.
Regarding the WiFiNINA, I’m using Arduino Version 1.8.8, which was the latest offered just a few days ago when I installed it, but now I see there is a 1.8.9.

One other point: in the network scan that the Arduino is doing and serial printing the result, it shows the both the iPhone and the router to be using encryption type 4, e.g.,
FiOS-SO2CY Signal -40 dBm Encryption type: 4 Channel: 11
Which means, (I just looked it up) CCMP WPA. And CCMP is also know as AES CCMP, so it does use AES, notwithstanding my above statement. And the fact that the Arduino can talk to my router would indicate that the Arduino WiFi Rev.2 does indeed support AES encryption. So I guess my router is not that old, as CCMP was introduced in 2009 and the router is definitely newer than that.

With Arduino on the network, here’s what my router reports:

arduino-1a14

Connected To: Fios_Quantum_Gateway
Connection: Wireless 2.4G
Connection Type: 802.11n
IPv4 Address: 192.168.1.223
Status: Active

This is happening while several other devices are connected at 5G.

The network analyzer App on my iPhone also sees the Arduino and indicates it’s pingable. So I pinged it with my iPhone App and the Arduino responds (through no code of mine) so it must be built into the NINA chip set.

Noticed this about WifiNina Arduino UNO WiFi Rev 2 to Blynk - Need Help With My Project - Blynk Community - Not the first post but the second where he recommends WIfiNina_Generic for the Arduino Wifi Rev2 - not sure if it will make any difference but might be worth trying.