web analytics
October 21, 2015

ESP8266 – Introduction

The ESP8266 module on the Phoenard is a simple Serial-driven WiFi module. It can connect to existing wireless networks (station mode) or start its own wireless access point (AP mode). In addition, it also supports operating in both modes at the same time.

Once connected in a network, it can communicate with other devices, servers and computers over TCP and UDP. This means you can use it to request or post information from the internet (HTTP) and communicate with other computers and Phoenards in the network.

Prerequisites

Before using the module, install the ESP8266 Arduino library from ITEAD:  ITEADLIB Arduino Wee ESP8266 (GitHub, zip archive)  |  Source  |  Installation instructions

We also recommend downloading SocketTest (Source forge) to test the communication with the ESP8266. It is a simple yet powerful utility to create UDP and TCP Server/Client connections. If you plan on communicating with your computer, this is a nice way to start.

You can now begin writing sketches in the Arduino IDE to make use of the module.

Initialization

Before you can use the module, it has to be turned on. Minimally, your sketch will look like this:

#include "ESP8266.h"
#include "Phoenard.h"

// Initialize the module over Serial2 at 115200 baud
ESP8266 wifi(Serial2, 115200);

void setup() {
  Serial.begin(9600);  // Initialize serial
  enableWiFi();        // Turn on module
  wifi.restart();      // Restart the module

  // You can begin using the module here
  if (wifi.kick()) {
    Serial.println("ESP8266 is accessible");
  } else {
    Serial.println("ESP8266 is not accessible");
  }
}

void loop() {
  // And do more module things here
}

 

Getting started

Further information on how to use this module can be found on the following pages: