You can use one of the following things to connect ESP8266 with a breadboard:
- Using female/male extension jumper wires (https://www.adafruit.com/product/1954)
- Using a 10-pin IDC breakout helper (https://www.adafruit.com/product/2102)
The ESP8266 works only with regulated 3.3V. You can build a simple regulated power supply with an LD1117-3.3 linear voltage regulator. It can provide 3.3V at 800 mA. You can purchase a TO-220 package of the LD1117-3.3 for use with a breadboard. Figure 1.5 shows the circuit diagram for 3.3V output. You can supply 4-15V DC to Vin using one of the following sources:
- 7V LiPo battery
- 5V power bank
- 9V battery
- 5V "wall wart" power supply
Figure 1.5: 3.3V regulated power supply circuit diagram
Now, you can connect the power supply to ESP-01:
- Connect Vout to the Vcc pin of ESP-01.
- Connect GND to the GND pin of ESP-01.
ESP8266 ESP-01 doesn't have a built-in USB to serial conversion chip to directly connect to your computer through a USB cable for flashing programs. As a solution, you can use a USB to TTL serial console cable to connect ESP8266 to a computer. Figure 1.6 shows a USB TTL serial console cable from Adafruit (https://www.adafruit.com/product/954):
Figure 1.6: A USB to TTL serial console cable. Image courtesy of Adafruit Industries (https://www.adafruit.com)
The type A USB plug includes a USB to serial conversion chip and provides four wires to connect to your ESP8266ESP-01 board. Table 1.1 shows the functions of the four wires:
Color | Function |
Red | Power |
Black | Ground |
White | RX |
Green | TX |
Table 1.1: Color codes and functions of wires
You can use the following steps to connect the USB to TTL serial cable with your ESP8266:
- Connect the white RX wire of the cable to the TX pin of ESP8266
- Connect the green TX wire of the cable to the RX pin of ESP8266
- Connect the black ground wire of the cable to the GND pin of ESP8266
- Connect the CH_PD pin of ESP8266 to the Vcc wire of the power supply
The following steps will guide you how to use a serial terminal program to communicate and execute AT commands with ESP-01. In this example, you will use PuTTY, SSH, and a Telnet client for Windows to run AT commands through a serial port:
- First, download the latest PuTTY MSI installer or binary from the following sources:
- MSI (Windows installer):
- 32-bit:
putty-0.70-installer.msi
(https://the.earth.li/~sgtatham/putty/latest/w32/putty-0.70-installer.msi) - 64-bit:
putty-64bit-0.70-installer.msi
(https://the.earth.li/~sgtatham/putty/latest/w64/putty-64bit-0.70-installer.msi)
- 32-bit:
- Binary:
- 32-bit:
putty.exe
(https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe) - 64-bit:
putty.exe
(https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe)
- 32-bit:
- MSI (Windows installer):
- Open the
PuTTY Configuration
window by double clicking onputty.exe
or the putty shortcut. - In the
Serial line
text box, type the COM port that is assigned to your ESP8266 board (Figure 1.7). - In the
Speed
text box, type115200
as the baud rate.
- Click on the
Open
button to make a serial connection:
Figure 1.7: The PuTTY configuration window
- If you have provided the correct settings, the serial connection will establish between ESP8266 and your computer.
- You can use the serial terminal window to issue AT commands for ESP8266 from your computer.
Table 1.2 shows the complete set of AT commands that you can use with ESP8266:
AT command | Manual |
| Attention. |
| Resetting the unit. |
| Retrieving the firmware version ID. |
| Setting operation mode:
The access point functionality does not have a DHCP function and has only minimum functionalities. However, it will assign an IP address to the client and there is no way to do a manual IP, manual DNS, and other advanced IP functionalities. This unit only provides minimal functionalities. |
| Joining a network or just an access point. |
| Retrieving the list of the visible network. |
| Disconnecting from the current network connection. |
| Setting up access point SSID, password, RF channel, and security scheme. The following is the security scheme:
|
| Retrieving a list of assigned IP addresses. |
| Retrieving the current connection as socket client or socket server. |
| Connecting to socket server (TCP or UDP). |
| Sending by connection channel and by specific length. |
| Closing the socket connection. |
| Retrieving the assigned IP address when the unit is connecting to a network. |
| Setting a single connection ( |
| Starting at the specified port or stopping the server. The default port is
|
| Setting transparent mode (data from the socket client will be sent to the serial port as is) or connection channel specific mode ( Data sent from the socket client will be broken into multiple unsolicited (
|
| Setting the automatic socket client disconnection timeout from |
Packetized data from the unit | Unsolicited data packet ( |
Table 1.2: The ESP8266 AT command set (Source: SparkFun Electronics)
Every AT command starts with the letters AT
. Here's an example:
AT+GMR <CR>
Type the AT command AT+GMR
and press the Enter key. Don't type <CR>
. The CR indicates carriage return.
This will return the firmware version ID of the ESP8266 module, as shown in Figure 1.8:
Figure 1.8: Terminal output for the AT+GMR command
Likewise, you can run any AT command with the PuTTY terminal to execute on ESP8266 through the serial connection.