How to establish wifi communication between two ESP8266 nodes?

How to establish wifi communication between two ESP8266 nodes?

Learn how to establish a Wi-Fi communication (HTTP) between two ESP8266 NodeMCU boards to exchange data without the need to connect to the internet (you don’t need a router). You’re going to set one ESP8266 as an Access Point (Server) and another ESP8266 as a Station (Client).

How does TCP communication between ESP8266 based MCU work?

Run the serial monitor for the new Arduino IDE also. The client connects to the server soon and you have to see the received messages in both terminal windows. During the communication the built in LEDs will flash for a short time. Here is an application which uses the TCP communication between ESP8266 MCUs.

Why do we need ESP8266 in Internet of things?

Once you’ve connected them together you then need a way to make them talk each other.   As humans do, while one is talking, the other one needs to listen. The advantage of ESP8266 is that in the same time, can be both Client and Acces Point / Server.

What kind of sensor does ESP8266 send?

The ESP8266 server is an Access Point (AP), that listens for requests on the /temperature, /humidity and /pressure URLs. When it gets requests on those URLs, it sends the latest BME280 sensor readings. For testing, we’re using a BME280 sensor, but you can use any other sensor by modifying a few lines of code (for example: DHT11/DHT22 or DS18B20).

How to set up soft AP with ESP8266?

The Wi-Fi network established by the soft-AP will be identified with the SSID set during configuration. The network may be protected with a password. The network may be also open if no password is set during configuration. Setting up soft-AP with ESP8266 can be done with just a few lines of code.

How to connect Ino code to ESP8266 module?

Connect and load the program of the accesspoint.ino first then connect another ESP module, change the port available and upload the stationpoint.ino code to the ESP module. When the code is uploaded the two-way communication will begin and the LED in both the ESP8266 modules will blink together when the connection is established.

How does ESP8266 check if a client is available?

In the above code, the ESP8266 checks whether any client is available or not. If a client is available, it will read its data until it receives ‘’ which means the end of the packet. From that point on, our web server can receive GET requests but cannot interpret them or send an answer.