Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By xtal
#31016 I have little knowledge of the Ardunino....but did noticed you are not using what appears to be the standard Rx, Tx pins, Are you sure this is programmed correctly?

Will the Arudunio communicate directly to another comm port on your pc?
Does your Ardunino Tx go thru level converter to ESP Rx.?
Does your Ardunino Rx go thru level converter to ESP Tx.?
Have you tried 9600 & 115200 baud although you should see garbage?

The level looks similiar to sparkfun and appears connected corectly. Hv side to Ardunio Lv to ESP

Is the ESP-?? wired correctly? [ie] proper pins pulled up and grounded. I think there are mainly 3 pins involved
usually gpio15-> gnd[thru 510 ohm works], CH_PD/EN thru 3.3k ohm to V+, gpio0 usually uses internal pullup
you ground this to download new FW, I usually use V+ --> red LED-->820 ohm --> gpio0
820.gpio0 connection --> switch--> gnd
When sw off + Reset Led is off Sw on Led on bright, hit reset Led Dim load FW mode

I prefer to connect thru 470-560 ohm resistors or higher ohms on V+ side to protect ESP pins
in case of an OOPS.

Lastly are the batterys good?
User avatar
By array81
#31028
xtal wrote:I have little knowledge of the Ardunino....but did noticed you are not using what appears to be the standard Rx, Tx pins, Are you sure this is programmed correctly?

Will the Arudunio communicate directly to another comm port on your pc?
Does your Ardunino Tx go thru level converter to ESP Rx.?
Does your Ardunino Rx go thru level converter to ESP Tx.?
Have you tried 9600 & 115200 baud although you should see garbage?

The level looks similiar to sparkfun and appears connected corectly. Hv side to Ardunio Lv to ESP

Is the ESP-?? wired correctly? [ie] proper pins pulled up and grounded. I think there are mainly 3 pins involved
usually gpio15-> gnd[thru 510 ohm works], CH_PD/EN thru 3.3k ohm to V+, gpio0 usually uses internal pullup
you ground this to download new FW, I usually use V+ --> red LED-->820 ohm --> gpio0
820.gpio0 connection --> switch--> gnd
When sw off + Reset Led is off Sw on Led on bright, hit reset Led Dim load FW mode

I prefer to connect thru 470-560 ohm resistors or higher ohms on V+ side to protect ESP pins
in case of an OOPS.

Lastly are the batterys good?

Thanks for your reply.
1. I don't use pin 0 and 1 but pin 6 and 7 and a SoftwareSerial on code. This is right.
2. I have tested ESP8266 with ESPLorer and it works with 9600 baud, I also load on it a new firmware about this.
3. The battery are new and ESP8266 red led is ok.
4. About RX and TX, these are the connections:
ESP8266 RX <- RXO (logical converter) <- RXI (logical converter) <- PIN 7 (arduino - TX pin)
ESP8266 TX -> TXI (logical converter) -> TXO (logical converter) -> PIN 6 (arduino - RX pin)
5. Real connections are the same of image. The image is based on they.
6. ESP8266 wire:
RX pin ESP8266 -> RXO (LV - logical converter)
TX pin ESP8266 -> TXI (LV - logical converter)
VCC and CH_PD pins ESP8266 -> power battery (the same of LV - logical converter)
GND pin ESP8266 -> GND battery (the same of LV - logical converter)
7. Arduino is connect to my compoter and I get the debug message on serial monitor.
8. I use this firmware, and I have tested it with ESPlorer, it works very well with AT commands.
9. In this moment I'm using TEE_ESP_WIFI library (but I have try many libraries with the same result).
10. I don't have understand the rest of your message, sorry.

Last thing: the blue led of ESP8266 is solid, always ON. This is strange.

This is the aurduino code:
Code: Select all#include<TEE_ESP_WIFI.h>
#include <SoftwareSerial.h>

#define ESP_Rx 6
#define ESP_Tx 7

String ssid="MYSSID";
String pass="MYPASSWORD";

String port="80";

ESP wifi(ESP_Rx,ESP_Tx,pinEN);

void print_debug(String data)
{
  Serial.print(data);
}
void setup()
{
  Serial.begin(9600);
  wifi.begin(9600);
  Serial.println("EPS8226");
  wifi.Event_debug = print_debug;
  wifi.reset();
  wifi.setmode(STATION);
  wifi.disconnectAP();
  wifi.connectAP(ssid,pass);
  wifi.multipleconnect(MULTIPLE);
  wifi.startserver(port);
  String ip = wifi.myip();
 for(unsigned char i=0;i<5;i++)
 {
    wifi.stop(i); //close all socket
 }
}
void loop()

   String data = wifi.readstringdata();
   if(data.length())
   {
     Serial.println(data);

        html_web();
        wifi.stop(wifi.currentID);
   }
 }
 
void html_web()
{
  delay(3000);
  char *data1= "<html><header><title>ESP8266 Webserver</title></header>\"LED Control\"<FORM action=\"\"><P> <INPUT type=\"radio\" name=\"status\" value=\"1\">ON";
  char *data2= "<P> <INPUT type=\"radio\" name=\"status\" value=\"0\">OFF<P> <INPUT type=\"submit\" value=\"Submit\"></FORM><body></body></html>";
  wifi.write_HTML(wifi.currentID,data1);
  wifi.write_HTML(wifi.currentID,data2);
}