Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects


Written By: 

Prabakaran P.M

This project gives details about the ability of the ESP8266 is not only limited to connecting to a WiFi network and exchange data to the internet, but it can also set up a network of its own by creating an Access Point and allowing other devices to connect to it. This example demonstrates how to turn the ESP8266 into an access point (AP) in two different ways, one is using LUA scripting and other is with the Arduino IDE and serve up web pages to any connected client.

It is assumed that you have gone through “Getting started with ESP8266” if you are new to this. First, we will discuss about how to achieve this using LUA Scripting for this refer ESP8266 should be Flashed with the NodeMCU and refer Getting Started with the ESPlorer IDE, then we will discuss about how to achieve the same using Arduino IDE for this refer ESP8266 programming with the Arduino IDE.

Circuit Connection:

Here we are using USB to TTL converter for connecting the Module with the PC. The 3.3V output of the converter is used to power the module.

The connection details are as below:













Connected to 3.3v to enable chip firmware boot

Don’t forget to pull up CH_PD HIGH, you won’t get a response from the module if it is not done.

You can also use Arduino UNO by uploading empty setup() and loop() functions, if you don’t have a USB-TTL converter.

 The connection details are as below:

  WIFI Module

Arduino UNO











Connected to 3.3v to enable chip firmware boot


For viewing the data from the ESP8266 a serial terminal in Arduino IDE can be used.

Writing Server Script in LUA:

This code given below will configure the ESP to act as an Access Point and it has its own SSID=”test” and Password=”password” and also act as the server which will continuously listen for a connection.


print("ESP8266 Server")



print("Server IP Address:",wifi.ap.getip())


sv = net.createServer(net.TCP)

sv:listen(80, function(conn)

conn:on("receive", function(conn, receivedData)

print("Received Data: " .. receivedData)


conn:on("sent", function(conn)




This will create a WiFi Access point named “test” which can be seen through any client devices.

Creating server using Arduino IDE:

The below Arduino code will also create a server and Access Point in ESP8266 which will continuously listen for a connection.

#include <ESP8266WiFi.h>

#include <WiFiClient.h>

#include <ESP8266WebServer.h>

const char *ssid = "test";

const char *password = "password";

ESP8266WebServer server(80);

void handleRoot() {

server.send(200, "text/html", "<h1>You are connected</h1>");


void setup() {




Serial.print("Configuring access point...");

WiFi.softAP(ssid, password);

IPAddress myIP = WiFi.softAPIP();

Serial.print("AP IP address: ");


server.on("/", handleRoot);


Serial.println("HTTP server started");


void loop() {



After uploading this sketch, you can find a new Access Point named “test” from your Laptop or PC.




Thanks alot working fine

works perfect but after first time i uploaded the program again with a diferent ssid and password and yet my pc still recognizes it as "test" and with "password"  instead of the pass i put in the code. any ideas why this happens?

must be something i modified in the code but it´s working properly again

I had the same problem, the password requires at least 8 characters, if it is less than 8 characters it will use the previous settings

Absolutely true. I confirm. Had the same issue: I viewed the old config, After changing the password from 3 to 8 car. I now see the actual SSID !






How to get the device data connected to it

thanks alot , but when i tryied with ESP8266 android APP for operating relay 

connect error 404 MSG appeared 

following modification i made with the code

const int output1 = 14; //ok D5
const int output2 = 12; //ok D6
const int output3 = 13; //ok D7
const int output4 = 15; //ok D8
boolean device1 = true;
boolean device2 = true;
boolean device3 = true;
boolean device4 = true;
 pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(output3, OUTPUT);
pinMode(output4, OUTPUT);
digitalWrite(output1, LOW);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);


I wanted to know that password that you are writing in the starting of the code is that the password of your WIFI "test". Means If I want 8266 to connect to my wifi and then create a hotspot i.e it should take input from wifi and create its own hotspot. Please let me know your answers

unable to upload the sketch always prompts

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

GPIO-0, Should be low or pulled down (Program mode) 

what will be board name??

How many clients we can connect to ap??

I used your program for Arduino. When I run it I can see on a serial terminal:

Configuring access point...AP IP address:
HTTP server started

On the other hand, from my Mac I can see "test" in the WiFi network list. When I try to connect to, with the password "password", it doesn't work.
Do you have an idea what could be wrong?

Can I use this Router for communication between two devices? Please Help

i tried uploading the same code. but it gets disconnected after few seconds

when i connect to the ap i cannot load any webpages. pls help

is it possible for two drives to connected to esp8266 nework to ping each other?

It will be appreciated if you can tell how to communicate with esp using mobile. For example from web browser or an android app.  

will it work with an ESP8266-01 or a NodeMCU?

will it work with an ESP8266-01 or a NodeMCU?