User Tools

Site Tools


proiecte:sparrow

This is an old revision of the document!


Sparrow and CoAP using ESP8266

Iulia Manda - AAC

Introduction

CoAP is based on the wildly successful REST model: Servers make resources available under a URL, and clients access these resources using methods such as GET and PUT. It is intended for use in resource-constrained internet devices, such as WSN nodes.

The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to a WiFi network. Its main advantages are multicast support, very low overhead, and simplicity.

In this project, Sparrow acts as a CoAP server, which makes the resources available (e.g humidity, temperature) over the internet. The data collected by a master Sparrow node is sent to the CoAP client.

Connecting the ESP to Sparrow

Server

Arduino ESP8266 Wifi

Arduino-ESP8266 [1] is a library to manage the ESP. On short, it implements wrapper functions on top of the basic AT commands [2] that can be used to configure the ESP.

Since the already implemented library was using different commands than our version of ESP, some functions had to be changed. You can find the updated version at [3]. In case one will have problems with other functions that I did not yet use in my proof of concept example, he/she should check their implementation in ESP8266.cpp.

CoAP

The existing CoAP protocol library implementations make use of the implemented support for handling UDP packets on a specific board. The definition of a CoAP instance:

Coap::Coap(
#if defined(ARDUINO)
    UDP& udp
#endif
) {
#if defined(ARDUINO)
    this->_udp = &udp;
#elif defined(SPARK)
    this->_udp = new UDP();
#endif

More details on how Sparkfun handles this can be found at [4]

As a <wifi> structure was already populated using the ESP8266 Arduino library, I decided to use it in CoAP instead of using UDP. As such, the definition of coap instance in our code looks as follows:

Coap::Coap(ESP8266& wifi)
{                                                                                
    this->_wifi = &wifi;                                                           
} 

The updated library can can be downloaded at the end of this page.

Server Implementation

Client

libcoap

Copper

Testing

Results

Resources

proiecte/sparrow.1486036088.txt.gz · Last modified: 2017/02/02 13:48 by iulia.manda