Hi,
I recently started using the Arduino Giga R1 WiFi. I attempted to connect it to my hidden WiFi network, but it's not working. But it is getting connected to open WiFi networks. Kindly inform me if you have any possible solutions.
This is the code I am trying
#include <SPI.h>
#include <WiFi.h>
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = "ssid"; // your network SSID (name)
char pass[] = "password"; // 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(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
// 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);
// wait 10 seconds for connection:
delay(10000);
}
// 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();
}
Hi @sadequl. Is the access point for the "hidden WiFi network" on the 2.4 GHz band? The GIGA R1 WiFi cannot connect to access points on the 5 GHz band.
Hi @ptillisch, yes it is on 2.4GHz band. Fun fact is my ESP8266 module is getting the wifi from the same hidden network and none of my two new giga's are getting it.
I gave it a try and I can verify the deficiency. I see that the library is intentionally configured to do this:
I found that I was able to connect the GIGA R1 WiFi board to the access point once I commented out those lines, however, they are surely there for a good reason so this might cause problems under other conditions. Unfortunately the reason is not clearly documented:
You can submit a feature request to the developers of the "WiFi" library of the GIGA R1 WiFi board for adding support for connecting to Wi-Fi access points that don't broadcast an SSID:
Until then, I suggest simply configuring your access point to broadcast the SSID. There really isn't any point in hiding the SSID since it can still be determined even when not broadcast. A high quality password is the correct way to secure the access point.
@ptillisch, thank you for your support, I truly appreciate it.
I am unable to access the AP configuration because it is intentionally hidden in my central network setup. I am making a request to the developer. I believe that if you could notify them as an insider, it might accelerate the solution.
I really don't think it is like that. A request from a user who actually needs a feature is a stronger argument for allocating the resources to implement it than a request from someone who has absolutely no use for the feature, even if that person happens to work for Arduino.
You will also be best able to defend the need for such a feature (as you have done here when I questioned it), and to provide any additional feedback that might be required by the developers.
--- a/libraries/WiFi/src/WiFi.h
+++ b/libraries/WiFi/src/WiFi.h
@@ -86,7 +86,7 @@ class WiFiClass : public MbedSocketClass {
* param passphrase: Passphrase. Valid characters in a passphrase
* must be between ASCII 32-126 (decimal).
*/
- int begin(const char* ssid, const char* passphrase);
+ int begin(const char* ssid, const char* passphrase, wl_enc_type security = ENC_TYPE_CCMP);
With the proposed change, the default behavior of automatically determining the encryption type for visible access points is retained. In the case of a hidden access point, the library defaults to WPA/WPA2 encryption. In case the access point in use is configured for a different encryption type, the user will need to pass the appropriate argument via the WiFi.begin call in their sketch.