Go Down

Topic: ESP8266 (Read 102627 times) previous topic - next topic

Erni

If you use LUA, you could make a simple webserver like this:

http://ernstc.dk/arduino/esp8266.html

Code: [Select]
if(t==nil) then
  t=12
end
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
    conn:on("receive",function(conn,payload) print(payload)
    conn:send("HTTP/1.1 200 OK\n\n")
    conn:send("<html><body>")
    conn:send("<h1>Erni's ESP8266</h1><BR>")
    conn:send("TEMP : " .. t .. "<BR>")
    conn:send("NODE.HEAP : " .. node.heap() .. "<BR>")
    conn:send("TMR.NOW : " .. tmr.now() .. "<BR>")
    conn:send("</html></body>")
    conn:on("sent",function(conn) conn:close() end)
  end)
end)

sapan

Hello Team,

I am having Issue while connecting ESP8266 with Arduino Mega. It always says "Module have no response."

Please check and correct me if I am wrong anywhere.

 I am using below code and and wiring diagram is on this URL: http://3.bp.blogspot.com/-u7cLC4-x72c/VVGGVWfPmrI/AAAAAAAAci0/RYynhrWZQ38/s1600/wiringDiagram.png



//#include <SoftwareSerial.h>
   //use mega Serial 2 for serial monitor; Serial 1 on pins 19 (RX) and 18 (TX);// Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX).
   #define SSID "SopraSteria"
   #define PASS "1234567890"
   #define DST_IP "220.181.111.85" //baidu.com
   //SoftwareSerial dbgSerial(10, 11); // RX, TX
   void setup()
   {
     // Open serial communications and wait for port to open:
     //serial 2 is to esp8266
     Serial2.begin(115200);//9600 (mine), 57600, 115200
     Serial2.setTimeout(2000);
   
     //serial 0 is to usb
     Serial.begin(115200);
     
         
     while(!Serial);
     while(!Serial2);
     
     //dbgSerial.begin(9600); //can't be faster than 19200 for softserial
     //dbgSerial.println("ESP8266 Demo");
     Serial.println("ESP8266 Demo on Mega2560");
   
    while(Serial2.available()>0)
    Serial2.read();
     
     delay(1000);
       //test if the module is ready
     Serial2.println("AT+RST");
     //delay(1000);
     //delay(1000);
     Serial.println("Resetting module");
     Serial2.flush();
     
     //if(Serial2.find("ready"))
     if(Serial2.find("Ready")||Serial2.find("ready"))
     {
       //dbgSerial.println("Module is ready");
       Serial.println("Module is ready");
     }
     else
     {
       //dbgSerial.println("Module have no response.");
       Serial.println("Module have no response.");
       //while(1);
     }
     delay(1000);
     //connect to the wifi
     boolean connected=false;
     for(int i=0;i<5;i++)
     {
       if(connectWiFi())
       {
         connected = true;
         break;
       }
     }
     if (!connected){
      //while(1);
      Serial.println("Not Connected.");
     }
     delay(1000);
     //print the ip addr
     
   Serial2.println("AT+CIFSR");
     Serial.println("ip address:");
     while (Serial2.available())
     Serial.write(Serial2.read());
   
   
     //set the single connection mode
     Serial2.println("AT+CIPMUX=0");
   }
   void loop()
   {
    connectWiFi();
     String cmd = "AT+CIPSTART=\"TCP\",\"";
     cmd += DST_IP;
     cmd += "\",80";
     Serial2.println(cmd);
     Serial.println(cmd);
     Serial.println(cmd);
     if(Serial2.find("Error")) return;
     cmd = "GET / HTTP/1.0\r\n\r\n";
     Serial2.print("AT+CIPSEND=");
     Serial2.println(cmd.length());
     if(Serial2.find(">"))
     {
       //dbgSerial.print(">");
       Serial.print(">");
       }else
       {
         Serial2.println("AT+CIPCLOSE");
         //dbgSerial.println("connect timeout");
         Serial.println("connect timeout");
         delay(1000);
         return;
       }
       Serial2.print(cmd);
       delay(2000);
       //Serial.find("+IPD");
       while (Serial2.available())
       {
         char c = Serial2.read();
         //dbgSerial.write(c);
         Serial.write(c);
         //if(c=='\r') dbgSerial.print('\n');
         if(c=='\r') Serial.print('\n');
       }
       //dbgSerial.println("====");
       Serial.println("====");
       delay(1000);
     }
     boolean connectWiFi()
     {
       Serial2.println("AT+CWMODE=1");
       String cmd="AT+CWJAP=\"";
       cmd+=SSID;
       cmd+="\",\"";
       cmd+=PASS;
       cmd+="\"";
       //dbgSerial.println(cmd);
       Serial2.println(cmd);
       Serial.println(cmd);
       delay(2000);
       if(Serial2.find("OK"))
       {
         //dbgSerial.println("OK, Connected to WiFi.");
         Serial.println("OK, Connected to WiFi.");
         return true;
         }else
         {
           //dbgSerial.println("Can not connect to the WiFi.");
           Serial.println("Can not connect to the WiFi.");
           return false;
         }
       }

