Using the ESP8266 Module

This Instructable will teach you how to use those $5.00 ESP8266 modules, as well as provide you some basic knowledge about networking. I'll be using the Micromite Companion Kit in my examples which is programmed in BASIC, however all of these instructions should be adaptable easily to your favorite micro.

In short, the ESP8266 module is a TTL "Serial to Wireless Internet" device. Providing your microcontroller has the ability to talk to a TTL serial device (most do) you'll be in business! The original instructions have been translated from Chinese into cryptic data sheets. We'll try to change that with this Instructable.

The ESP8266 module is a 3v device, but it's no wimp. It draws quite a bit of power. In fact, you'll probably need to make sure that your circuit's power supply can handle at least 1 amp of power. (In my case, I was using a simple 7.5v 500ma power supply. When I started working with this module, I switched it for a 7.5v 1amp power supply and had plenty of power.) As it turns out there is good reason for this; some Youtube videos have surfaced recently with folks seeing anything from 500 meters to a couple miles of transmission capability from this module. That's a lot of horsepower for $5.00!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Obtaining and Preparing Your 8266 Module

I obtained my module from an Ebay vendor in the United States. The shipping was faster than China, but more importantly, the vendor provides the module without the pins soldered in.

The 8266 module isn't really breadboard friendly, but it's easy to convert it to a four pin module if you purchase the pin-less version. (or take a few minutes to remove the pins if you have obtained the other version)

You'll need 5 pin connections to make the module work. (See image 1)

RX, TX, ground, and 3v connected to two positions on the module.

I sourced a 4pin female cable from my parts box and cut off one end.

I used a small amount of nail polish to carefully paint over the unused pin, then looped the 3v connection from the power pin over the unused pin into the center. (See image 2)

The end result is a 4pin module that is now breadboard friendly to plug into your project.

Step 2: Hooking It Up

