Connection Problems Arduino Uno WiFi Rev2

Hy, guys.

I am Valerio and I am new with the use of Arduino UNO WiFi rev2.
I am trying to check if my new Arduino works properly and I am using the program in Arduino-Example-WiFiNINA-SimpleWebServerWifi and I have to say that I have a weird result.
If I use as WiFi the hotspot of my smarthphone I don’t have any problems, it connects and I have the IP. If I use the WiFi that I have at home then Arduino says endlessy: “Attempting to connect to Network named: Vodafone-3F8D”. If I remove the password from the WiFi then Arduino is able to connect to the WiFi but the IP that I have doesn’t work: if I try to open the page it says that the webpage is not valid.

That is the programm I am using:

#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 keyIndex = 0; // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
Serial.begin(9600); // initialize serial communication
pinMode(9, OUTPUT); // set the LED pin mode

// 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 Network named: ");
Serial.println(ssid); // print the network name (SSID);

// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
server.begin(); // start the web server on port 80
printWifiStatus(); // you’re connected now, so print out the status
}

void loop() {
WiFiClient client = server.available(); // listen for incoming clients

if (client) { // if you get a client,
Serial.println(“new client”); // print a message out the serial port
String currentLine = “”; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client’s connected
if (client.available()) { // if there’s bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
if (c == ‘\n’) { // if the byte is a newline character

// if the current line is blank, you got two newline characters in a row.
// that’s the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what’s coming, then a blank line:
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-type:text/html”);
client.println();

// the content of the HTTP response follows the header:
client.print(“Click <a href=”/H">here turn the LED on pin 9 on
“);
client.print(“Click <a href=”/L”>here turn the LED on pin 9 off
");

// The HTTP response ends with another blank line:
client.println();
// break out of the while loop:
break;
} else { // if you got a newline, then clear currentLine:
currentLine = “”;
}
} else if (c != ‘\r’) { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}

// Check to see if the client request was “GET /H” or “GET /L”:
if (currentLine.endsWith(“GET /H”)) {
digitalWrite(9, HIGH); // GET /H turns the LED on
}
if (currentLine.endsWith(“GET /L”)) {
digitalWrite(9, LOW); // GET /L turns the LED off
}
}
}
// close the connection:
client.stop();
Serial.println(“client disonnected”);
}
}

void printWifiStatus() {
// print the SSID of the network you’re attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print your board’s IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print(“signal strength (RSSI):”);
Serial.print(rssi);
Serial.println(" dBm");
// print where to go in a browser:
Serial.print(“To see this page in action, open a browser to http://”);
Serial.println(ip);
}


That is the result I have when I try to connect Arduino with the WiFi that has a password (WPA2-Personal):

15:21:49.653 → Attempting to connect to Network named: Vodafone-3F8D
15:24:10.172 → Attempting to connect to Network named: Vodafone-3F8D
15:25:39.979 → Attempting to connect to Network named: Vodafone-3F8D
15:27:09.816 → Attempting to connect to Network named: Vodafone-3F8D
15:28:39.605 → Attempting to connect to Network named: Vodafone-3F8D
15:30:09.420 → Attempting to connect to Network named: Vodafone-3F8D
15:31:39.210 → Attempting to connect to Network named: Vodafone-3F8D
15:33:09.010 → Attempting to connect to Network named: Vodafone-3F8D
15:34:38.805 → Attempting to connect to Network named: Vodafone-3F8D

Do you have any idea?

Thank you a lot for the support.

Hi Valerio,

just to be sure I copied your code and only substituted pin # 9 with the LED_BUILTIN constant and compiled/uploaded the sketch to my board: it works perfectly. Opened the serial monitor, after 10 sec of delay it shows the IP internal address assigned to your connection by your access point (something as 192.186.x.y).
In my case:

Attempting to connect to Network named:
SSID:
IP Address: 192.168.1.7
signal strength (RSSI):-37 dBm
To see this page in action, open a browser to http://192.168.1.7

This is the address you must use with your browser to show the html page giving you the possibility to switch on/off the led. The device running the browser must be connected to the same WLAN of the board (accessing to the board from outside requires to set a port forward on your AP). You should check to have inserted the correct credentials on the arduino_secrets.h file (SSID and WPA key, called here password).

Good luck,
mike

Hy Mike,

I have already checked the credentials and they are right. I have even called the telephone operator and they said that I hava a general problem with the internet connection and the router. The router has to be replaced, I should get the new one in one week. One I get it I will try immediately the Arduino and I will keep you posted.

Thank you just the same.

Valerio