ESP8266 as an Access Point

If you’ve been following my articles on the new ESP8266 board ( for example) you’ll know that you probably need to FLASH the board to the latest version (0018000922 at the time of writing though it reports 08000902 it has the new baud rate control and defaults to 9600 baud initially) and you’ll know there are a few sites – one to help you flash the ESP8266 and another with a fairly up to date instruction set.

And that’s fine – but today someone was showing me their new all-singing electric car which is controllable by phone – and it has it’s own access point – and I thought – I WANT ONE – which reminded me – how on EARTH do you make an access point from the ESP8266? Well, that’s not obvious – a quick look at instructions show that it CAN be an access point and there is a vague reference to this..


The imagery above comes from NURDSPACE – it’s fairly obvious how to join a network but if you want the ESP8266 to BE the network – what’s that vague reference in CWSAP? What’s an ECN for example – is THIS the command to set up your own Access point – doesn’t look like it as it says “connect to your router”?

Well, it IS the access point setup – the description is just a little misleading and there is some missing information. I found THIS on an another site…

BINGO – so actually this is to make your OWN access point with a choice of channel and encryption method. It returns OK incidentally, usually within a second. You need to set CWMODE=3 – and that information survives a power cut – so you only need set it once.  And here’s the thing – the CWSAP ALSO survives power cycling – so just as you need only connect to an access point once – and on power up it reconnects – you only need to set the board up as it’s own access point once and it keeps that through power down (though in both cases I’d be checking on power up that it’s still working).

So after username and pass you wish to use to protect the unit, pick a channel (your mobile might have an app to tell you which channels are clear where you are) and a mode 0=no encryption – i.e. open – 1=WEP, 3=WPA_PSK, 3=WPA2_PSK and 4=WPA_WPA2_PSK.

And so where are we now – web server, web client, socket listener, access point. This just keeps getting better and better. Everything is there – provided you don’t mind setting this all up with a serial connection. What would be nice would be for the unit to default to it’s own access point – complete with setup screens just like a simple router – for example the access point seems to have a fixed IP range.. I can’t up to now see how to adjust that. Not sure if I’d want to but there’s always a chance it might conflict with your own setting. When I hooked my phone into it the phone ended up as…

So how does that work? Well, the unit IS running DHCP as I disconnected once and reconnected and was told (using the Android tool IPCONFIG) that I was – the constant is the address of the Access point itself which is –  it also has an address built in for a DNS server and I have NO idea where that comes from – maybe a hangover from previous connections.

Of course in this mode your phone or whatever device can’t do anything with the REST of the world – it can only talk to the ESP8266 – but that’s the point – you can then control something.

I turned the unit off – hooked it up to my Arduino toy that turns a light on and off – after changing the access point to – and LO AND BEHOLD without using external WIFI I can turn the light on and off – and if I can do THAT – I can control ANYTHING – next stop – WIFI house controller.

This is of course as far as many tutorials would take you – leaving you then to find the problems yourself. it occasionally locks up occasionally and I have no satisfactory solution. You can try as I have, controlling the physical reset line when you see “busy”… I reset for a second and re-issue the main mode command… and that’s fine BUT of course your phone by then has disconnected from you and reconnected to your normal router – so that REALLY isn’t a solution. I found a customised ROM with a new instruction to reset in software – but I don’t yet know which ROM it is BASED on – when I find that out I’ll report back as that’s a definite reason to update the firmware.  I have left this on overnight and it’s been absolutely fine – but if you send commands way too quickly it might just lock up. I’m currently requesting the status of my LED every 200ms – so I can see the status of it on the phone – and I have 2 buttons one for off and one for on. By and large it is fine – but there ARE times when it locks up and the reset is the only answer for now.

So – there we are… this incredibly cheap unit looks like it just MIGHT be useful – not sure about that internal aerial though – I was going to order one of the ones with a socket to put a decent whip on it – but they only have 4 pins (ie power, ground, in, out) which means no firmware upgrades from a file – pretty useless then given the current variations of firmware. I hope this is helpful – if you find better sources-  please be sure to return the favour.  I’m and you’ll find my home control stuff at


