ESP8266 + Arduino IDE > wifi connection problem

Hi all,

I got an Adafruit Huzzah ESP8266 breakout board this week and I'm trying to connect it to my wifi.
Since I's like to stick to the Arduino IDE, I thought I'd post my problem here.

I got it connected, I can program sketches into it and I can get a list of available networks. I just can not get it connected to my own wifi. I got a cafe across the street with on open wifi network (no password), I can connect to that without problems.

I used this code from Using Arduino IDE | Adafruit HUZZAH ESP8266 breakout | Adafruit Learning System

/*
 *  Simple HTTP get webclient test
 */

#include <ESP8266WiFi.h>

const char* ssid     = "Cafe SSID";
const char* password = "";

const char* host = "www.adafruit.com";

void setup() {
  Serial.begin(115200);
  delay(100);

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

int value = 0;

void loop() {
  delay(5000);
  ++value;

  Serial.print("connecting to ");
  Serial.println(host);
  
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }
  
  // We now create a URI for the request
  String url = "/testwifi/index.html";
  Serial.print("Requesting URL: ");
  Serial.println(url);
  
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  delay(500);
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  
  Serial.println();
  Serial.println("closing connection");
}

I have a hunch that my router setting might be the issue.

My setup:

  • Router: WRT54-GL
  • Running: Tomato Firmware 1.28.0005 124 ND SD-VPN

When I use my own SSID in the code above it just stays in this loop:

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

Is there any way of further diagnosing the problem using the Arduino IDE ?

Thanks !

Jeeezzz, all I had to change was "Wireless Network Mode" to "Auto"