ESP8266 – cheap Wifi/Serial module !

I recently purchased a few of those ESP 8266 modules !
They are really small, only needs a few pins to connect to an MCU, and are also very cheap.(about 2,30 euro a piece !)

I have lots of ideas for my IOT (Internet-of-things) projects, so I first needed a “proof-of-concept” … Finding info is not so easy,
you can find bits and pieces everywhere on the internet, but not a full, small, “howto” …
(with Arduino, but the idea for other MCU’s is the same) … So here we go …

This is the top-view of the module.
– Connect GND to GND of your Arduino
– Connect VCC to 3.3V of your Arduino
– Connect CH_PD to 3.3V of your Arduino
– Connect VTXD to RX of your Arduino
– Connect VRXD to TX of your Arduino

Depending on where you bought the module, it comes with a different firmware. Some firmwares are set to 9600 baud, but the majority of the modules, are set for 115200 baud.(don’t, worry, you can change it !) Next, upload the “blink” example sketch to your Arduino (comes with the Arduino IDE), so you will be sure that the Arduino is not using the RX/TX pins. Next, make a connection with your favorite terminal program. (or use the Arduino built-in Serial monitor) send AT to the board. The module should respond with OK. If you see garbage, or nothing at all, you probably need to change your baud rate.

When this step is done, you can already send data to the module. Try to send AT+GMR to your module, it should respond with its version number. Next, you can manually try to connect your ESP module to your WIFI. (Make sure your wifi router supports DHCP !)

AT+CWQAP Disconnects any existing wifi
AT+CWMODE=1 Switch to station mode (so you can connect to an AP)
Connects to your wifi. (replace YOUR_SSID and YOUR_SSID_PASSWORD)
AT+CIFSR This should return the IP that the ESP-module got. You should be able to ping it from your PC.

Download SocketTest from
This is a java-app and will run on windows/mac osx/linux etc …
Run it, and on the “Server” TAB, enter your computer IP, and set port to 6666.
Next, click the “Start Listening” button.

This only works with a recent firmware. (download it at the end of this tutorial)
If your firmware does not support this command, you need to keep using the DHCP IP,
assigned by your router.
AT+CIPMUX=0 (last character is the number zero, not a letter O)
After this command, you should get a “linked” message in your terminal program,
and the SocketTest should give you a “New Client:” message in the listbox, with the IP address of your ESP module. Instead of an IP, you can also use a domain name. If you want to connect to google for example, you can use:
AT+CIPSTART=”TCP”,””,80 (80 is the default http-port of webservers)
AT+CIPMODE=1 Sets TCP connection in “pass-trough” mode.
AT+CIPSEND Puts ESP module in transmit mode

Whatever you type in your terminal program after this commands, will be transmitted to your TCP Socket listener. Whatever you type as a message in the SocketTest application, will appear on the serial pin of the ESP module.

The Default firmware is constantly evolving. Previous versions of the firmware only support DHCP, no fixed IPs. Since Espressif released a new firmware on november 28th – 2014, there is the possibility to give the module a fixed IP, and even change it’s MAC-address. You can always find the latest firmware files in the “Download” section of the Espressif BBS on
While downloading the latest ZIP-file, I noticed several bin-files. (boot/user1/default/blank etc …) For your convenience, I combined all these bin-files, into one large bin-file. (508 kilobytes) So you can simply upload them to your ESP module with the “simple flashloader”. (make sure you connect pin GPIO0 to GND, and recycle power on your ESP module)
After uploading this new firmware, please check the included PDF with available commands.

ATTENTION ! I could not find any information about changing the baud rate of the ESP modules ! I’m going to use Arduino Mini in combination with this ESP modules, and 115200 baud is a “bit” to high for those Mini Arduino’s to be reliable …
(There is a firmwar
e floating on the internet with a +CIOBAUD=xxx command, but thats an old firmware !) Back in the days, there was a AT-command I remembered from those “old” analog modems AT+IPR=19200 (where you can replace the 19200 with the baud rate you want) This AT-command actually works on the ESP modules !
So, after upgrading the firmware, disconnect GPIO0 from GND, recycle power of your ESP module, and reconnect at 115200 baud with your terminal program. Send the AT+IPR=xxx command to your ESP module, and switch to that baud rate after sending this command. Even after re-powering your ESP module, this baud rate is kept !

Download here my ESP8266 zip-file
This file includes:
– An Arduino sketch, to automate connecting to a WIFI network, setup a fixed IP and connect to a TCP server.
– the 508K bin-file firmware of 28-11-2014.
– The Easy FlashUtility (windows EXE-file)
– PDF with AT-commands specifications

This entry was posted in Blog, Electronics, Tutorials. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *