Even though this looks like a long post, I have composed it for a friend and unlike mostly everything else on this blog, this is not just for my own reference, so it should be easy to follow and understand (I hope).
Arduino does not come with WiFi, there are shields from Arduino that provide WiFi, and those shields are based on ESP8266 which is a very cheap WiFi enabled microcontroller. but there is nothing stopping you from using any ESP8266 board and connecting it to your Arduino, they all should work, and you probably already have them since you are here, models from the 01 (5 boards for $12 ) up to the 12E or 12F (3 for $14). so that is basically around $2.5 to $4.6, not bad for WiFi and a microcontroller !
Communication between Arduino and ESP8266
Arduino can talk to the shield either via UART or via SPI (Given the libraries written for this), SPI is up to three times faster than UART, but most of the time your application, be it sensor data or the like will not be able to flood any of those 2 buses, So i will be going with serial for certain advantages (convenience mainly) provided by serial.
1- ESP8266 (Any variant should do)
2- Logic level shifter, since Arduino is 5V and ESPs are 3.3, I have been told that the ESP 12E and 12F are 5 volt logic tolerant, but I would think going with a logic shifter might save me something down the road, hours of debugging, or a new board, or something i fail to foresee
3- An Arduino, I am using a mega, but an UNO should do just fine (I will cover it)
4- Wires to connect all the above, and probably a breadboard (I like to solder things to a board, but not everyone likes to do this)
5- A couple of micro USB cables that i use as a power supply
Let us get to the software you will need to download whether you are looking to have them connected in SPI or serial.
Software on the ESP8266
1:SPI: If you are going with SPI, you will need to flash JiriBilek / WiFiSpiESP onto your ESP8266, fortunately, this comes with an ino file that you can use your Arduino software to flash directly
2:UART-Serial: If you are going with serial (Like i am in this tutorial), you might want to go with jeelabs / esp-link, mind you, Arduino themselves forked this before for their own WiFi shields, but since then, the jeelabs esp-link has added many features, so i would recommend you go with the original jeelabs.
Software on your Arduino
1:SPI: if you have installed the SPI software from above on your ESP8266, the accompanying Arduino software would be JiriBilek / WiFiSpi, The library implements almost the same functions as the Arduino WiFi library.
2:UART-Serial: there is no library to go with this case that is beyond your regular serial bus if you want to exchange serial info, so if this is a 3D printer, software on your PC should be able to translate the data into serial, and it would be transparent, but what if you want to use WiFi from within Arduino, like a client that downloads pages or sends post data to pages,
Choice of UART-Serial
With UART-SERIAL, i can simply update the software on the Arduino over the air on WiFi, I can get serial messages and use WiFi at the same time both as client and server, this may all be possible with SPI, but there are complications and extra work to be done !
So from this point on, I will be focusing on using UART-Serial, and hopefully when i have time i can demonstrate how the SPI software might work in the same way but it should be easy to adapt what you learn here there, the details are available on SPI on the GitHub pages
Connecting the boards together
The ESP8266 has a TX and RX pin that should be connected in reverse to the ones on the Arduino, RX (Receive) should be connected to send, and send to receive, both boards need to share a common ground (reference voltage), and an Arduino mega should be able to provide 3.3 volts with sufficient current for the ESP8266, if you have an ESP8266 with an onboard voltage regulator, you can simply add it to the power supply directly through the VIN pin (rather than the 3.3V pin)
Uploading jeelabs esp-link to the ESP8266
Start by downloading the zip file from GitHub,