When I upload the sample ScanNetworks sketch, the blue Data light come on and stays on, but I don't get any output on my console. Hitting the Reset causes Data to go off and Link to come on for a second or two, and then Data comes back on and stays on. Still no Console output. The code for ScanNetworks is
/*
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);
}
String fv = WiFi.firmwareVersion();
if ( fv != "1.1.0" )
Serial.println("Please upgrade the firmware");
// 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;
}
}
I tried checking my firmware on the WiFi shield with this code, but all I get is the attached image on the Console and the Data light staying constantly on.
I retried the update for the firmware. As far as I can tell, it succeeded. I see no major differences in my outcome vs what another user uploaded as a successful outcome for their update. I have attached a screenshot of my successful update.
Immediately after my update, I removed the jumper and tried this code.
#include <WiFi.h>
#include <SPI.h>
void setup() {
Serial.begin(9600);
// disable SD SPI
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// check firmware version
Serial.print(F("Firmware version: "));
Serial.println(WiFi.firmwareVersion());
}
void loop() {
}
I got "Firmware version: 1.1.0" on my console. I am guessing that my firmware number is the problem? I then tried the ScanNetworks code again and my console sat there blank for about a minute before i pressed reset on my WiFi shield. I let it sit for another minute and still got nothing. No lights on the WiFi shield either.
/*
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);
}
String fv = WiFi.firmwareVersion();
if ( fv != "1.1.0" )
Serial.println("Please upgrade the firmware");
// 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;
}
}
I retried the Firmware Check code again, and got a blank console with that code too. It seems that every time I supposedly update my firmware, I can run 1 sketch, and then it craps out.
Firmware version 1.1.0 is the newest version, so your upgrade was successful.
Why it craps out after one sketch I can't explain. I don't have that trouble with the one I am testing. My only guess is power. How are you powering it? USB or power jack?
edit: Is the Arduino you are using a R3 model? The WiFi shield is designed to connect to an R3 Arduino, and if the Arduino isn't a R3, there are two pins on each side that overhang (don't plug into the connector socket). Is that the case with your setup?
I tried a different USB port. It got me further, but still not working properly. I was able to upload a couple sketches, but when I uploaded the sketch to connect to a WPA network, It attempts twice, and then seems to stop. Console outputs stop coming.
I have ordered a 9V wall charger that has a 1A output, so hopefully that solves my problem.
I do know that the 9V battery does work to power the Arduino. I have used it before to power the Arduino and a 5V motor. I agree that it probably doesn't have the juice to power an Arduino and WiFi shield, but I know for sure it does power the Arduino.
After a full day of fighting with this same problem, I saw this post, or at least read it well, plugged the board to a 12V AC charger, and voilà! It works!
I had problems with uploading the firmware too, but when that part seemed like it was uploading well, I was left without any answer, or "not present", I started to dig deeper into these forums.
I'd use an extra power source for the actual upgrade too, as the L9 led was blinking or just off, when connected to the USB . Apparently a modern PC USB 3.0 port (nor 2.0) aren't generous enough for the WiFi shield.
Well, it is good to hear that you found a solution to our problem. I should be getting my 9V supplies tomorrow, so hopefully that solves my problem. What is the current rating on your 12V?
EDIT: My 9V supply seems to have solved my problem. I am guessing it just wasn't getting enough current to power both the Arduino and WiFi shield. Thank you to all who helped!