step 1: connect module as the following picture


step 2 : Programe the seeeduino board.

  1. Open Arduino IDE and create a new sketch
  2. Parse the following code into the sketch editor (need modifying the SSID and PASS macros into your own situation);
  1. #include <SoftwareSerial.h>
  1. #define SSID "xxxxxxxx"
  1. #define PASS "xxxxxxxx"
  1. #define DST_IP "220.181.111.85"//baidu.com
  1. SoftwareSerial dbgSerial(10, 11); // RX, TX
  1. void setup()
  1. {
  1. // Open serial communications and wait for port to open:
  1. Serial.begin(57600);
  1. Serial.setTimeout(5000);
  1. dbgSerial.begin(9600);//can't be faster than 19200 for softserial
  1. dbgSerial.println("ESP8266 Demo");
  1. //test if the module is ready
  1. Serial.println("AT+RST");
  1. delay(1000);
  1. if(Serial.find("ready"))
  1. {
  1. dbgSerial.println("Module is ready");
  1. }
  1. else
  1. {
  1. dbgSerial.println("Module have no response.");
  1. while(1);
  1. }
  1. delay(1000);
  1. //connect to the wifi
  1. boolean connected=false;
  1. for(int i=0;i<5;i++)
  1. {
  1. if(connectWiFi())
  1. {
  1. connected = true;
  1. break;
  1. }
  1. }
  1. if (!connected){while(1);}
  1. delay(5000);
  1. //print the ip addr
  1. /*Serial.println("AT+CIFSR");
  1. dbgSerial.println("ip address:");
  1. while (Serial.available())
  1. dbgSerial.write(Serial.read());*/
  1. //set the single connection mode
  1. Serial.println("AT+CIPMUX=0");
  1. }
  1. void loop()
  1. {
  1. String cmd = "AT+CIPSTART=\"TCP\",\"";
  1. cmd += DST_IP;
  1. cmd += "\",80";
  1. Serial.println(cmd);
  1. dbgSerial.println(cmd);
  1. if(Serial.find("Error")) return;
  1. cmd = "GET / HTTP/1.0\r\n\r\n";
  1. Serial.print("AT+CIPSEND=");
  1. Serial.println(cmd.length());
  1. if(Serial.find(">"))
  1. {
  1. dbgSerial.print(">");
  1. }else
  1. {
  1. Serial.println("AT+CIPCLOSE");
  1. dbgSerial.println("connect timeout");
  1. delay(1000);
  1. return;
  1. }
  1. Serial.print(cmd);
  1. delay(2000);
  1. //Serial.find("+IPD");
  1. while (Serial.available())
  1. {
  1. char c = Serial.read();
  1. dbgSerial.write(c);
  1. if(c=='\r') dbgSerial.print('\n');
  1. }
  1. dbgSerial.println("====");
  1. delay(1000);
  1. }
  1. boolean connectWiFi()
  1. {
  1. Serial.println("AT+CWMODE=1");
  1. String cmd="AT+CWJAP=\"";
  1. cmd+=SSID;
  1. cmd+="\",\"";
  1. cmd+=PASS;
  1. cmd+="\"";
  1. dbgSerial.println(cmd);
  1. Serial.println(cmd);
  1. delay(2000);
  1. if(Serial.find("OK"))
  1. {
  1. dbgSerial.println("OK, Connected to WiFi.");
  1. return true;
  1. }else
  1. {
  1. dbgSerial.println("Can not connect to the WiFi.");
  1. return false;
  1. }

step 3 : Open Serial Monitor

Open Serial Monitor and press the reset button of seeeduino board, you’ll see the output.

At last, Happy Hacking! :)