In the following parts of this article we will deal with the usage of an ESP8266 chip along with an Arduino board, in particular we will describe the shield that has been especially designed for this module. In addition to the ESP03 (signed U3 in the circuit), some jumpers for the settings are found in the shield, along with a multifunctional SD-Card reader (SD1), that is interfaced by means of a 74HC4050 (U1) level shifter to Arduino; the adapter is needed in order to transform the TTL signals of Arduino’s lines (that are used for the SD management at 0/3.3V, as required by the memory cards). The SD slot enables the memorization of various data types: for example, a webpage, or the recordings of a data-logger on the web, and much more. But anyway it is not needed for the functioning of the WiFi shield and therefore it is an accessory for future developments.
The whole logic is powered with the 3.3V drawn from the LDO U1 regulator: the latter draws the said voltage – opportunely filtered by the C2, C4, C5, C6 capacitors – from the 5V supplied by Arduino’s line of the same name; the LD1 LED, having the R2 resistor in series.
Given that the shield is centered on the ESP03, it is the case to devote a few paragraphs to the purpose of deepening our knowledge on the subject of the functions of the ESP8266 integrated circuit, that is at its base.
When designing the shield’s printed circuit we considered the possibility to use both the module in the 01 version and in the 03 version, moreover with some jumpers it is possible to select different operating modes. The SDCS jumper (SD chip select) allows to select the pin to be used for the SD Card management, by default Arduino’s library uses pin 4. The ESPPD jumper (ESP Power Down) – if shortcircuited – enables the selection of the D7 pin, for the purpose of the control of the module’s functioning mode. In this mode, by means of Arduino’s D7 line it is possible to turn on and off the module, depending on the needs and with considerable energy savings: otherwise the module would remain always active. In the shield, all the ESP8266-03 module’s pins are also available, in a strip connector: this is useful for those who want to deepen their knowledge on the subject of the chip’s stand-alone usage. Both the modules that we considered have a standard serial communication interface that is compatible with Arduino; it consists of two data lines (TX and RX) that may be directed towards the hardware serial, or on the D8 and D9 pins, that are manageable by means of a software serial. The ESP8266 chip’s communication selection occurs by means of the jumpers, accordingly to what in table 2, and occurs anyway, considering Arduino’s intrinsic limitations: by using Arduino’s software serial in order to communicate with the ESP8266 module, the hardware serial remains available for the programming and the debug communication; by using Arduino’s hardware serial (UART module), the communication with the PC will create conflicts and therefore it will not be possible to program Arduino, nor to send debug messages to the Serial Monitor. The last option considers the possibility to connect the ESP8266 chip with the PC, by means of the USB/serial converter on board of Arduino, the Atmel328 microcontroller is not interested by the communication and the UART module must be disabled by loading a sketch that does not use the hardware serial (the UART module is disabled by default).
Communication jumpers’ layout.
Shield’s hardware connection.
Let’s see now the practical usage of this shield, by starting from some simple applications that will allow us to become familiar with the implemented functions. The ESP8266 chip’s management is carried out by means of some simple AT commands, to be sent serially, and even the data sending and receiving is carried out serially. It is however needed to pay attention to the version of the module you possess, since the first ones to be sold with a version 080 firmware were communicating at a 115 kbps speed, while the more recent ones (having a version 09xx firmware) operate at 9,600 bps. The possibility to communicate at a speed of 9,600 bps allows to manage the the module via the software serial communication, that can be easily implemented by means of the specific library that is available in Arduino’s IDE, thus leaving the hardware serial port free to communicate with the PC, and allowing for an easy debug functioning.
General functions
AT – Test AT start up Test
AT+RST – Restart module
AT+GMR T+GMR – View version info
AT+GSLP Enter deep-sleep mode
ATE – AT commands echo
WiFi functions
AT+CWMODE – WIFI mode
AT+CWJAP – Connect to AP
AT+CWLAP – List available APs
AT+CWQAP – Disconnect from AP
AT+CWSAP – Configuration of softAP mode
AT+CWLIF – IP of stations
AT+CWDHCP – Enable/Disable DHCP
AT+CIPSTAMAC – Set mac address of station
AT+CIPAPMAC – Set mac address of softAP
AT+ CIPSTA – Set ip address of station
AT+ CIPAP – Set ip address of softAP
TCP/IP functions
AT+ CIPSTATUS – Information about connection
AT+CIPSTART – Start connection
AT+CIPSEND – Send data
AT+CIPCLOSE – Close TCP or UDP connection
AT+CIFSR – Get local IP address
AT+ CIPMUX – Enable multiple connections
AT+ CIPSERVER – Configure as TCP server
AT+ CIPMODE – Set transfer mode
AT+ CIPSTO – Set server timeout
AT+ CIUPDATE – Update through network
+IPD – Receive network data
As for these first examples, in which we want to become more familiar with the chip, we will see to communicate with the ESP chip directly from Arduino Serial Monitor, thus leaving the board’s ATMEL328 microcontroller unused. Please load a sketch that does not use the serial port (Blink.ino will be fine) on Arduino, and set the jumpers so that the module may communicate with the PC.