So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By RSN33
#65188 Dears ,

I am totally new to ARDUINO , and just created few simple projects leds & temperatures sensors staff :)

Now I need to create my first IoT project which need to connect to Internet and post simple data e.g. temperatures ...

So I get ESP8266-01 and read about it , and successfully Implement the empty project and starting AT commands :)

Now I want to create my own program which using ESP8266-01 , below code for connect to ESP8266-01 and send AT command ::

Code: Select all#include <SoftwareSerial.h>
SoftwareSerial esp8266(0,1); // RX, TX
void setup() {
    // put your setup code here, to run once:
    esp8266.begin(9600);
    Serial.begin(115200);
}

void loop() {
    esp8266.write("AT\r\n");
    String buffer;
    Serial.print("SENDING AT...");

    Serial.println("******************** Buffer ****************");
    Serial.println(esp8266.available());
    Serial.println("**************************** END *************");

    delay(3000);
}


but no luck ! it is always printing 0 as esp8266.available() which mean no data available as response to AT command !!!

please your support to help me to communicate with ESP8266 and use it to connect to my wifi AP .

Regards
User avatar
By Ocsav
#65200 I assume you're connecting to the ESP via an arduino.
I never used soft serial on an arduino, but I guess that you can't use pins 0 and 1 as they are the rx and tx pins of the hardware serial (note that I might be wrong here), but you might try other pins, like D12 and D13, that looks more "normal" to me.

But you'd better post the schematics of your project. Take note that the ESP-01 runs at 3.3v, make sure you're not feeding it 5 V from your arduino (it might be too late).

I tried a few AT commands with ESP modules via putty in the serial port but decided to change programming it directly from the Arduino IDE.
User avatar
By martinayotte
#65203 You are printing the number of characters received with esp8266.available() just a microsecond after sending your AT.
Don't expect that response come instantaneously, you have to either put a delay before trying to read the response, or even better, do a loop with timeout checking until the buffer been filled.