I'm trying to connect to Wifi using a sparkfun ESP8266 Wifi Shield and it just won't connect. I confirmed the name of my router and the password.
If there is a better/more user friendly Wifi I'm all ears. My goal is to just have it call a website with some data that it acquires (passed in the querystring).
I'm just trying to use the included "ping test" example app and a few things I should note: When first uploading it, it rarely works after. I usually have to power cycle it and if I don't the chipset on the sparkfun board gets really hot. After power cycling it appears to start working but it can never connect to my wifi. I attempted to connect to my cell phone as a hot-spot and that didn't work either.
Here's the part of the code that it's stuck on:
I just get "trying to connect.trying.trying.trying.trying.trying.trying.trying.trying..."
void setup()
{
Serial.begin(9600);
Serial.print("Starting ");
while (esp8266.begin() != true)
{
Serial.print("Error connecting to ESP8266.");
delay(1000);
}
Serial.print("Ready ");
if (esp8266.status() <= 0)
{
Serial.print("trying to connect.");
while (esp8266.connect(mySSID, myPSK) < 0)
{
Serial.print("trying.");
delay(1000);
}
Serial.print("Success!");
}
delay(1000);
Serial.print("Pinging ");
Serial.println(destServer);
}
The ESP8266 WiFi Shield has à Toggle to select the serial lines you will use ( which route the RX and TX signals take either to the hardware serial port (on pins 0 and 1), or a software serial port on pins 8 and 9). The active port is selected by the on-board switch and switch’s positions are labeled “SW” and “HW” for “software” and “hardware"
In your code you are using the standard begin() call which means you instruct the library to use software serial. Can you make sure the slider is on the software side?
If it is on the HW side the doc states
Watch out! When you're programming your Arduino (assuming it's an ATmeg328P-based 'duino), make sure the UART select switch is slid over towards the "SW" position. If it's set to "HW", all of those bits and bytes being programmed into the Arduino will also be sent over towards the ESP8266 — there's a chance the spurious data might put the ESP8266 into an unknown (though recoverable) state.
So you might have (limited chances though) messed up the ESP config and would need to reset it.
ALso they recommend
Unfortunately, the ESP8266 WiFi Shield’s printed PCB antenna can potentially run into interference problems with Arduino ISP headers. After seating the shield on your Arduino, you may want to slightly nudge the shield up, to avoid bumping the board against the 2x3 ISP header.
The header can interfere with the Shield’s WiFi signal, and lead to lower-than-expected signal sensitivity. If your shield is having trouble connecting to a network, make sure there’s some clearance here.
Ugg - thank you for the visuals. I never would've believed it but spacing the boards solved my problem. I guess I need to jumper it or find a little external antenna - thank you so much.
poor design to have the antenna just above those pins...
A nicer solution - making your stack look bigger (but not slanted which is easy to press down by mistake) is to add a new set of male/female headers on top of the existing one on your arduino.
Find some with not super long legs so that the plastic part is flush with the arduino headers (or cut part of the pins to adjust the fit but still get a good grip/connection)
Alternatively you can unsolder the isp 6 pin connectors from your arduino - don't damage your board) and replace with a 90 degree 2 rows one (or not replace it at all, Not used that often there anyway)