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 :
http://room-15.github.io/blog/2015/03/26/esp8266-at-command-reference/
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: ecn
,ssid
,rssi
,mac
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 :
I am using the ESP for the first time. Does it need to be uploaded with any firmware before doing the above process. Because when i tried your method, there appeared nothing on putty and i couldn’t even type any commands on it. Am using Windows 10.
Depends on which model you use.If its a raw ESP 01 or ESP12E , it can be controlled using AT commands.But you should be careful with the connections , like , CH_PD ,RST to be pulled high through resistor 2k.Firmware can be upgraded by connecting GPIO0 to GND You can follow my old posts under ESP8266 tag of the blog.
If you use NodeMCU board , by default it can be programmed with LUA script .Or you can install Arduino core & program with Arduino IDE
https://alselectro.wordpress.com/2017/10/21/nodemcu-getting-started-with-arduino-core-1-gpio-pins-network-access/
Try Teraterm or Bray’s Terminal instead of Putty. Putty under Windows gave me problems with the ESP-01S (see below).
The problem with Putty under Windows seems to be the CRLF. Even setting Putty to ‘Implicit LF in every CR’ or vice-versa, or leaving it off, gave no response. What worked was Teraterm (set to CR+LF on transmit) or Bray’s terminal (set CR=CR+LF in transmit window).
I have esp8266-01 , I want to turn on gpio 2 by at commands , the at commands for doing so are
AT+SYSIOSETCFG=2,3,1
where 2 is supposed to be gpio 2 , 3 is working mode and 1 is pull up disable/enable
it gives error on this commands but when I put 12 instead of 2 it work
so the problem is I want to know how to address to gpio 2 in at commands for turning on gpio 2 on
GPIO2 on ESP8266-01 module also known as ESP-01 module, must be pulled HIGH for the module to work.
Hello sir,
I have done the same connections as shown above in the tutorial. At first when I opened putty, after setting baud rate and respective port number, I wasn’t able to write anything with keyboard. After searching for a while I found a solution to this problem by activating Local echo as “ON” under terminal window of Putty. Now I’m able to write AT command but not getting any response. I tried connecting RST pin of ESP8266 to GND momentarily and it shows some garbage value. I tried restarting the module and checked the connection twice. Please list the possible reason and help me with the same.
Thanks!
the garbage you are receiving is actually the boot mode it shows upon resettings , trying using arduino ide serial monitor and reset the esp by connecting rst to gnd momentarily having your serial monitor on different baud rates 115200 , 74xxx repeating the reset process for every baud rate
I have had problems with Putty under Windows. Local echo does not indicate that the command is getting to the ESP8266. After reset, the ESP8266 defaults to Echo on, so if you do not see the characters as you type them, and if you don’t see ‘ready’ after the garbage values on reset, then most likely the data rate is wrong. 115,200 b/s worked for me. The problem with Putty under Windows seems to be the CRLF. Even setting Putty to ‘Implicit LF in every CR’ or vice-versa, or leaving it off, gave no response. What worked was Teraterm (set to CR+LF on transmit) or Bray’s terminal (set CR=CR+LF in transmit window).
According to https://www.esp8266.com/viewtopic.php?p=43498#p43498 , the Implicit LF with every CR and Implicit CR with every LF is for *incoming* not *outgoing*. What you can do if you want to continue to use Putty is to do CTRL+J.
MY ESP IS NOT GOING ON FLASH MODE &NOT UPDATING FIRMWARE
HOW I CAN CHANGE THE FLASHING MODE AND UPDATE THE FIRM WARE
I’m not able to get anything back from the module? I’m using putty with the same connectio but no luck
The problem with Putty under Windows seems to be the CRLF. Even setting Putty to ‘Implicit LF in every CR’ or vice-versa, or leaving it off, gave no response. What worked was Teraterm (set to CR+LF on transmit) or Bray’s terminal (set CR=CR+LF in transmit window).
The setting in Putty about ‘Implicit LF in every CR’ is for receiving.
For sending, you need to hit Enter key then Ctrl+J
https://z49x2vmq.github.io/2017/11/12/putty-cr-lf-en/
.
Hello everyone, how get the mac of client, when my esp8266 is a station and server i want know the mac of client 0 at commands AT please
If running in SoftAP or SoftAP + station mode, AT+CWLIF
In order to set static IP Address into ESP8266 you have to send it the following AT Command:
AT+CIPSTA=“ip module”,“ip gateway”,“subnet mask”
e.g.: AT+CIPSTA=“192.168.1.160”,“192.168.1.1”,“255.255.255.0”
How do you add CR LN automatically to command in PuTTY ? I am using CTRL+M and CTRL J, but it is boring ….
am stuck at sending a get request to my server at+cipsend returns no tail error , i have tried googling but to nothing i hope you can help