13 thoughts on “ESP8266 as an Access Point

  1. Hi Pete, just found your site by searching for esp8266. I’m right there with you. This thing is going to change everything for me. I use a pic32 microcontroller to make things and this little unit opened up the world really. Please keep up the awesome articles about this unit. I will follow.

    • Nice write up, Only just seen your blog, started with this on Friday.
      Don’t quite follow your setup to get it to join its own AP, an how its possibly all changed with 0020000903
      Ive just done a setup like this :-



      I then connect my laptop to subnet 99 and get 99.101
      I run netcat on the laptop listening at 1300 and do
      type text on the laptop and get :-
      +IPD,25:some text from PC client

      Just what I wanted.

      problem is that since 00170901 there doesn’t seam to be a stable stream version and the link drop after several lines of text don’t know why, hope they fix it soon.

      Hope this helps.
      … Simon

      • This thing is very quirky and a bit misleading due to the lack of good documentation. In then end I didn’t need to set the Station address and could use it in mode 2 as HotSpot only. Works nicely either as a server for a telnet client or calling out to a netcat listener. So you can organise which end you like to be the client/server. Setting AT+CIPMODE=1 is useful so that you can then just send your data continuously.

  2. Hi,

    Thanks for some great write-ups with the esp8266. I just got mine updated to

    AT+GMR 0018000902

    And I am actually trying to create an AP, currently it’s broadcasting but I want to change the name of the SSID.

    I’m using

    Possible to write up step by step instructions on how to accomplish this?


  3. Hi, firstly, thanks for your great articles which have been of great help.

    I have configured one of my ESP8266s to act as an access point but now I have hit a problem trying to back-out and revert to joining my home network. No matter what I do the module refuses to let go of being an AP. I’ve tried all combinations of CWMODE and using CWQAP but it totally fails to allow me to connect to my home router.

    Have you reverted your ESP8266 AP and, if so, how?

    • I hope someone else has – the problems of modes hit me soon after I started using the devices and that’s when I gave up with AT modes etc.. if you think back to a typical Arduino ETHERNET card… I have some sitting there acting as TCP/IP listeners -they’ll talk all day to a mobile phone sensing messages back and forth, status, control etc, in the background I can easily spawn off an HTTP client and go get the time somewhere – when I close that function, my TCP client is still happily working. THere is NO WAY we could do that with the AT command set for example and the ESP8266s. I was hoping to be able to fathom out hos to do simultaneous stuff like that by compiling – little did I know the API would be complicated and the documentation “limiting” – amazing how we make use of the many free libraries available for Arduino and don’t give too much thought as to how much time someone else has saved us. Right now the ESP8266 despite now having this GREAT Eclipse environment for us Windows types, is still lacking even the most basic libraries – hence my having to make my own real time clock etc. My own solution is not ideal but works -base everything on MQTT messages. I’m putting another blog item together to explain why I think this is such a great thing – but unless I mis-understand – surely the ESP8266 can not only be an access point with it’s own IP addres but ALSO run on the home network as a station at the same time…. isn’t that what you’re after?

  4. Hi, I understand what you say but my problem is not trying to run as an AP and on my home network. The problem is that I cannot get the ESP8266 to STOP being an AP. I just want to go back to being a member of my home network but the module refuses to stop being an AP.

    No matter what I do it appears as a valid AP on the list:


    +CWLAP:(3,”Raymond 2.4Ghz”,-86,”c4:3d:c7:90:f1:b4″,3)

    “TEST” is my ESP8266 AP, “Prometheus” is my home network. CIFSR gives:


    and CWJAP=”Prometheus”,” fails every time”. I am stuck and can’t get out of AP mode.

    It almost seems that it’s a one-off choice with no back-out!

    Firmware version is: 0018000902-AI03

    • Problem fixed and the outcome should be a warning to us all!

      Checking, yet again, my wiring etc. I have a long breadboard with an ESP8266 at each end of the board sharing a common 3.3V regulator and it has all worked perfectly until today when I turned one ESP8266 into an AP. I noticed that the 4uF capacitor on the output of my regulator had a wire out of the breadboard and when pushed it back in, “Hey Presto” all working again!

      I was about to ditch the whole project, cut my losses and go back to nRF24L01s but now, with much egg on my face, I will continue. I’m adding as much smoothing as I can possibly add with out becoming paranoid but that ~300mA current draw on transmit should not be ignored.

  5. Oh I would absoluitely echo that, my first attempt at going from “the lab” to reality with these chips was an abysmal failure. 600ma 3v3 switched supply – so much noise or more likely poor regulation – I could not even get the unit to connect to my access point never mind DO anything. Now with a 1amp 5v switched supply feeding a little 3v3 regulator capable of 750ma it all works a treat. Even sticking a DHT22 on the circuit with a very short lead (3″) I found a 0.1u cap right at the DHT22 end necessary. With all of that in place everthing is rock solid – and as you’ll see in my next blog – things are coming along REALLY well.

  6. Thank you Scargill for the amazing article. I tried the same thing and it worked!! But I see that my phone/pc takes about 3-4 minutes to connect to the access point. And the same time lag when I run a TCP server in ESP8266 and try to connect from a TCP client. This does not happen when I TCP connect to ESP8266 which is in STA mode, connected to my home network AP. Is this something that you encounter as well?

    Version: 0018000902-AI03

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s