ESP8266 (esp-01) is an UART (UNIVERSAL ASYNCHRONOUS RECEIVER-TRANSMITTER) to WiFi module and it is now one of the leading platforms for the Internet of Things (IoT).
This is a serial module with a built-in TCP/IP stack and can use standalone
We can use AT commands to connect with WiFi networks and open TCP connections without need to have TCP/IP stack running in our own micro-controller. Simply connect any micro-controller to ESP module and start pushing data up to internet. There are several module designs called ESP-1 to 12..
Here we are using the ESP-1 module. The new firmware is set at 9600 baud. provides the same 2×4 connector, TX,RX , RST, CH_DP(CHIP ENABLE), AND TWO GPIOS, GPIO0 AND GPIO2 and ESP8266 is 3.3v device.
- Vcc: 3.3V, up to 3A
- GND: Ground
- Tx: UART Tx of the module, to be connected to the Rx of the microcontroller
- Rx: UART Rx of the module, to be connected to the Tx of the microcontroller
- RST: Reset/Restart, pull to GND to restart
- CH_PD: Chip enable, used for flash boot .
- GPIO0: pulled low for update mode
- GPIO2: not sure yet???
In this tutorial we are using both Arduino UNO and USB to TTL converter for connectivity between PC & WIFI module for your understanding. First we will show you the connectivity by using USB to TTL converter.
Make sure to set power supply 3.3v as the unit is to be powered at 3.3V by using jumper of the TTL converter and using 5V will probably damaged it.
As you can see below (A) and (B) schematics are mentioning the connectivity with ESP8266-1 and USB to TTL converter.
- (A) is using 3.3V through the TTL converter and
- (B) is using 3.3v from a direct supply.
The USB-TTL converter we used required a driver “Prolific 2303” to be installed. After installing the driver (Windows 10, auto detected), we got the port allotment under Device Manager while the converter is connected to a USB port of PC.
(C) and (D) schematics are mentioning the connectivity with ESP8266-1 and Arduino UNO. You can see in both schematics, reset pin has been connected to GND as we need bypass micro-controller of Arduino UNO.
- (C) is using 3.3V through the Arduino UNO and
- (D) is using 3.3v from a direct supply.
And in the below (E) schematics is mentioning the connectivity with ESP8266-1 and Arduino UNO without micro-controller as we need bypass micro-controller of Arduino UNO.
Arduino IDE is used to communicate with the port where USB-TTL converter or Arduino board is connected. As we know basically in the Arduino IDE select the correct port which is connected to Arduino or TTL converter into the computer. Then open Serial Monitor to start AT commands for communicate with ESP8266.
Type AT in field and press the Enter key. If you do not get any response , just momentarily connect the RST pin of ESP-01 with GND. You get some data with symbols initially & then the address of the vendor www.ai-thinker.com followed by the firmware version & then “ready” or “OK”.
AT will give the start for communication in serial monitor
AT+GMR will return the current firmware version.
AT+CIOBAUD? will return the Baud Rate the module is working with.
AT+CWMODE? returns the Mode of operation of the module.
CWMODE returns an integer designating the mode of operation either 1, 2, or 3.
- 1 = Station mode (client)
- 2 = AP mode (host)
- 3 = AP + Station mode (ESP8266 has a dual mode!)
AT+CWLAP command, that will provide you a list of available Wi-Fi access points in the area and it will list access points in range.
The APs are listed as AT+CWLAP:
The Parameter are
ECN: 0 OPEN , 1 WEP , 2 WPA_PSK , 3 WPA2_PSK , 4 WPA_WPA2_PSK
SSID: string, SSID of Access Point
RSSI: signal strength
MAC: string, MAC address
AT+CWJAP – To connect to your home/office access point you issue the command AT+CWJAP=”yourSSID”,”yourWifiPassword”
AT+CWQAP – You can make it forget by issuing the QUIT command
AT+CIFSR – Alternatively you can check your module IP address with this command. Once you know your board’s IP address you can try pinging it from your computer.