Assessing The ESP8266 WiFi Module For The Internet of Things
Assessing The ESP8266 WiFi Module For The Internet of Things
Email: [email protected]
Abstract—The Internet of Things (IoT) is experiencing However, WiFi is typically considered a power hungry
rapid growth and being adopted across multiple domains. protocol and low-power devices that operate with sig-
For example, in industry it supports the connectivity nificant autonomy rely on other technologies namely
needed to integrate smart machines, components and
products in the ongoing Industry 4.0 trend. However, there Bluetooth for personal devices, ZigBee for sensing,
is a myriad of communication technologies that complicate WirelessHART and ISA100 for industrial devices and
the needed integration, requiring gateways to connect to the GPRS, LTE, LoRA and Sigfox for wide-area sensing
Internet. Conversely, using IEEE 802.11 (WiFi) devices can through communication operators.
connect to existing WiFi infrastructures directly and access
the Internet with shorter communication delays and lower In this work we revisit the use of WiFi considering
system cost. However, WiFi is energy consuming, impacting recent ultra-low-power and low-cost devices, avoiding
autonomy of the end devices. In this work we characterize external communication operators and additional gate-
a recent WiFi-enabled device, namely the ESP8266 module, ways, leveraging existing WiFi infrastructures and re-
that is low cost and branded as ultra-low-power, but whose lying on WiFi and Internet security techniques. Using
performance for IoT applications is still undocumented.
We explore the built-in sleep modes and we measure the WiFi in manufacturing has the potential to reduce com-
impact of infrastructure parameters beacon interval and munication latency and costs and it has been recently
DTIM period on energy consumption, as well as packet considered either by communication solutions providers,
delivery ratio and received signal strength as a function e.g., DigitalAir, and by academic studies, e.g., on reli-
of distance and module antenna orientation to assert ability [8]. Here we focus on energy consumption and
area coverage. The ESP8266 module showed suitability
for battery powered IoT applications that allow 2-4 days area coverage, considering a use case in which smart
recharge cycles on a 1000mAh battery with seconds-scale WiFi tags are attached to relatively large products such as
transmission intervals. appliances or vehicles and allow tracking them along the
production line, being removed at the end of production,
I. I NTRODUCTION recharged and re-applied at the input.
The number of devices with sensing and wireless Similar studies on energy consumption can be found
communication capabilities has been constantly growing for both Bluetooth and IEEE 802.15.4-based protocols
as a result of steady reductions in cost and size of (ZigBee, WirelessHART and ISA100). For example, the
computing hardware, communication interfaces and data energy consumption of the Bluetooth low energy inter-
storage. This trend is the basis for the strong growth face in the Intel Edison module was studied in [16], stan-
of the Internet of Things (IoT) that we are witnessing dard and low energy Bluetooth were compared in [10],
nowadays across multiple domains, from Home Automa- IEEE 802.15.4 in the TelosB motes was analysed in [13]
tion [14] to Health Monitoring [12] and Manufacturing and in the MICAz motes in [17].
Systems [11][6]. IoT uses Internet technology to allow Here we characterize in detail a recent WiFi-enabled
devices sharing information openly and widely but also device that is highly integrated and branded as ultra-low-
communicating directly with each other in sensing and power and low-cost, namely the ESP8266 module [1][2],
actuation loops, i.e., the so-called Machine-to-Machine which also offers a full TCP/IP stack.
(M2M) paradigm. In industry we often find the expres- This paper starts by presenting the features of the
sion Industrial IoT (IIoT) where Things refer to smart ESP8266 module and the mechanisms that allow it to
components, machines, products, etc. lower energy consumption when performing recurrent
The prevailing communication technology for Inter- seconds-scale communication. Then, we describe the
net access of free moving devices is infrastructured experiments we carried out, we present the results and
WiFi (IEEE 802.11), particularly in urban environments. discuss them in the scope of the referred use case.
785
C. ESP8266 power-saving modes the minutes-scale or more. Unlike the other two modes,
To reduce power consumption, the ESP8266 module the module cannot get into this mode automatically and
offers three sleep modes: Modem-sleep, Light-sleep and it must be forced by the user by explicit programming.
Deep-sleep. Table I summarises the properties of these In deep-sleep mode, the WiFi interface and CPU are
modes, which components they turn off, and the typical both turned off, including the system clock, and the
current consumption for the standalone module. connection to the WiFi AP is lost and must be re-
established upon waking up.
TABLE I: Sleep-modes - hardware level distinction and
typical current consumption stated in the datasheet [1]. D. Communication range
Despite the importance of low power consumption,
Item Modem-sleep Light-sleep Deep-sleep the communication is effective if within range, only, thus
WiFi interface OFF OFF OFF imposing a trade-off between communication range and
AP association Connected Connected Disconnec. transmission power. Studying this trade-off in detail is
System clock ON OFF OFF beyond the scope of this paper, but we are interested
in assessing the practical communication range in low
RTC ON ON ON
power indoor scenarios, as in a manufacturing plant.
CPU ON Pending OFF
The module features an on-board antenna which is
Substrate current 15 mA 0.4 mA ∼20 uA particularly suited to be embedded in small devices.
DTIM=1 16.2 mA 1.8 mA - These antennas present a rather non-uniform radiation
Aver.
pattern, with a toroidal geometry revolving around the
DTIM=3 15.4 mA 0.9 mA - module and the axis perpendicular to the antenna longi-
current
DTIM=10 15.2 mA 0.55 mA - tudinal direction [5].
Therefore, it is also important to assess the sensitivity
Modem-sleep is the default sleep mode and it is of the communication range with respect to the module
recommended for applications that need real-time CPU orientation to see whether sustained communication can
control. In this mode, the WiFi circuit is shut-down be achieved even when the module is moving freely.
while the other components remain on. Importantly, the
WiFi association to the network Access Point (AP) is III. E XPERIMENTS
maintained, thus avoiding the need to re-connect upon In this section we present the experiments that we
waking up and the respective high latency. Light-sleep carried out to perform a quantitative analysis of the
mode suits scenarios with less CPU requirements, in ESP8266 module stand-alone performance with distinct
which the application can also suspend the CPU, but scenarios and with different network configurations.
needs to communicate promptly. Thus the association
to the AP is also maintained as with Modem-sleep. A. Setup
Moreover, Light-sleep shuts down the system clock, The experiments were performed indoor in a labora-
relying on a real-time clock (RTC) to keep track of tory environment, with an ASUS RT-AC87U dual-band
time. Importantly, this mode suspends the CPU in DTIM AC240030 access point, using the default IEEE 802.11
periods in which there is no programmed task, only [2]. protocol. The ESP8266 module runs a FreeRTOS-based
Otherwise, because the CPU will be requested in the software framework [3] (version 1.2) that enables the use
meantime, it is kept active the whole interval, as with of any of the three reported sleep modes.
Modem-sleep (Figure 2). The current consumption in the different scenarios is
measured with the module powered up at 3.35V directly
DTIM DTIM DTIM DTIM DTIM by the Monsoon power monitor, from Monsoon Solu-
Timer Timer Timer Timer
tions Inc., with a sampling rate of 5000Hz. The current
traces contain two fields, namely the current samples and
the associated timestamps. Where convenient, the Y-axis
in the figures is truncated for better visualization.
Wi-Fi off Wi-Fi off
To better interpret the results we also perform packet
Wi-Fi and CPU off Wi-Fi and CPU off
captures in a monitoring computer running Ubuntu 16.04
Fig. 2: Limitations of the Light-sleep mode with active LTS with the wireless adapter (Intel Dual Band Wireless-
tasks in the system (the blue curve below represents the AC 7265) in monitor mode and we correlate these cap-
current consumption variation) - adapted from [2]. tures with the traces from the Monsoon power monitor.
In this setup we carry out the following experiments:
Finally, Deep-sleep is used in very low-power sensor • Impact of the WiFi infrastructure on the module
applications with data sampling / transmission periods in current consumption in Modem-sleep mode;
786
• Impact of the AP configuration (beacon interval and 80
Current (mA)
assuming a specific scenario and all sleep modes;
• Connectivity, received signal strength, packet deliv- 40
ery ratio and round-trip delay indoors. 30
60
500
40
450
20
400
300
100
The two different wake-up current consumption pat- 50
terns can be explained by different values in the TIM 0
0 10 20 30 40 50 60 70 80 90
bitmap control. Figure 4 shows the situation in which Time (ms)
the multicast bit is false indicating that the AP has no
buffered multicast traffic for delivery. Thus, the module Fig. 5: Current consumption when there are broad-
wakes up to receive and process the beacon frame, only, cast/multicast buffered frames at the AP.
787
C. Impact of the AP configuration that are activated during the DTIM period. In this case,
Since the stations in power-saving mode associated the CPU is not suspended. Figure 8 shows current traces
to an AP wake up every x beacons to receive the for the cases of 100ms (left) and 400ms (right) beacon
TIM (DTIM) and see whether there is any traffic for interval, with DTIM period of 3 in Light-sleep mode.
them, including broadcast/multicast traffic, pending in Both cases show the typical spikes at the DTIM occur-
the AP and retrieve it, the beacon interval and the rences, in some of which the module remains active for
DTIM period (x) impact the stations power consumption. approximately 90ms to retrieve pending traffic, with an
These parameters are configured in the AP and thus we average current consumption of 71.4mA, and then there
carried out a set of experiments to assess this impact is a plateau at 18.2mA corresponding to switching off
on the ESP8266 modules power consumption. As in the WiFi interface but not the CPU (similar to Modem-
the previous experiment, to evaluate the impact of the sleep) and another plateau at 0.85mA corresponding
beacon interval and DTIM period configurations, only, to switching off both the WiFi interface and the CPU
on the module power consumption, we measured the (95.3% reduction w.r.t Modem-sleep). However, longer
current consumption without any transmission of data intervals between DTIM indications increase the chance
for two modes of operation, namely Modem-sleep and that some task, including operating system services,
Light-sleep. We did not consider normal active mode requires activation in that interval, preventing the CPU
because it keeps the WiFi interface on all the time, suspension. It is also more likely, with such longer
neither Deep-sleep mode because it does not maintain intervals, that there will be pending traffic in the AP
wireless connectivity and thus AP beacons are ignored. to be retrieved by the module when a DTIM comes.
In particular, we consider two different experiments for D. Impact of data transmission
each of the referred modes:
This set of experiments aimed at assessing the power
• Beacon interval variation from 100 to 1000ms, consumption performance of the ESP8266 module in an
in steps of 100ms, while maintaining the DTIM IIoT use case as that referred in Section I, in which
interval fixed at 3 (Fig. 6); the module (smart tag) had to recurrently transmit a
• DTIM period variation from 1 to 10, in steps of product data record. We consider a simplified record with
1, while maintaining the beacon interval fixed at 85B of data containing information about the product,
100ms (Fig. 7). timestamps and state of relevant production steps and
Both experiments showed that, in Modem-sleep mode, other operational information. Then, we measured the
the module can indeed reduce current consumption by current consumption for all four possible modes of
setting the beacon interval or the DTIM period to larger operation: Active, Modem-sleep, Light-sleep and Deep-
values, taking advantage of the longer available time to sleep modes. We do not consider any attached sensors,
maintain the WiFi interface off. Curiously, a different be- actuators or signalling devices to remove this common
haviour was observed in Light-sleep mode, with the cur- factor from the measurements. To assess the impact of
rent consumption increasing with larger beacon intervals the transmission frequency on the power consumption,
or DTIM periods. Figure 6 also shows that, at a beacon we use two different cases, namely the transmission of
interval of 700ms and higher the current consumption 1 record (85B) every 1s and the transmission of 10
in Light-sleep converges to that of Modem-sleep. This records together (850B) every 10s. These two cases are
effect was already explained in Section II, due to tasks repeated for all execution modes with the exception of
24 30
Modem-sleep Modem-sleep
23 Light-sleep 28 Light-sleep
22
26
21
Average current (mA)
24
20
19 22
18 20
17
18
16
16
15
14 14
13 12
100 200 300 400 500 600 700 800 900 1000 1 2 3 4 5 6 7 8 9 10
Beacon period (ms) DTIM
Fig. 6: Average current consumption varying the beacon Fig. 7: Average current consumption varying the DTIM
period between 100ms and 1000ms, DTIM fixed at 3. period from 1 to 10, beacon period fixed at 100 ms.
788
100 100
90 90
80 80
70 70
Current (mA)
Current (mA)
60 60
50 50
40 40
30 30
20 20
10 10
0 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
Time (s) Time (s)
Fig. 8: Current trace with beacon interval of 100 ms and DTIM 3 (left) and beacon interval of 400 ms and DTIM
3 (right), in Light-sleep mode.
100
the Deep-sleep mode for which the 1s period could not
be implemented due to the time required to re-establish
the WiFi connection. 80
789
F
D G
17 m
Position 1 Position 2 Position 3 Position 4 E C
-40 42 m
Position 1
Position 2
Position 3
Fig. 12: Places in the building where we tested the limits
-45
Position 4 of connectivity with the ESP8266 module.
-50
RSSI (dBm)
-55
positioned consecutively on the landmark represented by
the letters. Landmark ’A’, ’B’ and ’C’ are inside the
-60 room and are equidistants (3m apart). The remaining
landmarks explore situations of interest or extremes: ’D’
-65 is separate of the source by a wall, ’E’ to ’G’ are in
maximum distance (in multiple directions) and ’G2’ is
-70
1 2 3 4 5 6 7 8 the same place as G, but on the floor below.
Distance (m)
These experiments were carried out using the ping
Fig. 11: RSSI measurements for different module posi- command, with 100 packets per point and 85B data
tions and distances to the receiver. payload, issued by a monitoring station running Ubuntu
16.04 LTS and connected to the AP via an Ethernet
100Mbit/s link, having the ESP8266 module as desti-
distances varying from 1 to 8m from a receiver (our nation. This way, there are only two transmissions in
monitoring station) in line of sight. Moreover, given the the wireless medium, namely the ping request by the
expected non-uniform radiation pattern of the module AP and the ping response by the module.
built-in antenna (see Section II-D), for each distance Figure 13 shows the distribution of the RTD measure-
point we measured the RSSI with four different module ments, with letters A, B, C, D, E, F, and G corresponding
positions as shown in Figure 10. to the places marked in Figure 12. As expected, the
For each distance and orientation we gathered 60 RSSI measurements at places A, B, C and D show similar RTD
data points. Figure 11 plots the respective average RSSI results with a mean (and median) of 6.80 (4.07), 11.54
values. For distances of 4m and larger, we can observe (4.10), 9.01 (4.06) and 9.76 (4.34) ms, respectively. On
the typical RSSI large variations in indoor environments the other hand, as the distance from the access point and
caused by multipath and other interferences. Accord- the number of traversed walls increases, the number of
ing to the theoretical radiation pattern of the built-in Wi-Fi retransmissions also increases leading to a clear
antenna [5], without multipath interference we would extension of the RTD. At places E, F, G and G.2 we
expect position 2 to be the most favourable, then 4, get an RTD mean (and median) of 11.87 (4.8), 14.08
followed at similar levels by 1 and 3. Position 2 does (5.36), 15.95 (6.00) and 30.87 (15.3) ms, respectively.
perform better in our measurements, and positions 1 Moreover, with the default configurations of the module,
and 3 perform similarly. However, position 4 performs the PDR was 100% at positions A, B, C, D, E and F,
worse than expected, which can be due to multipath since all losses could be recovered with retransmissions.
interference, which impacts the four positions differently. At places G and G.2 this was not always the case, with
Most importantly, the RSSI values in all cases are within the PDR decreasing to 99% and 79%, respectively.
typical ranges for good reception, varying from an over-
all average of −52.9dBm for position 2 to −57.3dBm, IV. C ONCLUSION
−57.3dBm and −58.4dBm for positions 1, 3 and 4, Given the prevalence of WiFi at the Internet borders,
respectively. the use of WiFi-enabled devices can bring a leap forward
2) Connectivity limits: In order to assess the practical in the development of the Internet of Things in spaces
range of operation of the module in an indoor scenario where WiFi infrastructures exist, including in manufac-
we measured the PDR and the RTD in several places in turing. However, size, cost and autonomy issues, among
a building, some in line of sight and other with concrete other idiosyncrasies, have prevented developing such
and brick walls in between (Figure 12). WiFi-enabled devices. Recently, technological advances
A monitoring station was placed in the position rep- in processor design have opened the way to modules that
resented by the wireless tower symbol and the ESP8266 integrate WiFi interfaces with mid-range processors and
790
55
R EFERENCES
50
[1] Espressif Systems, ESP8266 WiFi module, https:
45
//www.espressif.com/sites/default/files/documentation/
40 0a-esp8266ex datasheet en.pdf.
[2] Espressif Systems, ESP8266 Low Power Solutions,
Round-trip time (ms)
35
https://www.espressif.com/sites/default/files/9b-esp8266-low
30 power solutions en 0.pdf.
25 [3] Espressif Systems, ESP8266 RTOS SDK, https://github.com/
espressif/ESP8266 RTOS SDK.
20
[4] Espressif Systems, ESP32 Datasheet, https://www.espressif.com/
15 sites/default/files/documentation/esp32 datasheet en.pdf.
10
[5] STMicroelectronics, Low cost PCB antenna for 2.4GHz radio:
Meander design, AN3359 Application note, March 2011.
5
[6] R. Amornpornwiwat, P. Piyachat, V. Chawathaworncharoen,
0 V. Visoottiviseth and R. Takano, ”MATEMA6: Machine Tele-
A (3 m) B (6 m) C (9 m) D (10 m) E F G G.2
Position
Monitoring Assistance with 6LoWPAN,” 5th ICT International
Student Project Conference (ICT-ISPC), pp. 49-52, Nakhon
Fig. 13: RTD measurements distribution. Pathom, Thailand, 2016.
[7] F. Astudillo-Salinas, D. Barrera-Salamea, A. Vzquez-Rodas
and L. Solano-Quinde, ”Minimizing the power consumption in
Raspberry Pi to use as a remote WSN gateway,” 8th IEEE
which offer effective sleep modes to enable low duty- Latin-American Conference on Communications (LATINCOM),
cycle operation. This is the case of the ESP8266 module Medellin, Colombia, 2016.
[8] Gianluca Cena, Stefano Scanzio and Adriano Valenzano, ”Ex-
from Espressif Systems available for very low prices perimental Characterization of Redundant Channels in Industrial
(few USD). Nevertheless, a detailed characterization of Wi-Fi Networks”, World Conference on Factory Communication
this module energy consumption and communication Systems (WFCS), Aveiro, Portugal, 2016.
[9] A. D. Deshmukh and U. B. Shinde, ”A low cost environment
range was not available until now, to the best of the monitoring system using raspberry Pi and arduino with Zigbee,”
authors knowledge. International Conference on Inventive Computation Technologies
In this paper we showed how the automatic interaction (ICICT), Coimbatore, India, 2016.
[10] N. Kajikawa, Y. Minami, E. Kohno and Y. Kakuda, ”On Avail-
with the WiFi infrastructure and its configuration in ability and Energy Consumption of the Fast Connection Es-
terms of beacon interval and DTIM period affects the tablishment Method by Using Bluetooth Classic and Bluetooth
power consumption and the effectiveness of the sleep Low Energy,” 4th International Symposium on Computing and
Networking (CANDAR), pp. 286-290, Hiroshima, Japan, 2016.
modes. Curiously, the typical AP configuration of 100ms [11] N. B. Long, H. Tran-Dang and D. S. Kim, ”Energy-aware Real-
beacon interval and DTIM period of 3 yields the lowest time Routing for Large-scale Industrial Internet of Things,” in
average current consumption for the WiFi infrastructure IEEE Internet of Things Journal, 16 April 2018.
[12] C. Pereira, D. Guimarães, J. Mesquita, F. Santos, L. Almeida
(14.71mA) using the Light-sleep mode, which keeps the and A. Aguiar, ”Feasibility of Gateway-less IoT E-health Appli-
AP association. We also saw how data transmissions and cations,” 27th European Conference on Networks and Commu-
sleep modes affect power consumption in the scope of nications (EuCNC), Ljubljana Slovenia, June 2018.
[13] R. A. Rashid, M. R. B. Resat, M. A. Sarijari, N. H. Mahalin,
an example IIoT application. When transmitting in the M. S. Abdullah and A. H. F. A. Hamid, ”Performance investi-
seconds-scale, the module can operate consecutively for gations of frequency agile enabled TelosB testbed in Home area
2 to 4 days from a small 1000mAh battery. Finally, we network,” 2nd IEEE International Symposium on Telecommuni-
cation Technologies (ISTT), pp. 335-340, Langkawi, Malaysia,
verified that the ESP8266 module offers good connec- 2014.
tivity within a common building deployment, showing ach Shelby and Carsten Bormann, ”6LoWPAN: The wireless
packet delivery ratios of 99% or higher in the same floor, embedded Internet - Part 1: Why 6LoWPAN?” EE Times, 23
May 2011.
but still usable across floors. [14] P. Spachos, Liang Song and S. Gregori, ”Power consumption of
Future work will assess the module performance dur- prototyping boards for smart room temperature monitoring,” 22nd
IEEE International Workshop on Computer Aided Modelling
ing handovers as well as with Direct WiFi configuration, and Design of Communication Links and Networks (CAMAD),
in softAP and station/softAP combined modes, which are Lund, Sweden, 2017.
required for non-infrastructured use cases as in process [15] C. S. Stangaciu, M. V. Micea and V. I. Cretu, ”Energy efficiency
in real-time systems: A brief overview,” 8th IEEE International
control. Symposium on Applied Computational Intelligence and Infor-
matics (SACI), pp. 275-280, Timisoara, Romaina, 2013.
ACKNOWLEDGMENT [16] D. M. Tung, N. Van Toan and J. G. Lee, ”Exploring the current
consumption of an Intel Edison module for IoT applications,”
This work was funded by Instituto de Telecomunicaes, IEEE International Instrumentation and Measurement Technol-
ref. UID/EEA/50008/2013, and by project NanoSTIMA ogy Conference (I2MTC), Turin, Italy, 2017.
[17] Y. M. Yusof, A. K. M. M. Islam and S. Baharun, ”An experimen-
– Macro-to-Nano Human Sensing: Towards Integrated tal study of WSN transmission power optimisation using MICAz
Multimodal Health Monitoring and Analytics, NORTE- motes,” International Conference on Advances in Electrical En-
01-0145-FEDER-000016, supported by Norte Portu- gineering (ICAEE), pp. 182-185, Dhaka, Bangladesh, 2015.
gal Regional Operational Programme (NORTE 2020),
through Portugal 2020 and the European Regional De-
velopment Fund.
791