I recently purchased two Arduino 33 IoT boards and have not been able to get either of them to connect to my WiFi router. The Arduinos give the WL_NO_SSID_AVAIL status, but only when given the correct SSID. When given a nonsense SSID, the status reported is WL_CONNECT_FAILED. Perhaps the information below will allow someone with more experience than I to figure out what is going on, or suggest further action.
Using the WiFiNINA examples, I was able to connect to an un-encrypted network at a local library and also to a Guest network at a local restaurant. The SSID and password for my home network work for all of my other hardware (computers, phones, tablet, rasp-pi). I changed the wifi password and got all other hardware (computers, etc) working with the new password. I was unable to get the Arduinos working with the new password.
To try to figure out what is going on, I added the following text to the “ConnectWithWPA” sketch:
When this sketch is run, output to the Serial monitor indicates that the status immediately after the initial WiFi.begin() call was “no SSID available”. Subsequent WiFi.begin() calls responded “disconnected”.
I connected to my router (Arris model DG3450) through its web site and found that it has a tab that lists connected devices. On this list was an “Unknown” device with the MAC address of the Arduino board. While most of the devices on the list had IP addresses listed as DHCP, the listed IP for the device with the Arduino MAC address was listed as “Reserved IP”. The tab has a button labeled “Add device with Reserved IP”. Clicking this tab allowed me to assign host names, MAC addresses, and IP addresses to the two Arduinos. Unfortunately, this did not result in any change in the behavior.
Any suggestions will be gratefully appreciated. Thanks, Jack
Ok, it is mostly just the connect with wpa sketch, but I put the above mentioned lines and some code from the scanNetwork sketch to print out the mac address and ssid. There is also a line where it prints the status code value. I have never gotten to the line where it says "you are now connected to the network"
/*
This example connects to an unencrypted WiFi network.
Then it prints the MAC address of the WiFi module,
the IP address obtained, and other network details.
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFiNINA.h>
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
int status = WL_IDLE_STATUS; // the WiFi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
byte mac[6];
WiFi.macAddress(mac);
Serial.print("MAC: ");
printMacAddress(mac);
Serial.println("Scanning available networks...");
int numSsid = WiFi.scanNetworks();
if (numSsid == -1) {
Serial.println("Couldn't get a WiFi connection");
while (true);
}
// print the list of networks seen:
Serial.print("number of available networks:");
Serial.println(numSsid);
// print the network number and name for each network found:
for (int thisNet = 0; thisNet < numSsid; thisNet++) {
Serial.print(thisNet);
Serial.print(") ");
Serial.print(WiFi.SSID(thisNet));
Serial.print("\tSignal: ");
Serial.print(WiFi.RSSI(thisNet));
Serial.println(" dBm");
// Serial.print("\tEncryption: ");
//printEncryptionType(WiFi.encryptionType(thisNet));
}
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
// attempt to connect to WiFi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, pass);
//while (status != WL_CONNECTED) { // moved
if(status == WL_NO_SSID_AVAIL){
Serial.println("no SSID available");
}else if(status == WL_DISCONNECTED){
Serial.println("disconnected");
} else if(status == WL_CONNECT_FAILED){
Serial.println("scan failed");
}
// wait 10 seconds for connection:
delay(10000);
Serial.print("status: ");
Serial.println(status);
}
// you're connected now, so print out the data:
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
}
void loop() {
// check the network connection once every 10 seconds:
delay(10000);
printCurrentNet();
}
void printWifiData() {
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
Serial.println(ip);
// print your MAC address:
byte mac[6];
WiFi.macAddress(mac);
Serial.print("MAC address: ");
printMacAddress(mac);
}
void printCurrentNet() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print the MAC address of the router you're attached to:
byte bssid[6];
WiFi.BSSID(bssid);
Serial.print("BSSID: ");
printMacAddress(bssid);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.println(rssi);
// print the encryption type:
byte encryption = WiFi.encryptionType();
Serial.print("Encryption Type:");
Serial.println(encryption, HEX);
Serial.println();
}
void printMacAddress(byte mac[]) {
for (int i = 5; i >= 0; i--) {
if (mac[i] < 16) {
Serial.print("0");
}
Serial.print(mac[i], HEX);
if (i > 0) {
Serial.print(":");
}
}
Serial.println();
}
I am sure that it will be of no consolation to you but the sketch works for me
You're connected to the networkSSID:
XXXXXXX
BSSID: D8:D7:75:BA:9E:48
signal strength (RSSI):-33
Encryption Type:4
IP Address: 192.168.1.88
192.168.1.88
MAC address: A4:CF:12:23:4C:48
SSID: XXXXXXX
BSSID: D8:D7:75:BA:9E:48
signal strength (RSSI):-23
Encryption Type:4
Thanks for taking the time to look into this UKHeliBob. I think the problem is that my router doesnt play nice with the Arduino. It would be helpful if someone could tell me what WL_NO_SSID_AVAIL actually means.
Best, Jack
I have the same problem , in addition to what was described above I replaced the router and the first time the card successful connected to the router wifi only once and then failed to connect to the router wifi.
to my cellular phone hotspot it successful connct all the times.
I do not understand what the difference is between the router and the hotspot.
Jsummers, can you try to connect to cellular hotspot ?
please send the result
Hi Rami1,
I had not known that I could do this. i set up the hotspot using my phone and I was able to connect to the Arduino. I have no explanation for why this works and connecting directly to the router does not.
Did you try re-loading the program on the Arduino? Sometimes com ports fail to disconnect. Maybe the hotspot is doing that as well. Perhaps if you turn the hotspot off then back on? Let me know how you fare with this.
Jack
The router supports three different types of WiFi. b/g/n is one of them. I tried each of them unsuccessfully. I also disabled all firewall options. 2.4 GHz. I have not tried 5 G.
Hi Rami1,
I originally misread your post to say that you could not reconnect to the hotspot. Now I see that you can reconnect to it. That is what I am seeing as well: Arduino connects to hotspot every time, but never to router.
Thank you for your help. This is a big step forward. It is not a final solution, however, because it requires the use of the phone any time the Arduino needs to connect to WiFi.
Thanks again!
Jack
If both of you can cannot to your router but can connect to a hotspot on your 'phone then that would suggest that there problem is caused by the router.
That is why I asked about the router specification
If Rami1 and I both have defective routers, then Rami1's second router that he purchased must have been defective as well. I also have an access point in my garage that the Arduinos will not connect to. The list of devices that are able to connect to my router and access point include:
My personal laptop pc
My desktop pc
My work laptop pc
My wife's mac
My wife's ipad
My phone
My wife's personal phone
My wife's work phone
Two raspberry pis
I have had numerous guests who have been able to access the network on their devices.
With the disclaimer that I am not at all familiar with wifi security protocols, it seems more likely that the issue has to do with some security protocol that the Arduino is failing but the remaining devices pass.
I have not said that the routers are defective, rather I was exploring the possibility that they, or their setup, are incompatible with the Nano 33 IOT. That is not the same thing at all
What is the current name of your router access point ?