Once you have the module adapted, now make the four connections, (RX,TX,3v,Gnd) to your microcontroller. I've breadboarded mine to my Micromite Companion which is using the Micromite chip (created by Geoff Graham) running BASIC. The Micromite has multiple serial connections, and a console which I'm using as my interface to the 8266 module. You could even connect the module directly to your PC if you have a TTL-Serial-to-USB adapter. (Don't try to connect the module to a PC serial port directly, you could cause damage to the module or the your computer!)

The correct connections to the Micromite Companion (Micromite) are RX to 21, TX to 22.

The default baud rate settings are 115200,N,8,1

Next, you'll need to use a terminal program to program the unit.

I've written the following BASIC terminal program for the Micromite:

  • Open "Com1:115200" As #1
  • terminal:
  • a$="" : b$=""
  • a$=Inkey$
  • If a$ <> "" Then Print #1,a$;
  • If Loc(#1) >=1 Then b$=Input$(1,#1)
  • char = Asc(b$)
  • If char >31 Then Print b$;
  • If char =13 Then Print " "
  • GoTo terminal

Step 3: Configuring the 8266 Module

You'll need to configure the module for your wireless network.

You should already know your wireless SSID and password, as we'll need those next!

From your terminal, type AT and press enter. If you get a cheery OK from the module, you have have accomplished a big step in this Instructable!

Next, type AT+RST and give the module a moment to reset. You'll see a paragraph of data returned.

Type AT+CWMODE=3 to set the module as both a client and an access point.

Don't worry if you make a typo in the process of doing these commands. (There's no backspace) Just hit the enter button and enjoy the broken English error message and retype the command.

Next, let's see if we can see your wireless router. Type AT+CWLAP and enter. You'll see something like this.





See your access point? Type the following command, replacing SSID and password with your information.


Congratulations! Your module is configured for your network.

Now we need to see what IP address has been assigned to it.

Type AT+CIFSR and press enter. Your module's IP address should be displayed.

Step 4: BASIC Networking

Ok, we've lost about half our audience at the end of the last step. If you are still reading, it means that you have a working module, but need some guidance in the world of networking. Don't worry, you are in good hands. I'm going to condense a semester of networking classes (I used to teach CCNA) into just enough networking knowledge to be really dangerous. Sound like fun? Read on!

So you have the IP address that was displayed in the last step of the last page. (Did you write it down?)

Now what?

I'll assume you are at home with a wireless router somewhere in your home. It's probably connected to either a cable modem or DSL adapter. It's even possible that you have a single device which is doing both jobs. This device is the gateway to all of your internet travels, even the Instructable you are reading!

Your home network has a private side, and a public side. The private side of your network is all of the computers and devices which are connected to your wireless router. They can be wired to it's ports, or connected wirelessly.

You actually got a BIG CLUE to how the private side of your network is configured by the IP Address you were given to your module. Mine was

Take a look at those first three numbers.. 192.168.1

Those are the private side of your network. You might have 192.168.0 or even 10.0.0.

All of your computers and wireless devices on your network have an IP address that starts with those three digits.

It's that last digit (20 in my case) that determines the full address of each connection.

Each of your devices will have a different last number. Your wireless router probably uses 1.

The neat part about the private numbers is that typically there is room for up to 254 different devices and computers on your network right now! Talk about a LAN party!

Take a look at the image above.

Remember when I said that your wireless router has both a private side and a public side?

Your router receives a live IP address from your Internet provider. This address is unique to the entire world, and it's very important that it is! The wireless router actually contains two addresses. One is the private side, the other is the live IP address which is visible to the world. Don't worry, your router is designed to be the gatekeeper, controlling your web requests from your devices and keeping the bad guys out of your computers. The truth is, those private IP addresses are not visible from the outside world. (Unless we want them to be, keep reading!)

Step 5: Communicating With the Module

Let's take a break from networking class to see if your little 8266 module is able to communicate with your network. An easy way to do this is using the PING command.

If you are using Windows:

Click on Start, Run, and type CMD and press enter.

Type IPCONFIG and press enter.

Type PING and the IP address of your module. (I typed PING

If you are using Linux:

Open a terminal window

Type IFCONFIG and press enter

Type PING and the IP address of your module (I typed PING

I've circle two pieces of information in my image. The first is the IP address of the computer I'm working at. (This is always good information) and the second is the IP address of what I actually PINGed. Did you catch me PINGing my wireless router? Good eyes! Ping your router as well as see if it answers. It's usually .1

A successful PING request will always return a set of numbers like mine did. If you get "Request Time Out" messages it means that something isn't communicating.

Step 6: Running a Simple Webserver in BASIC

If you've gotten good PING results from your module, you are ready to start experimenting!

Let's start with a really simple web server written in MMBASIC. If you are using another micro, the BASIC program should be very easy to read and convert to your language.

Type in the little program and RUN it on your Micromite Companion.

If you are using a terminal program connected to your 8266 module, take note of the following commands..


These two commands set up the magic to make the module automatically answer a request from another computer or device. In my case, I've configured the module to answer web requests on port 80.

Typical ports are as follows:

  • 80 = Http web requests
  • 8080 = Http web requests on networks on which 80 is blocked
  • 23 = Telnet (text terminal) requests

Once you've run the program, open a web browser and type the address of your device (mine was into the web address bar. That place where you've typed

The module seems to handle all of the formatting of the required HTML headers your web browser is looking for, so you can blast data directly. (At a reasonable speed of course!)

Step 7: Inviting the Internet

So you can communicate from your web browser, your phone, laptop, or other Internet capable device to control your projects. I'll bet the ideas are already churning!

What if you want your friend in Ireland to control your project as well?

What if you want to control your project from somewhere other than your home network?

Those private IP addresses are only good while you are inside your own network.

It's time to talk about public address and something called router "Port Forwarding".

First, you need to know your router's public Internet address. It's easy to find. Simply point your web browser at are you be given your live IP address. (See first image)

Next you'll need to configure your router to allow requests from the outside world into your network and provide it a "rule" to allow certain traffic to your wireless module. This is called "Port Forwarding".

Remember when i said that I PING'd my wireless router at .1 to find it's address?

Open your web browser and type the address of your wireless router into the address bar.

(Usually, it's or depending on your network, but you should know it now.)

The router will respond with a login/password response. Unless you have re-programmed it, (Most people haven't) it will accept admin and password. (Don't worry, your router doesn't allow folks from the Internet to program it by default!)

Here's the tricky part. You'll need to dig, (usually in the "advanced" menus) for something called "Port Forwarding" or "Forwarding". All routers are a little different, but don't be afraid to poke around. You aren't going to hurt anything.

Take a look at the 2nd and 3rd images. They are great samples of some common routers.

Once you found it, you'll need to add a rule with the following information:

The External Port# you want to use with your device. Most of the time, you'll use either 80 (if you want to provide web access) or 23 (if you want to provide telnet "text" access). Just use the same number twice as you see in my examples. Some routers will also ask for an Internal Port# as well. Again you can use the same numbers twice again. Finally, give the IP address of your device. (Mine was

Once you've established this rule in your router, your device is now accessible from the world! From outside of your network, you can use your "live" IP address to access your 8266 module.

Step 8: Closing Notes

Remember when I said you'd get enough networking information to be dangerous? Welcome to the fun.

A few notes:

First, some Internet providers, in paticular cable providers don't like to give you the ability to use the common lower port numbers (like port 80, or 23). They will claim that doing this is a violation of their service (nonsense!) or that they are protecting you by blocking these ports. (hog wash!)

If this is the case, just us higher port numbers, like 8080 or 2323 (or just make up a higher number you can remember easily.) Just add it at the end of the web or telnet request to make it work.

Also, from time to time your "live" IP address can change making it impossible for you to reach your project until you go back home and look up the new address with There is a great, free service which you can subscribe to called DuckDNS ( ) which will give you a name on their server and a little tool to run on your PC which will keep track of the changes. Instead of using the IP address, you'll be able to use {yourname} It really works well!

Need more help?

Drop over to our friendly forums at Propellerpowered and post up!

Tech Contest

Participated in the
Tech Contest

DIY University Contest

Participated in the
DIY University Contest

Microcontroller Contest

Participated in the
Microcontroller Contest

2 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

98 Discussions


Question 1 year ago

Once this module is configured as an access point, could it be powered simply to broadcast its own SSID? If I made a bunch of these and plugged them into outlets around a home or office, could I use them with a wifi scanning app on my phone to map circuit breakers? e.g. plug a batch in, go to breaker box, scan for IDs, flip breaker, record IDs that disappear, repeat.


Question 1 year ago on Step 7


I'm wanting to port forward my esp8266 in my router so someone on the Internet can access it. I was given an APIP of, which is the local address I want to port-forward to. But my router says that is an incorrect IP; it says the first three numbers must be 192.168.0.something. The station address I was given is Is that the number I should use?


Question 1 year ago on Step 4

Hi, and many thanks for this Instructable. I posted (I think) a question about an hour before this outlining a few issues. basically I got an IP address returned of, but one my first test board this didn't show in my modem management screen, and the ping returned the timeout message. I moved on to a second board, which still returns the AS CIFSR:APIP, but now I get a sensible response as CIFSR:STAIP. From the instruction on this area I wasn't expecting 4 response lines, so now I know! I presume that when doing using this from inside a micro, in assembler, I will need to parse these responses out, so is there anywhere I can go to find out the possible responses, since I will need to look for failures as well as success. I guess this applies to all commands. This is the first time I have had to delve into wi-fi and/or bluetooth, despite being in the industry for 45+years, and officially retired, so please forgive the possibly dumb questions. On that note I have seen the latest ESP devices advertised as having BT built in, do you know of the best source of a simple guide to BT on the ESP? thanks again for taking the time to help people such as myself, a man after my own heart.


Question 1 year ago on Step 2

hello, can you tell me what does this code do? i have understood that it initialize the connection among uart and esp module and it wait for commands from terminal, it's right? thak you


Question 1 year ago on Step 2

i am using arduino uno in this arduino uno i connect the reset pin of arduino to gnd .
then open ide and upload the blank sketch to the board after upload the code open serial monitor ,fix 115200 rate then type AT command s .
my module is not responding for the AT commands


1 year ago

hello sir,
I just want to make my own network using esp8266 In that nodemcu as a server and two esp8266-01 as client.
client should send its data ( temp, humidity ) and server should handle the client ( relay connected to the esp-01 )
and the dashboard should be appear at the IP of nodemcu.
is this possible..? and how ? please help


1 year ago

How do you open up this to the internet when you have more than 1 esp in your network.


2 years ago

Hey! Can I Use this module to send high speed data to a machine!!!


2 years ago

Great tutorial, thank you. Its just what i was looking for, for one of my projects.


2 years ago

great tutorial


2 years ago


I am using my esp8266 in AP mode and I want to allow only specific devices to connect to my esp for security reasons. So how can I give a specific id to my devices other than setting a password for my esp in ap mode?


2 years ago

Thank you very much for the detailed and knowledgable explanation.

I succeeded to connect my ESP but lost you on the part of using it as a server,

I don't understand where is the html response is being defined and what triggers it.

From looking at your terminal code I can see that ASCII 71 ("G") is calling the server sub routine but I don't see how it would run automatically while getting a client request

Any clarification would be appreciated,


2 years ago

how to connect more than 1 esp8266 and read the corresponding rssi at same time??? Please reply ASAP.


2 years ago

Also, if you use Arduino code to program the ESP, I highly recommend you to use ESP.config() and setup static IP, Mask and Gateway. In this way you will save some time and delay when connecting to your router or Access Point. ESP.eraseConfig() method can be used to clear the cache in the end.

Arduino tutorials


2 years ago

Thanks, I have learned a lot from your instructables.


2 years ago

Nice article, I've made an ESP8266 network in my house using 5 this modules.

Xiu Wen Song

3 years ago

Hi, I am gonna use ESP8266 to build wireless tire pressure monitoring system and display on android? Any information to give me in order to facilitate my project? Thanks so much guys!

1 reply
PrashanthabibXiu Wen Song

Reply 2 years ago


did u get any support on this ? We are also looking for similar product. Can you please tell which sensor you plan to use ?


2 years ago

any thread discussing ESP8266 and arduino ?


2 years ago

I don't want to make that much electro smog in my environmet. I need a range of say 10m only, no more.

Can you please suggest an IC with that range?