So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By alainb
#61978 I try to connect an ESP8266 to the WIFI (Arduino IDE) -- but the ESP remains in the loop trying and trying and reporting 'Attempting to connect...'

The red LED is on and the blue blinks from time to time - I assume when it sends the message 'Attempting...'
I checked
-- ssid and password are correct
-- channel of the modem is on 'Auto'
-- 'Disallow Low Rate' is disabled

What could be the problem besides a defective ESP?

(An Arduino Yun performs perfectly in the same network.)

Many thanks for Help!!!

The code:

#include <ESP8266WiFi.h>

const char* ssid = "my_ssid";
const char* password = "my_password";
int status = WL_IDLE_STATUS; // the Wifi status

int ledPin = 2; // GPIO2 of ESP8266
WiFiServer server(80);//Service Port

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

pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);

// Connect to WiFi network
Serial.println();
Serial.println();
//Serial.print("Connecting to ");
//Serial.println(ssid);

WiFi.begin(ssid, password);
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, password);
// wait 10 seconds for connection:
delay(10000);
}
User avatar
By g6ejd
#62046 Yes the ESP takes a (relatively) lot of power on Wi-Fi connect, a good power source is essential. I can get the same problem with certain microUSB cables, so I have to select / test my cables, some have too much resistance to work with the ESP but work fine with other boards. High resistance means high voltage drop when the connection current pulse occurs, seems to create an endless connection failure. Your code looks OK.
User avatar
By alainb
#64657 I have the same problem -- the ESP8266 remains in the loop 'while (status != WL_CONNECTED)...'
The power is regulated from 12V to 3.3V by a LM1117T which should deliver up to 800mA -- I tried 2 different ESP8266 without success -- other devices like smartphone or arduino Yun have no problem at all -- I know just about nothing in electronics -- what could it be??? Many thanks for help !!!