I'm trying to make a weather station. I bought the esp-05 version of the 8266 wifi module. And I cant get it to connect to the internet. I'm not sure if the module works or not.
How can I check if it connected correct and working?
Can I borrow a piece of code that is confirmed to get the module out on the internet?
Ok.. i have tried to find a way to confirm if the module is installed correct or not.
I have no idea if its even alive or dead.
I have tried this code among many.
*------------------------------------------------------------------------
Simple ESP8266 test. Requires SoftwareSerial and an ESP8266 that's been
flashed with recent 'AT' firmware operating at 9600 baud. Only tested
w/Adafruit-programmed modules: https://www.adafruit.com/product/2282
The ESP8266 is a 3.3V device. Safe operation with 5V devices (most
Arduino boards) requires a logic-level shifter for TX and RX signals.
------------------------------------------------------------------------*/
#include <Adafruit_ESP8266.h>
#include <SoftwareSerial.h>
#define ARD_RX_ESP_TX 19
#define ARD_TX_ESP_RX 18
#define ESP_RST 4
SoftwareSerial softser(ARD_RX_ESP_TX, ARD_TX_ESP_RX); // Arduino RX = ESP TX, Arduino TX = ESP RX
// Must declare output stream before Adafruit_ESP8266 constructor; can be
// a SoftwareSerial stream, or Serial/Serial1/etc. for UART.
Adafruit_ESP8266 wifi(&softser, &Serial, ESP_RST);
// Must call begin() on the stream(s) before using Adafruit_ESP8266 object.
#define ESP_SSID "my ssid" // Your network name here
#define ESP_PASS "My-password" // Your network password here
#define HOST "wifitest.adafruit.com" // Host to contact
#define PAGE "/testwifi/index.html" // Web page to request
#define PORT 80 // 80 = HTTP default port
#define LED_PIN 13
void setup() {
char buffer[50];
// Flash LED on power-up
pinMode(LED_PIN, OUTPUT);
for(uint8_t i=0; i<3; i++) {
digitalWrite(LED_PIN, HIGH); delay(50);
digitalWrite(LED_PIN, LOW); delay(100);
}
// This might work with other firmware versions (no guarantees)
// by providing a string to ID the tail end of the boot message:
// comment/replace this if you are using something other than v 0.9.2.4!
wifi.setBootMarker(F("Version:0.9.2.4]\r\n\r\nready"));
softser.begin(9600); // Soft serial connection to ESP8266
Serial.begin(57600); while(!Serial); // UART serial debug
Serial.println(F("Adafruit ESP8266 Demo"));
// Test if module is ready
Serial.print(F("Hard reset..."));
if(!wifi.hardReset()) {
Serial.println(F("no response from module."));
for(;;);
}
Serial.println(F("OK."));
Serial.print(F("Soft reset..."));
if(!wifi.softReset()) {
Serial.println(F("no response from module."));
for(;;);
}
Serial.println(F("OK."));
Serial.print(F("Checking firmware version..."));
wifi.println(F("AT+GMR"));
if(wifi.readLine(buffer, sizeof(buffer))) {
Serial.println(buffer);
wifi.find(); // Discard the 'OK' that follows
} else {
Serial.println(F("error"));
}
Serial.print(F("Connecting to WiFi..."));
if(wifi.connectToAP(F(ESP_SSID), F(ESP_PASS))) {
// IP addr check isn't part of library yet, but
// we can manually request and place in a string.
Serial.print(F("OK\nChecking IP addr..."));
wifi.println(F("AT+CIFSR"));
if(wifi.readLine(buffer, sizeof(buffer))) {
Serial.println(buffer);
wifi.find(); // Discard the 'OK' that follows
Serial.print(F("Connecting to host..."));
if(wifi.connectTCP(F(HOST), PORT)) {
Serial.print(F("OK\nRequesting page..."));
if(wifi.requestURL(F(PAGE))) {
Serial.println("OK\nSearching for string...");
// Search for a phrase in the open stream.
// Must be a flash-resident string (F()).
if(wifi.find(F("working"), true)) {
Serial.println(F("found!"));
} else {
Serial.println(F("not found."));
}
} else { // URL request failed
Serial.println(F("error"));
}
wifi.closeTCP();
} else { // TCP connect failed
Serial.println(F("D'oh!"));
}
} else { // IP addr check failed
Serial.println(F("error"));
}
wifi.closeAP();
} else { // WiFi connection failed
Serial.println(F("FAIL"));
}
}
void loop() {
}
"
I get this in my serial monitor
" Adafruit ESP8266 Demo
Hi
I have seen your page .. I have connected just as you
my monitor is not quite like yours i get a lot of squares when I clear the monitor, when i place the cursor in the field for writing messages, and when I start the program/reset the arduino board.
I can print text tho so i can read the messages i presume
When I write AT only the long line of sqaures come up and same with the others... I dont get an OK
have a read of how-to-get-the-best-out-of-this-forum
in particular avoid images of text screen output - it wastes space, difficult to read one cannot copy code for testing - copy and upload the text
can you post a link to the actual board you have?
upload a schematic showing how you have wired up the module