Getting started with the ESP8266 WiFi module

The ESP8266 is a tiny WiFi chip with an on-board processor that has great potential and is ridiculously cheap. We picked one for only £1.59! from Gearbest. This tiny board can function in complete autonomy, without the need of an additional microcontroller. A combination of a traditional Arduino and a WiFi module will set you back around £25. This makes this board ideally for IoT projects. In this getting started with the ESP8266 WiFi module post, we’ll stick to the basics and to keep it simple, we will be using the Arduino IDE.

The ESP8266 Wifi module


The ESP8266 WiFi modules are widely available from different suppliers and there are different versions out there. The most popular and cheapest one is the ESP-01 but this module has a very limited number of I/O pins. The ESP-07 however has more accessible I/O pins and can be mounted on a breadboard with more ease. This is the one we will use for this post, but you can perfectly use the following information with any ESP8266 module.

The ESP8266 module can also be bought as an integrated development board that is breadboard-friendly and that also includes USB connectivity onboard. A very popular development board is the nodeMCU for instance.

Hardware Requirements

esp8266 ESP-07

ESP-07 pinouts

If you are using a bare ESP8266 module, like the ESP-07 we are using here, then you will also need to connect it to a 3.3V TTL serial port during development. There are many USB to serial converter modules, based on either the FT232, CH340G or CP2102 chip, available which present a virtual serial connection to your computer.

FTDI Programmer ESP-07

We are using a FT232 converter that can be jumpered between 3.3V and 5V. The FT232 converter also provide a 3.3V VCC line to the ESP-07 module but cannot provide enough power to run the ESP-07 module during Wifi operation. So we recommend a separate 3.3V power supply. If you happen to have a 5V power supply, you can easily acquire a 5V to 3.3V circuit to step down the voltage.



The ESP-07 factory default firmware is AI-Thinker and you can talk to the ESP-07 module with AT commands. To get started, wire the ESP-07 to the FTDI board as follows:ESP-07 basic connections

To send AT commands to the ESP-07 board, we tried to use putty but failed to get any response. So we moved on to Termite and set the baud to 115200. Make sure that you got Append CR-LF selected.

To get the firmware version, type the following command in the termite terminal and press enter.


You should get a response similar to:

AT version:  1 2016 20:04:45)
SDK version:
Ai-Thinker Technology Co. Ltd.
Dec  2 2016 14:21:16

For Arduino upload

To upload code to the ESP-07 with the Arduino IDE, you need to put the ESP module in bootloader mode and to achieve that, you need to wire your ESP-07 module as follows:Arduino ESP to serial connections

Installing the ESP8266 in Arduino IDE

It is fairly straight-forward to install the ESP8266 library in the Arduino IDE environment since the ESP8266 community has made it easy for users. For more information, please visit the ESP8266 repository. The instructions to install the library in the Arduino environment are as follows:

  • Install the latest version of the Arduino IDE from the Arduino website.
  • Start Arduino and open Preferences window.
  • Enter into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don’t forget to select your ESP8266 board from Tools > Board menu after installation).

You will now have some example codes for the ESP8266 in the Arduino IDE as shown below:
Arduino IDE ESP8266

Uploading code to the ESP8266 Wifi module

First of all, in the Arduino IDE, select your ESP8266 board from Tools > Board > Generic ESP8266 Module.
Arduino IDE ESP8266 WiFi module
Copy the following modified HelloServer code to the IDE and change the SSID and Password to match your home router’s SSID and password.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

const char* ssid = "Your Home ROuter SSID";
const char* password = "Your Router password";

ESP8266WebServer server(80);

const int led = 13;
String TextPage = "";

void handleRoot() {
  TextPage += "
<h1>Hello from BehindTheSciences</h1>

Getting started with ESP8266

  digitalWrite(led, 1);
  server.send(200, "text/html", TextPage);
  digitalWrite(led, 0);

void handleNotFound(){
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);

void setup(void){
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  WiFi.begin(ssid, password);

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
  Serial.print("Connected to ");
  Serial.print("IP address: ");

  if (MDNS.begin("esp8266")) {
    Serial.println("MDNS responder started");

  server.on("/", handleRoot);

  server.on("/inline", [](){
    server.send(200, "text/plain", "this works as well");


  Serial.println("HTTP server started");

void loop(void){

Upload the code and once uploaded, reset your ESP-07 module. After powering up, the ESP-07 should connect automatically to your router. Log onto your router to find the ESP-07 IP address. To access the web server, go to the browser of any devices on your home network and enter the ESP-07 IP address. You should be presented with the following:
ESP8266 simple Webserver
That’s it. You have just made a simple webserver.

Add a Comment

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons