With an ESP8266 board, the WiFiEsp library allows an Arduino board to connect to the Internet. It can serve as either a server accepting incoming connections or a client making outgoing ones. The WiFiEsp library is very similar to the Arduino WiFi and Ethernet libraries, and many of the function calls are the same.
Supports ESP SDK version 1.1.1 and above (AT version 0.25 and above). If you need to update the ESP firmware follow this guide.

The main WiFiEsp library features are:
  • APIs compatible with standard Arduino WiFi library.
  • Use of standard ESP firmware through AT commands (no need to flash a custom firmware).
  • Support hardware and software serial ports.
  • Configurable tracing for troubleshooting.

First of all you have to connect the ESP module to your Arduino board.
I have developed my own cheap ESP WiFi Shield using an ESP-01 module. Look at this Instructable on how to build it.

Now follow these set of articles to see how to use the WiFiEsp library for your projects.

Basic topics

Advanced topics


  1. Thanks for the very helpfull articles!
    Can you post other photos showing how to connect the ESP please?

  2. Your WiFiESP Library totally saved me from burning every ESP8266 module I'd bought, there's not a single other library out there (ah, ok, yours is only the 3rd one I've tried, but...) that would get my ESP8266 attached to my BT Home Hub Wifi router. Your lib + connectWPA sketch = instant success. Many thanks!

  3. Hi, does anybody have experience in controlling the ESP Module Power Up/down through the CH_PD pin connected to a dedicated arduino digital pin when using the WiFiesp library?

  4. Hi, my friend :)

    I find your library extremely useful and helpful but I would like to ask you if it's possible to make it work also with the TCP data packet transmission and reception since I would like to do so for a project that needs a more efficient and secure data transmission.

    Could you please implement TCP in your library and also add an example?

    That would be really appreciated.

    Thank you! Bye!

  5. Hi,

    Thankyou very much for your library! It is very usefull to integrate ESP8266 in Arduino projects. I'm trying to program a webserver to see data of some sensors connected trough SPI. I have a question regarding client detection: is there any interrupt or something like that is trigered when an user is connected to the IP of the webserver? my program crash just when I connect to the ip, even if I use a variable to "allow" the connection when no other task is performed...

    Thanks in advance!

  6. This comment has been removed by the author.

  7. This comment has been removed by the author.

  8. Hello, Good library!
    But in your example WebServerLed you forgot to set port 13 to OUTPUT.
    So, in Setup: pinMode(13,OUTPUT);
    Keep up the good work!

  9. Hi, finally a website with clarity. Great work. in the WebserverAP sketch, how can I add two buttons to the web page and perform some actions when either of the buttons are pressed ? [Matt]