ESP8266 is an UART to WiFi module, a really cheap and easy way to connect any small microcontroller platform (for example Arduino) wirelessly to Internet.
The ESP8266 is now one of the leading platforms for the Internet of Things. It’s super cheap, and super easy to work with.
This is a serial module with a built-in TCP/IP stack, so you can use it standalone
You can use AT commands to connect with WiFi networks and open TCP connections without need to have TCP/IP stack running in your own microcontroller: You can simply connect any microcontroller to ESP module and start pushing data up to internet.
There are several module designs called ESP-x where x is 1 to 12, so far.
I am 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.
ESP8266 is 3.3v device & cannot tolerate 5v levels.
Make sure you pullup the CH_DP and the RST line. I used 3k3 resistor to pull up RST to +Vcc.
CH_PD is directly connected to +3.3v .Unless you connect CH_PD to Vcc , you won’t get any response from the module. The firmware boots up only on this connection.
So far it seems you can leave the GPIOs floating. For upgrading the firmware , however , the GPIO0 must be grounded.
The current consumption of the module is 80mA at idle state & it can draw as much as 300mA during operation.
- Vcc: 3.3V, up to 300 mA
- 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???
I used a USB to TTL converter for connectivity between PC & WIFI module.The converter has 3.3v output which is used to power the WiFi module. It has also a +5v supply out.
Care has to be taken with power supply as the unit is to be powered at 3.3V and using 5V will probably kill it.
For ease of connections I’ve used a Breadboard.The connection details are as below :
WIFI Module USB-TTL
Vcc — 3.3v
Gnd — Gnd
Tx — Rx
Rx — Tx
CH_PD — connected to 3.3v to enable chip firmware boot.
RST — connected to 3.3v through 3k3 resistor
CH_PD pin acts as an enable signal, without it the board is mute and deaf. If CH_PD is not pulled HIGH , you won’t get any response from the module.
Once you connect this last pin to VCC (remember 3.3V) the module is brought to life, and after some garbage in the serial port you can read the word “ready”. Once you get there things will start to get interesting.
The USB-TTL converter I used required a driver “Prolific 2303” to be installed.After installing the driver , I got the port allotment under device manager while the converter is connected to a USB port of PC.
A serial Terminal software PuTty is used to communicate with the port where USB-TTL converter is connected.
Open PuTty & select Serial .Feed in the port number seen under Device manager (here it’s COM41) & speed as 9600 (Baud Rate).
Click on OPEN button to see the Terminal black window.
Try to type in AT .If you do not get any response , just momentarily connect the RST pin of module with GND.
You get some garbage data initially & then the address of the vendor “www.ai-thinker.com”
followed by the firmware version & then “ready”
Now type in AT .The module will respond with OK. If not ,close the Putty window & again open it & proceed with above steps.
AT+GMR will return the current firmware version.
Generally , you can inquire the module with AT command followed by question mark ?
or you can assign a value , by using equal to = , after the AT command.
All AT commands must end with a “\r\n” – a carriage return & a New Line.
For detailed list of AT commands visit :
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 (Yes, ESP8266 has a dual mode!)
But the magic starts once you try AT+CWLAP command, that will provide you a list of available wifi access points in the area.
The command AT+CWLAP will list access points in range. This was very encouraging, not only is my access point (MBLAZE..) on the list, but the ESP can see at least as many access points as my laptop can .
The APs are listed as +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
In the above screen shot you can see my AP “MBLAZE..” is WPA2_PSK (3) password protected.You can see some other APs which are open & not protected with password .They are listed with ecn 0.
Next you want the board to join a certain access point (most of us want the board to act as a STA or WIFI client that will connect to an access point). That behavior is selected with the AT+CWMODE=1. You will need to reset your board after making this selection.
To connect to your home/office access point you issue the command AT+CWJAP=”yourSSID”,”yourWifiPassword”
The good news is that from now, every time you power the board it will try to connect to the same wifi network. You can see if it was successful by checking your router’s DHCP client list.
Even if the power is removed , the ESP module will remember the joined AP .
You can make it forget by issuing the QUIT command AT+CWQAP
Alternatively you can check your module IP address with command AT+CIFSR. Once you know your board’s IP address you can try pinging it from your computer.
In the upcoming posts we shall investigate the module in TCP client and server modes.
For availability of these modules contact :