Arduino Uno R4 Wifi does not connect to Wifi

Hello all.

I bought a genuine Arduino Uno R4 WiFi which I could connect to a Wifi network on January 22nd, while I was away from home.
I tested the sketch generated by the Arduino IoT Cloud Thing which switches on and off the built-in LED according to a switch widget created in a dashboard and everything worked properly, including from my smartphone.
Coming back home, I modified the network credentials (network and password but kept the secret key) and loaded the sketch to the board.
And the board cannot get connected to the wifi. On the serial monitor, I got the following sequence :
SHA256: 0 bytes (of 0) read
***** Arduino IoT Cloud - configuration info *****
Device ID: a92ece3d-b264-417b-bc99-4776d67aff93
MQTT Broker: mqtts-up.iot.arduino.cc:8884
WiFi.status(): 0
Current WiFi Firmware: 0.3.0
Connection to "FREECP" failed
Retrying in "500" milliseconds
Connection to "FREECP" failed
Retrying in "500" milliseconds
Connection to "FREECP" failed
Retrying in "500" milliseconds
....

I checked the credentials (which are OK), the network (which is in 2.4 GHz) and everything I could.
I would much appreciate if somebody could help me solve this issue.
Did I forget a step (I'm a beginner on Arduino cloud) ?
Are there constraints on the password ? Case sensitive ? Length ? ...

Many thanks in advance.
Christophe.

The presence of \ (backslash) or " (double quotes) characters can be problematic. It is possible to use passwords that contain these characters, but they must be properly escaped, and the escaping requirements are more complex than might be expected.

I'm not aware of any other problematic characters, but I would recommend using only the basic characters (i.e, A-Z, a-z, 0-9, -, _, .) just to be safe.

Definitely.

I would expect it is the same as the limits imposed by the Wi-Fi framework (e.g., 63 characters for WPA2). I just tried a 50 character password and it worked fine.

Thank you very much for your kind help.
With what you wrote, the issue does not come from the password.
What is strange is that the board gets easily connected to my phone, set as a wifi access point to the network, and not directly to the network.
Regards.

I face the same problem. My R4 connects to my mobile hotspot but not to my home network. I have a dual band WiFi Router . So far I have been using 5 GHZ. After finding out that R4 connects only to 2.4 GHz I created a new SSID on my router for 2.4GHz and used a simple password without any special characters. Still my R4 refuses to connect. I was out of station for some time and I tested the R4 with few other 2.4GHz networks at outstation . It worked fine. But why is it not connecting to my home 2.4GHz Network..? Is there any other WiFi requirement..?

Your 2.4Ghz Wifi´'s SSID and password should not be too long or have special characters. Check/Review also your router's wifi security settings. Try using the same settings you used for your hotspot wifi.

Could this be a region issue?

Some channels (frequencies) are not allowed in some regions.
Maybe UNO R4 WiFi avoids some channels?

@silentobserver Have not observed that. For this poster, there is something about his router's wifi he needs to fix.

Also Update the connectivity module firmware on UNO R4 WiFi

Firmware updated. Password is very simple. No issues. But it does not connect. All other devices in my home connect properly. I feel Arduino should do something so that R4 connects to any WiFi network seamlessly.

Blockquote

Sorry but this ist not ture @ptillisch.
If I use a 50 Char password and fill it with special chars, it is defintely not working. Only <32 Chars.

Why would you do that when you are attempting to disprove my claim that 50 character passwords are supported? It is at least equally possible that your result was caused by the inclusion of the "special chars" rather than the length of the password.

Here you can see I have set a 50 character password of non-problematic characters:

image

(12345678901234567890123456789012345678901234567890)

And here you can see from the Serial Monitor output that after uploading the Thing sketch to my UNO R4 WiFi board, it is able to connect to the AP that has that password:

***** Arduino IoT Cloud - configuration info *****
Device ID: 0d3e902d-68f4-43f6-b7f0-68e2b0abe1f4
MQTT Broker: mqtts-up.iot.arduino.cc:8884
WiFi.status(): 0
Current WiFi Firmware: 0.4.1
Connected to "mckinley_guest"
Connected to Arduino IoT Cloud
Thing ID: 8e596835-41c1-4fa5-b05e-6245adc87186

Try this:

  1. Change the password of the access point on your Wi-Fi router to:
    12345678901234567890123456789012345678901234567890
    
  2. Change the password in the "Network" settings of your thing to that password.
  3. Upload the Thing sketch to your UNO R4 WiFi board.

Is the board able to connect to the access point now?

And what is if you try:

#define SECRET_SSID "TestWifi"
#define SECRET_PASS "!uhZge4v8wFgYP9-s_-DNY3KqNdU.Nmy_DdTjDo-FqtDf3mMhyk"

It works fine for me.

I happened to be beta testing version 0.4.1 of the firmware at the time I made my previous reply on this topic (though I was using 0.3.0 when made my original reply last month). I downgraded to the production release version 0.3.0 (which I see from your post on the other topic is the version you have installed) before running that experiment in order to eliminate the chance the different version is the reason for our different results.

This is ending up turning into a parallel discussion to your other topic so I will request that any further discussion of @cdr_chakotay's problem be done on that topic:

1 Like

maybe 2.4GHZ network will be fine, but it can not work in 5G network.

I had the same problem. New arduino UNO R4 that doesn't want to connect on the WiFi network. Neither by uploading a sketch from the examples, it keeps saying "attempting to connect to...".
If anyone has a solution

Marco

Welcome to the forum

Please post your sketch, using code tags when you do. This prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

#include "WiFiS3.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 led = LED_BUILTIN;
int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  Serial.begin(9600);    // initialize serial communication
  pinMode(led, 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 to 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("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
            client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");

            // 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(LED_BUILTIN, HIGH);  // GET /H turns the LED on
        }
        if (currentLine.endsWith("GET /L")) {
          digitalWrite(LED_BUILTIN, LOW);  // GET /L turns the LED off
        }
      }
    }
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

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);
}

Maybe the problem is the board

@marco199 can you try to update the firmware first? Here are the instructions https://support.arduino.cc/hc/en-us/articles/9670986058780-Update-the-connectivity-module-firmware-on-UNO-R4-WiFi

I've already tried to update the firmware.
To make it right I've tried to connect an Arduino Nano esp32 to the cloud and it works!