Esp8266 Serial Commands

  1. Arduino Esp8266 At Command
  2. Esp8266 Serial Commands List
  3. Esp8266 Serial Commands For Pc
Active1 year, 8 months ago

Mar 26, 2015  ESP8266 - AT Command Reference 26 Mar 2015 by fuho. ESP8266, in it’s default configuration, boots up into the serial modem mode. In this mode you can communicate with it using a set of AT commands.I will present to you a reference of all known AT commands that ESP8266 supports, explain what they do and how to use them. Learn to use your ESP8266 to connect to the internet and retrieve information from the web. In this tutorial I will teach you how to use the AT commands of your module, how to connect to a router. Sending simple serial commands to an Arduino is the easiest way to communicate between an Arduino and a computer. The computer could be a PC, a Raspberry Pi, or any device that communicates with serial. By sending and “decoding” a single character it is easy to add a simple debug menu or even serial menu. Now that we’ve connected the ESP8266 module to the Arduino, it’s time to send out special commands through the Arduino’s (software) serial port. This AT or Hayes commands are a set of commands not only used by the ESP8266 but also by other modems like GSM, Bluetooth and GPRS. The whole list of AT commands is overwhelming. Talking to ESP8266 via Arduino: upload program into Arduino board that sends commands to ESP8266 on behalf of us; I didn't notice the different programming methods at first, and follow whatever the first tutorial I found online that is workable, that is to program ESP8266 like Arduino. But later I found that I really need another serial port. ESP8266 is the new WIFI platform for Internet Of Things. This module is unbelievably cheap & powerful. ESP modules are available from ESP-1 to ESP12.The GPIO pin count varies according to type.In.

I am trying to send AT commands to ESP8266. I re-flashed ESP8266http://imgur.com/a/J8Ueh I followed this tutorial http://remotexy.com/en/help/esp8266-firmware-update/ and I hope it re-flashed successfully as there was no error.

When I uploaded this program http://www.pastebin.com/frhZY7tD I am trying to run AT command at 9600 baud rate on serial monitor then no response.

Below is how my circuit looks like

Trying to execute AT command -

On clicking on send button then it shows empty response like below -

When I unplug power wire and plug it back then it prints some garbled message on serial monitor. I checked voltage on RX also, it was around 3.5V that seems also OK.

I am facing this issue after I flashed WiFi firmware to ESP8266 then back AT firmware. It seems that AT firmware was not flashed successfully so I tried to erase everything using below command.

esptool.py --port /dev/ttyUSB0 erase_flash

Before execute above command, I made changes in my circuit like below :-

I have re-flashed ESP8266 on 115200 baud rate, and uploaded empty program then it started to respond AT commands. I connected as like above only change is TX to TX and RX to RX respectively. Alright!

Well, I want to send AT commands from the Arduino serial monitor window to ESP8266 and print ESP8266 response to the command. When I upload above program then it stops to respond, same result as like empty screen this is weird. Isn't ?

N Sharma
N SharmaN Sharma
2014 gold badges8 silver badges21 bronze badges

5 Answers

The ESP's AT firmware is probably configured for a higher baud rate, 115200 is typical. SoftwareSerial only works reliably up to 9600 baud. It can transmit 'reliably enough' at 115200 for you to blindly send change-baud commands, though the ESP's response will probably be garbled. So you need to either: Reduce the ESP's baud rate or use the Uno's hardware serial port for the ESP, which means giving up the Uno's terminal output and makes it a pain to reconnect your PC each time you need to update the Uno's code. I've described the process of changing the ESP's baud-rate in more detail in this answer.

Update: I'm not familiar with various AT comand-interpreter revs; my ESPs are all running with the firmware rev came on them; 'AT+GMR' (show version info) replies:


There is no AT+CIOBAUD command listed in my ESP8266 AT Instruction Set document rev 1.5.3). The only one listed that affects baud rate - and the one I use - is:

, or:

for 9600 baud, 8 bits, 1 stop-bit, no parity, no flow control. You probably know, but just in case, note that you will lose communication immediately after you change the ESP's baud rate, until you then change the local baud rate to match.

Update2:

This is program pastebin.com/dquCNYJj I am not sure what wrong I am doing

That code sets SoftwareSerial to 115200 baud; it can not run fast enough to receive data at that speed.

Update 3:

NevikstiUseless InformationSite scripting and design (2003-Present) byWelcome the ZSNES Home PageZSNES is a Super Nintendo emulator programmed by zsKnight and Demo.On April 2, 2001 the ZSNES project was GPL'ed and its source releasedto the public. hpsolo. Download zsnes. It currently runs on Windows, Linux, FreeBSD, and DOS.Remember that this is a public beta so don't expect this to run on yourmachine. Kreed.

Since you've updated the ESP's firmware unsuccessfully, it's hard or impossible to know what's going on. The output in your screenshot looks rather like the result of a baud mismatch between the ESP and your terminal. You need to get a clean firmware update to the ESP before you can expect it to respond correctly and rely on its output to diagnose any other problems.

Update 4:

I'm not sure if we're talking about the same thing so please forgive me if you already know this; we might be talking about (at least) three different baud-rates:

  1. The rate in use during flashing of new firmware to the ESP;
  2. The default rate that new firmware will start listening at, whenever it is booted;
  3. The actual rate used at any given time between the ESP with its new firmware and the Arduino or some other device external to the ESP.

My own experience is with using the factory-installed AT Interpreter firmware. I have never needed to update it so I don't have personal experience with (1).

(2) and (3) are programmable by the Arduino. When I first use a new ESP (or after you've just re-flashed its AT Interpreter), it will listen at a factory-default baud rate (mine have all defaulted to 115200). There are commands to change the current rate (not saved across a reboot) and/or the default baud (saved for all future sessions).

I almost always change its default rate to 9600 to use it with an Arduino software serial port. This is my initialization for a new device, using an Arduino to talk to the ESP. (Don't transmit my '#..' comments):

From now on, the ESP will wake up listening at 9600 baud, in Station Mode as a client, with no command echo.

JRobertJRobert
11.2k2 gold badges14 silver badges41 bronze badges

On your last picture, you should connect the Rx of your Arduino to the Tx of your ESP8266 and vice versa.

If you did that and it doesn't work, try to upload an example sketch in order to determine if it's the code or the connexions that are problematic. I recommend that you use the WiFiScan example, since that example doesn't require to change the code or to include other libraries othet than the ones from ESP8266Community.

D. LaRocqueD. LaRocque

Is it possible that this is a hardware connection issue? According to the datasheet of the ESP8266, it states that the maximum voltage input is 3.6V, but by connecting directly to the Arduino, the signal output by Arduino would be more than 3.6V. (Around 5V output)

Instead of connecting directly, you might want to perform Level shifting first? (5V to 3.3V, vice versa)

(Here's the link to the ESP8266 datasheet: https://nurdspace.nl/images/e/e0/ESP8266_Specifications_English.pdf)

PhotonPhoton

First of all, Please check if you are giving proper voltage and current both to ESP8266. I've seen it not working if it doesn't get proper voltage and current.

Secondly, Connect your Rx,Tx of ESP8266 to Rx,Tx of Arduino respectively. Then, try doing one thing, just upload empty sketch having empty setup() and loop() function only.

Then, open serial monitor select your baud rate (mostly either 9600 or 115200) and you are all done! Sending 'AT' via serial monitor input field will show you 'OK' in serial monitor response window.

Rahul RastogiRahul Rastogi
Thanh NguyenThanh Nguyen

Not the answer you're looking for? Browse other questions tagged arduino-unoserialesp8266softwareserial or ask your own question.

Demo

Here are the steps that I took to get my robot up and running with ESP8266

  1. Connect ESP8266-03 to FTDI or an Arduino to talk to it via Serial at 9600 Bud Rate using AT command
    Tip: Make sure you use good 3.3V power Source
  2. Making ESP8266 as an access point, send get request with Google Chrome
    Tip: Get IP with AT command
    Get request looks like this http://192.168.4.1/?s=100
    Keep it short
    Will not work in Safari if you don’t have the right HTML header
  3. Have ESP8266 connected to an WiFi router
    Note: This is slower than WiFi access point mode
  4. Blink LED then Add Servo
    Note: Software Serial will cause servo twitching, it’s best to just use hardware serial. Hardware serial in arduino code is Serial1.begin instead of Serial.begin() if you are using the arduino IDE
  5. Making a ESP8266 and A-Star / Arduino Leo combine board
    I used inDesign, overlay the lines right on top of the image
  6. Design a Web Interface to control the Robot
    I used Jquery library to do the get request and animation.
  7. Try TCP and UDP
    Pending …

Setup ESP8266 via serial with AT Command

Bud rate forESP8266-03 is 9600

Arduino Esp8266 At Command

You can use the Arduino IDE to motor the serial. You can use hardware serial or software serial. It might be easier to get started with FTDI, but I started with Software serial using Arduino’s Pin 10 and Pin 11.

Note: Use Serial1.begin()l if you are using Arduino LEO’s D1 & D0 as hardware serial. For everything else use Serial.begin()…

There are no spaces between the Command and the Parameters.

Source: https://nurdspace.nl/ESP8266#AT_Commands

CommandsDescriptionSet/ExecuteParameters
AT+RSTrestart the module
AT+CWMODEwifi modeAT+CWMODE=<mode>1= Sta, 2= AP, 3=both
AT+CWJAPjoin the APAT+ CWJAP =<ssid>,< pwd >ssid = ssid, pwd = wifi password
AT+CWLAPlist the APAT+CWLAP
AT+CWQAPquit the APAT+CWQAP
AT+ CWSAPset the parameters of APAT+ CWSAP= <ssid>,<pwd>,<chl>, <ecn>ssid, pwd, chl = channel, ecn = encryption
AT+ CIPSTATUSget the connection statusAT+ CIPSTATUS
AT+CIPSTARTset up TCP or UDP connection1)single connection (+CIPMUX=0) AT+CIPSTART= <type>,<addr>,<port>; 2) multiple connection (+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port>id = 0-4, type = TCP/UDP, addr = IP address, port= port
AT+CIPSENDsend data1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>
AT+CIPCLOSEclose TCP or UDP connectionAT+CIPCLOSE=<id> or AT+CIPCLOSE
AT+CIFSRGet IP addressAT+CIFSR
AT+ CIPMUXset mutiple connectionAT+ CIPMUX=<mode>0 for single connection 1 for mutiple connection
AT+ CIPSERVERset as serverAT+ CIPSERVER= <mode>[,<port> ]mode 0 to close server mode, mode 1 to open; port = port
+IPDreceived data

Running a WebServer

AT+CIPMUX=1
AT+CIPSERVER=1,80

From this step, I get the IP address for the chip and started to play with the URL get request
http://192.168.4.1/?p=34&s=1

Control LED

I based my sketch on the following URL
http://allaboutee.com/2015/01/02/esp8266-arduino-led-control-from-webpage/

Control Servo

I changed the code to control a servo by passing in servo position in the URL request.

The problem with Arduino Software Serial library is that the servo library uses the arduino’s Timer 1. The software serial library disables interrupts during transmit or receive operations which then prevent the timer interruts for the servo library triggering.

I had to change my board design to use Hardware Serial.

The Code

External Reference

Esp8266 Serial Commands List

http://allaboutee.com/2014/12/30/esp8266-and-arduino-webserver/

A-STAR / ARDUINO LEO’S Serial

There is now a second serial port. The primary port is built into the USB interface and the Tx/Rx LEDs are attached to it. The secondary port is located at pins D0 & D1. This port does not have any LEDs attached.
To use the primary serial port, use the class Serial as usual. For the secondary port, a new serial class called Serial1 has been created. You use it the same way as the Serial class.

Making A-Star ESP8266 Combo board

Since there aren’t any ESP8266 template for Eagle, I end up using inDesign to create my traces. It works much better than Eagle in my case.

Important: 3V on board power worked for me for a little while, but for some reason it stops working. It starts to draw a lot of power cause the board to “brown” out. I later added a voltage regulator and it seems to be working okay.

Board Files (inDesign + ESP)

In this New version, I added voltage regulator, the A-start internal 3V voltage regulator sometimes isn’t enough and cause the board to brown out.

Web Control Interface

Esp8266 Serial Commands For Pc

I wrote a quick and dirty web interface to control the robot. The idea is that eventually I can control all parts of the robot with Wifi. I am still not sure if I will be using ESP 8266 for my final project but some kind of wireless communication is required.