Introduction: Accesspoint - Station Communication Between Two ESP8266 MCUs

Picture of Accesspoint - Station Communication Between Two ESP8266 MCUs

Hello Makers!

In my previous instructable I made a WiFi communication between two ESP8266 MCUs through a home WiFi router. As I saw from the comments there are Makers who would like to use ESP8266 MCUs far from the range of a router. So here is a bare minimum instructable about an accesspoint - station communication which don't needs WiFi network.

Step 1: What Do You Need.

Picture of What Do You Need.

Things you need:

  • 2 pcs ESP8266 based MCUs e.g. Wemos D1 mini
  • 2 pcs micro USB cables
  • and a PC with Arduino IDE

Step 2:

Everything you have to do:

  • Download the attached sketches
  • Open them in two independent Arduino IDEs
  • Upload them into two ESP8266 MCUs.

The AP has a fix IP address eliminating the IP conflict with your other projects.

The station uses this predefined IP to connect to the AP. The station triggers the AP with a message and the AP answers it.

Opening the serial monitors of each running Arduino IDEs you can see the flow of the messages and answers.

The built in LED flashes during the communication. It is only visualization you can eliminate flashing if you don't like it.

Step 3: How to Open Independent IDEs

How to start two independent Arduino IDEs?

  • At first click on the accesspoint_bare_01.ino. It will open the first Arduino IDE.
  • Connect the first MCU.
  • Set the new port appears in the Tools->Port menu to the first MCU.
  • Upload the sketch. It will be your accesspoint.
  • After that go back to the downloaded sketches and double click on station_bare_01.ino. It will open the second Arduino IDE.
  • Connect the second MCU.
  • Set the new port appears in the Tools->Port menu to the second MCU. (If your IDEs are independent then port will not change in the first IDE window.)
  • Uplod the sketch. It will be your station.


Löwenherz made it! (author)2017-12-04

Hi Gyalu

Its the first time I'm able to talk between two NodeMCU ESP8266 without any router. Therefore I searched arround for quite a while. I'm so happy that I found your tutorial. And what surprised me: the range of this NodeMCU's is nearby as big as the routers range.
Thank you!!!

潘宗轅 (author)2017-12-01

Hi Gyalu,

I just want to thank you in English.

Your article is so great :D

Gyalu1 (author)潘宗轅2017-12-02

Hi 潘宗轅,

You are welcome!

Did you use it in your project?

潘宗轅 (author)Gyalu12017-12-03

Yes, I try to use ESP-01 instead of arduino nano and HC-05.

But there are some problems.

I need to send data once by client in 2ms.

But it's working too slowly by ESP-01 Wi-Fi, from time to time will pause.

I still don't know the reason why...

Gyalu1 (author)潘宗轅2017-12-03

I am afraid ESP and the WiFi communication wil be slow to send and receive messages in every 2ms.

alharith (author)2017-11-28

good day bro,

I am trying to use your code with two clients(+) and one station. I have uploaded the access point code in two esp8266 12e and made some modification, but no success so far. have you tried such thing?

Gyalu1 (author)alharith2017-11-28

Hi alharith,
I don't understand well what would you like to do, but if you want to connect more esp into one network, then you need only one accesspoint and you can connect more (max five) stations to it.
So I don't know why do you need two accesspoints.

alharith (author)Gyalu12017-11-28

Hey Gyalu1,

yeah you are right! I mixed up programs. I got it working now, thanks to you. I have noticed in many websites that 5 stations is your maximum. but I might try to wake some and put some in sleep to solve this problem.

Vijay LR (author)2017-11-19

Dear Mr Gyalu,

Hi , this is Vijay .

Thanks for the excellent tutorial.

I am working out to send the digital Input status of the accesspoint to client.

Ex D0 input status of accesspoint is to be sent to client on WiFi.

Client should read status of D0 ( High or low ) and should switch ON or OFF its D0 output.

Can you please guide on this code ?

Gyalu1 (author)Vijay LR2017-11-19

Hi Vijay,
try something similar in the AP program. Replace the existing "client.println...." command with the next:
In the client:
String answer = client.readStringUntil('\r');
int APD0status = answer.toInt();
digitalWrite(D0, APD0status);
Write the results step by step to the serial moditor and you will see what you have to modify.

Vijay LR (author)Gyalu12017-11-20

Hi Gyalu !

Thanks a lot .

It is working fine.

Only change I did , was output no D7 instead of D0 in client code.



naveen_gemini (author)2017-11-12

Hi Gyalu,

Excellent Tutorial , but your station side code

char ssid[] = "Wemos_AP"; // SSID of your home WiFi

char pass[] = "Wemos_comm"; // password of your home WiFi

requires wifi ( thru' some router) .

Is there any way we just communicate between two nodemcu ( esp8266) without usage of any type of router , wherein the station communicates directly with the access point.

Gyalu1 (author)naveen_gemini2017-11-12

Hi naveen_gemini,
Thank you for your comment! The remarks are wrong in my station code. These are not the SSID and password of my home WiFi. The station connects using this SSID and pass to the accesspoint directly.
So the code does what you want, the two ESP communicate without the home WiFi network.

IvanI11 (author)2017-10-21

thank you

AsifI24 (author)2017-09-09

Thanks !!! worked form me.
Two node MCU's talking successfully.

Any one who needs help can contact me on

PalA1 (author)2017-09-01


I want to communicate between two nodemcu's via same hotspot.

first node is connected to ir sensor and second one at the other end is also connected to different ir sensor. When the first ir sensor is trip and after that the second one at the other end in the same way. I want to calculate the difference

in time and display on the server or on the app. The distance between two end is approx 100 feet.

karlt1 (author)2017-08-07

thank you so much it work perfectly

the access point send data to the station.

the station send data to the access point.

About This Instructable




More by Gyalu1:Accesspoint - Station Communication Between Two ESP8266 MCUsWiFi Communication Between Two ESP8266 Based MCU Through the Home RouterPOI hunter
Add instructable to: