How does a wifi module work? How to control an LED from your phone? Introduction The esp8266 wifi module is a wifi communication module for Arduino and Raspberry Pi. This module can receive and transmit data via the TX/RX link, and therefore acts as a host for your WiFi applications. This module will enable you to bring wifi to all your electronic projects. It has two modes:Station modeThe esp8266 connects to an existing wifi network (the one created by your router). In station mode, the esp8266 obtains the ip address of the router to which it is connected. With this address, it can configure a web server and provide web pages to all devices connected under the existing Wifi network. Wifi Access Point ModeIn this mode, the esp8266 creates its own wifi network and acts as a router. Several devices, such as your telephone or a computer, can connect to it. However, the wifi access point created by the esp8266 is not connected to the Internet.Finally, you can connect a maximum of 5 devices at the same time to the module. By default, the Wifi module is configured as a wifi access point. You’ll need to specify in a program whether it should connect to a network or act as a wifi access point. These are the esp8266 pins:GND : GroundGPIO2 : Programmable pinGPIO0 : Second programmable pinRX : UART link receiverTX : UART link transmitterCH_PD : To be connected in 3.3VREST : Reset : resets the program. Connect to 3.3V for normal operation and GND for reset.VCC : Supply voltage In our course, the RST pin, GPIO0 and GPIO2 will not be used. Esp8266 Library To run your program, you can use the esp8266 library, which will facilitate module control. It’s a .zip library, so all you need to do is download it and tell the Arduino IDE software where to find it.Next, you need to install the Esp3266 board so that the program can compile and download according to it. To do this, go to tools then board manager and type esp8266 : Once the board has been installed, you must select the Esp8266 card as the card to be programmed for the program to run: You’re now ready to use it. If you’re having trouble installing it, we recommend our course on libraries. Circuit diagram Here’s the circuit diagram we’ll need to run the programs. The highest green pins correspond to the first line of pins on your wifi module. The lowest pin line corresponds to the second line on the wifi module.The circuit does not change for all programs. Disconnect RX and TX terminals before uploading programs! As you can see from the circuit diagram, the RX and TX terminals on the arduino board are connected to the wifi module. The wires connecting terminals RX and TX must be disconnected before uploading a program, and reconnected afterwards if you don’t want any errors when uploading. For more information, see uploading problems. Connect to a Wifi access point We’ll now look at how to connect your esp8266 module to your wifi network. To do this, we’ll use the module as a client, as it will connect to the network and not create one. The diagram linked to the program is the one shown in the previous section. Scan wifi access points Another way to see our wifi network is to scan all nearby wifi networks. To do this, we’ll use the Wifi scan network function: Send a message over the Wifi network We’ll now look at how to connect to a network and send a message over it. We’ll then see how the network responds to our request: Create a Wifi access point We’ll now look at how to use the esp8266 module as a host. It will take the place of the router, and peripherals will be able to connect to it. However, it will not be connected to the Internet. Here, the ssid and password to connect are :ssid: Arduino_FactoryPassword: Arduino_Factory_12!You can change this as you wish in the program.