UNO R4 WiFi wont connect to WiFI

Hello, I would really appreciate some help. I have an R4 UNO (genuine) WiFi. I have used the IOT cloud to set up the device, create a 'thing' and connected the device to the thing and then added just one variable. I then open the compiler, and run through the compilation and it finishes error free. At this point I went in and added my own code and re-compiled. However, when I tried to run it I got the error

Connection to "*******" failed
Retrying in "500" milliseconds

** my own network

This error cycles round and round.

I removed my own code and stripped it back the code that the IOT created for me

1- the INO file

/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled"
  https://create.arduino.cc/cloud/things/82c86c8a-a173-42b5-9e66-7adbd67b057d 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  bool dnSW;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here 
  
  
}


/*
  Since DnSW is READ_WRITE variable, onDnSWChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onDnSWChange()  {
  // Add your code here to act upon DnSW change
}

2- the Thing properties.h file

// Code generated by Arduino IoT Cloud, DO NOT EDIT.

#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>

const char DEVICE_LOGIN_NAME[]  = "db8e52b8-06d6-4ac2-b0c4-2090952d106b";

const char SSID[]               = SECRET_SSID;    // Network SSID (name)
const char PASS[]               = SECRET_OPTIONAL_PASS;    // Network password (use for WPA, or use as key for WEP)
const char DEVICE_KEY[]  = SECRET_DEVICE_KEY;    // Secret device password

void onDnSWChange();

bool dnSW;

void initProperties(){

  ArduinoCloud.setBoardId(DEVICE_LOGIN_NAME);
  ArduinoCloud.setSecretDeviceKey(DEVICE_KEY);
  ArduinoCloud.addProperty(dnSW, READWRITE, ON_CHANGE, onDnSWChange);

}

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

and 3 the secret tab, which I have checked endlessly and I am sure holds the correct SSID etc.

Having done this I still get the same error.

I have dual band router (5Ghz and 2.4 Ghz) and I have disabled the 5Ghz to leave just the 2.4Ghz working but that made no difference

One problem I cannot explain is that the board does not show up under the hardware properties window in windows. Its like it doesn't exist, but the IOT seems to recognise it just fine.

I also got an error saying that Windows was trying to install drivers in another window. When I looked it was and I clicked OK and the compiler just carried on. I am not sure whether this has anything to do with it, but it seemed a bit odd. BTW the firmware is the latest (0.3.0 I think it was)

Subsequently ran the WiFi scan which returned

Scanning available networks...
** Scan Networks **
number of available networks: 5

  1. Signal: -42 dBm Channel: 11 BSSID: MAC ADDRESS REDACTED
    Encryption: WPA2 SSID: NET1
  2. Signal: -46 dBm Channel: 11 BSSID: MAC ADDRESS REDACTED
    Encryption: WPA2 SSID: NET2
  3. Signal: -46 dBm Channel: 11 BSSID: MAC ADDRESS REDACTED
    Encryption: None SSID: NET3
  4. Signal: -51 dBm Channel: 12 BSSID: MAC ADDRESS REDACTED
    Encryption: WPA2 SSID: NET4
  5. Signal: -77 dBm Channel: 11 BSSID: MAC ADDRESS REDACTED

So, a question for anyone that can help, please why is it not connecting?

1 Like

Check Use UNO R4 WiFi with Arduino IoT Cloud [ Update the connectivity module firmware on UNO R4 WiFi] and follow Getting Started With the Arduino IoT Cloud
correctly.

Hi Dozie, thanks very much for your time in looking at my problem. I have done everything you suggest, the firmware is the latest and it is a genuine board. I have it recognised by IOT and have a Thing associated with it as per the instructions. It just won't connect to the WiFi when I run the Sketch.

If you have any other suggestions please get back to me.

Okay, contact Arduino support team via Contact us
with the details of the issue, what you have tried and include your purchase receipt.

A post was merged into an existing topic: Does not connect to WiFi when country changes