jtheires

rogerClark,
Would you mind sharing how your AP mode ESP8266 works? I see in post #75 in this discussion that you are doing something close to what I want to do...
Have a local network (AP mode?) established by the ESP, which then serves a web page.
Thanks,
James

cyberteen

Hi guys,
I have this ESP8266-12 Test board, like the one in this link: http://blog.squix.ch/2015/01/esp8266-test-board-review.html
I have been playing it for the past one week. All long, i was using the firmware 0.9.2.2 using ESP_flasher tool.
I wanted to upgrade to the latest one, found in the expressif github page: https://github.com/espressif/ESP8266_AT/tree/master/bin
But while downloading the third file: esp_init_data_default.bin, at the address ,0x7C000, I got a floating point division error.
Still i continued to flash the last file, blank.bin on address 0x7E000. After that I've been encountering this weird problem:
I am powering the module with 3 AA batteries, which has about 3.4V now.  But when i power the esp8266, the voltage shows 2.9v and is constantly decreasing, ultimately the power leds keep on dimming until the board gets fully switched off.
If I take out one battery for about 5 mins, and put it back, it again glows brightly slowly losing voltage until it again shuts down.
While it is powered up, I am still able to flash firmwares to it, but i get only garbage at some random baud rates.
I dont know what to do now. All my connections are correct, and I could very well use the ESP. I dont know whats causing the problem now.!
Please help me out.

cyberteen

Replaced the board with a fresh set of batteries. Its working good now!
Since this happened right after flashing the new firmware, I got freaked out! Maybe I should switch to rechargeable AA batteries or use a 5V DC adapter and regulate it to 3.3 V.

twim

#95
Dec 11, 2015, 11:14 pm Last Edit: Dec 11, 2015, 11:24 pm by twim
Hi all,
I'm worked the last few night for an ambitious project. Build a cheap WiFi shield for the Arduino boards using the ESP8266 module.
I want to use the standard ESP firmware and I have a programming model similar to the Ethernet/WiFi libraries so I can reuse existing code.



Here are some links:


Let me know if you find it useful or if you have problems making it.

rrwiyatn

Hi guys,

I just bought an ESP8266-01. I hooked it up with my UNO but it does not work. I've spent hours try to fix it, but still can't make it work. Here's how I hook it up:

1) Vin from UNO --> 3.3V regulator --> ESP8266 VCC
2) UNO Rx --> ESP8266 Rx (i tried Rx to tx still doesnt work)
3) UNO Tx --> ESP8266 Tx
4) ESP8266 CHPD --> VCC (3.3V)

I flashed in an empty sketch to my UNO (bare min). When I opened the serial terminal from Arduino IDE, it seems that it doesnt detect anything. I've already tried it with different baud rate and tried both "Carriage Return" and "Both NL&CR". Whenever I send "AT" it won't respond back.

Also, when I power the UNO, the blue light on the ESP8266 is constantly on. I saw some tutorials on youtube and it seems that it should only blink once after being powered. Anyone know what it means if the blue light is constantly on?

Thank you!

R

uanas1989

you can test iot based project(Home automation,Relay controll) using the app  https://play.google.com/store/apps/details?id=info.example.infosolution.arduinoespwificontroller&hl=en

alvinjaison

How to Send data from esp8266 to localhost server using arduino mega

TBBB

I want to use ESP8266 like bluetooth.In this way i want to provide data exchange  between arduino and android phone .I dont found  sample program.Can i help me :) thanks a lot.

AthulPavithran

I am using ESP8266 module.Any one know how set the module with a static IP ?. Is it possible or not?
Looking for replay....

AthulPavithran

Does ESP8266 module able to set with static IP while connecting to network?

Clemens

Have a look at this thread with an code example at the end:
http://www.esp8266.com/viewtopic.php?f=6&t=3522

ester

Please use voltage divider because esp8266 use 3.3V and you transmite from arduino 5V.
If you use adator in one line with the bulb, when the bulb on, the adaptor voltage rise more then 5V.
It can burn your esp8266.
It happend to me when I try using remote switch that use adaptor the same line with the bulb. The capasitor exploded.
So use separate line between  adaptor and bulb, and use voltage divider.

Mjolinor


I think I killed my ESP12.

I have been messing with it for a few weeks and have added servos, a DHT11 and an OLED. All was going well. I wanted to update a web page with the temperature and humidity so went looking through the examples for one that sounded like it would update without reloading the whole page.

I opened WebUpdater.ino, that sounded hopeful and I stuck it on the ESP. I got two buttons so I clicked them and one popped up a load file box which I duly selected any old file from.

One dead ESP later. Seems a bit daft to me to include examples with no warning or indication of what they do. Of course it's easy with hindsight to go and Google the thing and see what it is but this isn't normally something one would do when browsing examples provided for using and learning.

Anyhow, the problem is there, is there a solution other than replacing the ESP?

Go Up