Pages: [1]   Go Down
Author Topic: Arduino WiFi Shield not present  (Read 1958 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

I'm using the official WiFi shield on top of Uno R3 and I'm trying the examples provided in the WiFi library. First I tried the scan networks example but unfortunately the serial says that the "WiFi shield not present" also I noticed that all the LEDs on the WiFi shield are OFF and the L9 LED blinks once when I initially connect the UNO using the USB cable and then it goes OFF.

Here's the code:
Code:
/*
 
 This example  prints the Wifi shield's MAC address, and
 scans for available Wifi networks using the Wifi shield.
 Every ten seconds, it scans again. It doesn't actually
 connect to any network, so no encryption scheme is specified.
 
 Circuit:
 * WiFi shield attached
 
 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 21 Junn 2012
 by Tom Igoe and Jaymes Dec
 */


#include <SPI.h>
#include <WiFi.h>

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while(true);
  }

  // Print WiFi MAC address:
  printMacAddress();

  // scan for existing networks:
  Serial.println("Scanning available networks...");
  listNetworks();
}

void loop() {
  delay(10000);
  // scan for existing networks:
  Serial.println("Scanning available networks...");
  listNetworks();
}

void printMacAddress() {
  // the MAC address of your Wifi shield
  byte mac[6];                    

  // print your MAC address:
  WiFi.macAddress(mac);
  Serial.print("MAC: ");
  Serial.print(mac[5],HEX);
  Serial.print(":");
  Serial.print(mac[4],HEX);
  Serial.print(":");
  Serial.print(mac[3],HEX);
  Serial.print(":");
  Serial.print(mac[2],HEX);
  Serial.print(":");
  Serial.print(mac[1],HEX);
  Serial.print(":");
  Serial.println(mac[0],HEX);
}

void listNetworks() {
  // scan for nearby networks:
  Serial.println("** Scan 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.print(" dBm");
    Serial.print("\tEncryption: ");
    printEncryptionType(WiFi.encryptionType(thisNet));
  }
}

void printEncryptionType(int thisType) {
  // read the encryption type and print out the name:
  switch (thisType) {
  case ENC_TYPE_WEP:
    Serial.println("WEP");
    break;
  case ENC_TYPE_TKIP:
    Serial.println("WPA");
    break;
  case ENC_TYPE_CCMP:
    Serial.println("WPA2");
    break;
  case ENC_TYPE_NONE:
    Serial.println("None");
    break;
  case ENC_TYPE_AUTO:
    Serial.println("Auto");
    break;
  }
}



Would anyone please tell me how to solve such a problem? and is there anything missing in the code that I should add?

Regards
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Guys, anyone who can help?  smiley-cry
Logged

Asnieres sur Seine - France
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the WiFi shield as well. I can say that it's normal that all the LEDs are off on the WiFi shield. The L9 LED blinks once when initially powering on. But, after that, everything stays off.

None of the WiFi LEDs come on in the SSID scan example. Try using one of the actual connection examples, depending on your connection type (WEP, WPA, ...). In those examples the Link LED will turn green upon connection or the Error LED will turn red. This will at least allow you to see if you've got a software (code) problem or a hardware (shield or shield connection) problem.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well, the problem is not with the LEDs, the main problem is that the shield fails to establish a successful connection. I don't know if this is SPI connection problem or not! I tried several examples and all of them are compiled successfully but at the end the same message appear when I open the serial!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well, the problem is not with the LEDs, the main problem is that the shield fails to establish a successful connection. I don't know if this is SPI connection problem or not! I tried several examples and all of them are compiled successfully but at the end the same message appear when I open the serial!

I think the main problem is a startup race condition that WiFi shield is not ready after reset. Instead of the if() try the while() loop in the thread.

Nevertheless as discussed in the other thread there are major bug which should be fixed.

See:
http://arduino.cc/forum/index.php/topic,139871.0.html

wiesl
Logged

Asnieres sur Seine - France
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

well, the problem is not with the LEDs, the main problem is that the shield fails to establish a successful connection. I don't know if this is SPI connection problem or not! I tried several examples and all of them are compiled successfully but at the end the same message appear when I open the serial!

Which is the problem? In your first message you say that the LEDs aren't coming on and you're trying the list networks functions. That's normal as the LEDs don't light up during that function. Are you now saying that the LEDs come on but you're not getting a connection?

Does only the Error LED light up red? Do you never get a Link LED light up green?

I found with my WiFi connection I often needed to try more than once rather than the whole sketch dying after one try. I therefore modified the code:
Code:
int status = WL_IDLE_STATUS;     // WiFi radio's status
int iAttempt = 0;                // Attempt counter

void setup() {
  // Setup serial monitor
  Serial.begin(9600);
  // Wait 3 seconds
  delay(3000);
  // Some declaring text
  Serial.println("\nWiFi Shield - WPA Connection Testing");
}

void loop() {
 
  while (status != WL_CONNECTED) {
     // Attempt to connect to WPA network:
      Serial.print("Attempting to connect to WPA network: ");
      Serial.print(SSID);
      Serial.print("\tAttempt: ");
      iAttempt++;
      Serial.println(iAttempt);
      status = WiFi.begin(SSID, WiFiPass);
 
      if (status != WL_CONNECTED) {
        Serial.println("Couldn't establish WiFi connection");
        // Wait 3 seconds before trying again
        delay(3000);
      }
     
      // if connected :
      else {
          Serial.println("WiFi connection established\n");
          PrintWiFiData();
      }
      Serial.println();
  }
 
  // Check and display the network connection once every 10 seconds:
  delay(10000);
  PrintCurrentNet();
}


I am very verbose in my serial output while testing as it allows me to see where I am in the Arduino and in my code. You can cut out a lot of that smiley-wink
You also don't have to keep track of how many attempts it took. I just like to do that...

After running this let us know precisely where the problem is: which LEDs light up or don't, which error messages display...

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

may be this link can help you..
http://electronics.stackexchange.com/questions/68440/how-to-resolve-this-arduino-uno-not-working-with-arduino-wifi-shield
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you powered up the Arduino Board with from USB cable, try the external power supply(9V).  smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had  a same problem just now.
UNO ok  "Attempting to connect ...."
DUE like board (self made) ok "Attempting to ..."

but.  DUE  didn't  "WiFi shield not present".
...
then  pushed the reset button on the DUE.
It got started.  "Attempting to connect ..."

I think there might be a something RESET factor?
Logged

Pages: [1]   Go Up
Jump to: