Andrew Cross
  1. The ESP8266 can act as an access point, network device, or both.
  2. PuTTY requires CR+LF when ending an AT command.

If you’ve been following along with the series, you’ve completed Part 1 and connected to your ESP8266 (with either an Arduino or USB-to-serial converter) to your computer.

At this point, it’s important to understand that when we connected to the ESP8266 and received the ‘ready’ serial response back from the chip as it booted up, that ‘ready’ response was a routine programmed into the ESP8266’s stock firmware. We’ll discuss the firmware implications in greater detail during the next post, but until then keep in mind that the rest of this post pertains to the stock firmware only. If you flash the firmware with your own brewed up code to make an LED flash, the AT commands that we’re about to discuss will mean nothing to the ESP8266.

AT Commands

Finally! It’s time to actually interact with the ESP8266. When I say interact, I mean send the ESP8266 an instruction, and have it respond accordingly. This is accomplished through the use of AT commands. What are those, you ask? AT commands are essentially instructions used to control modems. Here’s a reference guide for a cellular module that shows something like 300 commands, but the number of AT commands recognized by the ESP8266 is limited to about 30 function (+/- a couple depending on the firmware version). Just keep in mind that they’re the same commands. The big-picture takeaway here is that the ESP8266 is a wireless device, and it “speaks the same language” as gps modules and phones’ GSM modems.

Let’s try out some commands! First, let’s figure out exactly what firmware version we’re dealing with. To do that, we’ll use the following command:


For Arduino IDE Users

Sending a serial AT command to check the firmware version

  1. Enter the AT command on the input line.
  2. Hit Enter on the keyboard, or click the Send button.
  3. The command will be displayed in the terminal window, followed by the ESP8266’s response!

For PuTTY Users

ESP8266 sending a serial AT command to check the firmware version with PuTTY

  1. Enter the AT command on the input line, then hit Enter. This sends a special CR (carriage return) character to the ESP8266.
  2. The command you just typed will show up below the initial line (depending on your PuTTY settings), and nothing will seem to happen! This is because the ESP8266 expects to see two special characters (CR+LF) before it acknowledges the AT command! The Arduino serial monitor does this by default, but PuTTY cannot be set up to accomplish this automatically. The LF (line feed) character can be sent by hitting ctrl+J+Enter.
  3. The ESP8266’s response will be displayed.

AT version: 5 2015 16:27:16)
SDK version:1.1.1
Ai-Thinker Technology Co. Ltd.
Jun 23 2015 23:23:50

There’s a very good chance your firmware version will differ from mine, but don’t worry about that now. The core set of commands won’t change from firmware version to version, so the next couple of steps will still be applicable.

Setting the ESP8266’s WiFi Mode

‘Mode’ is quite vague here, but as a WiFi device, the ESP8266 can operate in a couple of different ways: either as an access point (AP), a network device (client), or both. Without going into the networking details, as an access point, the ESP8266 acts something like a wireless router and can be connected to by network devices. As a network device, the ESP8266 can connect to an existing wireless network. When operating in both modes, the ESP8266 can act like a network repeater.

By default, the ESP8266’s stock firmware is set to AP mode. If you’d like to confirm that this is the case, send the following command:

You should get this response: +CWMODE:2, where 2 corresponds to AP mode as seen in the table below.

Checking the network mode of the device

Number Network Mode
1 Network Device (client)
2 Access Point (AP)
3 Both

Since we’re attempting to connect the ESP8266 to an existing network, we’ll need to change ESP8266 to network device mode with the following command:


List the Wifi Networks in Range

Now that the ESP8266 is acting as a network device, it can scan the airwaves for WiFi signals in range. To do that, send:


AT+CWLAP command to list access points in range of device

The ESP8266 will return a list of all the access points in range, with each line item consisting of the security level of the access point, the network name, the signal strength, MAC address, and wireless channel. As far as the security level goes, the table below can be used for reference.

Number Security Mode
0 Open

Connecting to a Wireless Network

If you knew me, and I hadn’t obscurred the MAC address, it still wouldn’t be tough to choose my wireless network out of the list. It’s RockChalk, for obvious reasons. As you can see from the security mode designation of 4, this wireless network is password protected. This is important, as the password will need to be included in the AT command, along with the network’s name (SSID). Be sure to include the quotation marks (string indicators)!


Connected to a wireless network with CJWAP command

If you’ve done everything correctly, after a few seconds you’ll get responses back from ESP8266:



That second line WIFI GOT IP means that it’s been assigned an IP address, so let’s check and see exactly what that address is.


Checking the IP address assigned to the device

Cool! Everything looks good! Everyone’s router interface is going to be different, but here’s a screenshot of my router’s device list as it pertains to the ESP8266. You’ll notice that the IP and MAC addresses match!

Router device list shows ESP8266 connected

As of right now, the firmware that I have installed on the ESP8266 unfortunately doesn’t allow you do set the name of the device as it will appear on the network – the name would typically go where the blank box to the right of the IP address is shown, above. Mark my words, though, that feature will be available on future firmware releases.

List of AT Commands

As I alluded to earlier, there are plenty more AT commands than the ones we used here to connect to a WiFi network. These sorts of lists are all over the internet, and lots of them are nowhere close to complete. Instead of making my own list here, and adding to the ESP8266 confusion that’s out there, I’ll link to the actual source that no one ever seems to cite!

Profile picture of Andrew standing at the Southern-most point in the United States.
Andrew Cross

Andrew is currently a mechanical R&D engineer for a medical imaging company. He enjoys good food, motivated people, and road biking. He has still not completely come to terms with the fact he will never play center field for the Kansas City Royals.