Estimation of the carbon footprint of IoT devices based on ESP8266 microcontrollers

. The development of the Internet of Things contributes to improving network protocols and increasing the requirements for energy efficiency of devices. In the field of the Internet of Things and automation systems, one of the most popular microcontrollers is the ESP8266. This article discusses the leading Internet of Things connection protocols based on ESP8266, such as ESP-NOW, HTTP, and ESP-MESH. The study of the power consumption of this microcontroller in various situations and describes the optimal applications of IoT based on ESP8266. The correct choice of communication means of the ESP8266 microcontroller allows you to reduce its power consumption by more than 10% relative to energy-intensive communication algorithms. Compared to the power-intensive MESH network, the reduction in power consumption when using the HTTP protocol is 3.34%, and the percentage of energy-consuming events drops by 50.85%. When using ESP-NOW, energy efficiency increases by 5.35%, and the number of energy-consuming events decreases by 83.05%. The value of the carbon footprint generated by the device during the year was, for the three communication technologies used, 2 kg 500 g, 2 kg 320 g, and 2 kg 290 g of CO2, respectively.


Introduction
The increasing and widespread use of internet of things (IoT) devices make us think about the extent of their impact on forming the carbon footprint and considering ways to reduce it. On the one hand, a significant number of researchers show that the use of devices contributes to reducing the carbon footprint by optimizing the operating modes of various household, industrial or agricultural equipment [1][2][3][4]. On the other hand, few people think about the size of the carbon footprint generated by the IoT devices themselves. In a modern apartment, the number of IoT devices can be dozens, and in a cottage or country house -up to a hundred. Thus, the negligible power consumption of a single device scales, and in general, can have a noticeable impact on the formation of a personal carbon footprint. On the scale of a manufacturing enterprise operating hundreds and thousands of IoT devices [3], the amount of carbon footprint about them can become significant.
The study aims to assess the impact of the software and operating modes of IoT microcontrollers on the value of energy consumption and, accordingly, the formation of the carbon footprint of the device.

Methods and materials 2.1 Physical organization of measurements
The object of the study is the Wemos D1 mini board with the ESP8266EX microcontroller.
[5] The most common modification of this board contains a 4-8 megabyte flash memory model (W25Q80/25Q32ASS1G) with a rated consumption current of 4 mA. Modules with smaller memory (for ex., ECT25S80) are not considered in this article, but their power consumption will be similar and will not exceed 10 mA.
The experimental measurements were carried out in the normal operation mode of the ESP8266EX controller, without the use of power-saving modes. The measurement scheme is shown in Fig. 1.
A module based on the INA219 chip performed the task of converting the voltage drop on the shunt resistor into the current consumed. The data was collected by measuring the voltage drop on the shunt resistor. The shunt resistor was built into the sensor board, with a resistance of 0.1 Ohms and an accuracy of 1%. The resistor is included in the power supply circuit of the ESP8266 microcontroller. The sensor-polling period is 400 microseconds. The measured and digitized data is transmitted via the I2C bus to the Arduino Nano microcontroller and then via the serial port to the computer. The Keysight E3649A certified laboratory power supply is used as the power source.
The INA219 chip has a configurable range of electric current measurements. Based on the maximum current consumption of the ESP8266 microcontroller [20, p.20], to improve the measurement accuracy, a range of 400mA was selected. The total measurement error is about 2% (8mA).

ESP-MESH
When organizing an extensive network with homogeneous devices and high requirements for the degree of autonomy of maintaining a network connection, it is necessary to turn to the ESP-MESH technology. [6] The most complex algorithm organizes the communication of devices with this protocol. The standard architecture of a Wi-Fi network is a multipoint network in which there is a central node (access point) and stations. In MESH networks, there is no need for a single node, and the load is distributed evenly over the entire network. Thus, this technology allows you to organize communication with the maximum possible number of network devices in one network. The main parameters required for organizing an autonomous network are: RSSI; the preferred parent node parameter; the routing table; network propagation restriction; point tracking in the network; the loopback exclusion parameter; and the connection recovery algorithm. [7][8]. Thus, the system needs to analyze a large amount of data about the state of the network and constantly access the network part of the chip, which is the most energy-consuming.

ESP-NOW
ESP controller communication technology was developed and released by Espressif Systems in 2016 [9]. This technology eliminates the procedures associated with Wi-Fi support and speeds up the process of exchanging data packets. The data transfer rate is not more than 1 MB per second. To start communication, only the first connection is required, after which the link is not broken. It is the simplest data exchange protocol on this controller and has the most extended stable connection range. Packets have a small size, up to 250 bytes of helpful information. There is also a limited number of devices in the network, up to 20 pairs. The ESP-NOW network is very flexible in configuring and allows organizing both unidirectional and bidirectional connections between pairs of devices.

HTTP
The last microcontroller communication protocol under consideration will be HTTP. This protocol involves the configuration of the network in the form of a client-server. During the operation of this type of device connection, all processes related to Wi-Fi are turned on. The microcontrollers work alternately or simultaneously in two modes: an access point and a station for connecting to the server or working with clients, respectively. When organizing two-way communication, the GET request method was used as the simplest. Thus, the devices used need to process requests and maintain a local network with all Wi-Fi procedures.

Bidirectional MESH connection
For this experiment, the painlessness library was used [link]. For the purity of the investigation, we simplified the task as much as possible. The protocol once a second transmitted packets between devices with a payload in the form of a string: "123.1 35". All debugging functionality of the program is disabled for accurate measurements of power consumption [6].

Bidirectional connection over the ESP-NOW network
Like the previous experiment, we are working with a payload in the form of a string: "123.1 35". All debugging functions and third-party procedures are disabled [9].

Bidirectional connection with HTTP protocol
The data is received and sent by the GET method. The payload is the same, but now the microcontrollers need to use resources to work with Wi-Fi. The program structure is simplified as much as possible [10].

Results and discussion
The experiments were conducted on the Laboratory of Local Automation and Embedded Systems of the Department "Automation of Production Processes", Don State Technical University.  The current is consumed unevenly, and the overall picture of current consumption in standby mode is overlaid with bursts (events) associated with the activation of the module. At such moments of high consumption, the most energy-consuming procedures occur: connecting to Wi-Fi, starting the server or connecting to it, updating the connection, and so on [6].

Bidirectional MESH connection
For the analysis, these events were converted into a binary sequence at the level of 30% of the maximum current, as shown in Figure 5. The number of events during the measurement period is taken as one of the characteristics of the technology activity. During the experiment, 59 events were detected.

Bidirectional connection over the ESP-NOW network
The following graph shows the time characteristic of the current:  During the experiment, only ten complex events in the operation of the microcontroller were detected.
Analyzing the current consumption with the ESP-NOW protocol, we determine that the average power consumption is 2.07 mW.  Consumption increased with the increase in the number of events, which amounted to 29 events during the measurement period. Analyzing the current consumption using the HTTP protocol, we determine that the average power consumption is 2.11 mW.

The analysis of the obtained experimental results
Immediately it is worth noting that the controllers worked most effectively with the ESP-NOW protocol. This protocol caused the least number of complex events and had stability with a predominant average consumption of 86 mA. This protocol is ideal for continuous monitoring and management in the field of the Internet of Things with maximum energy efficiency [11][12][13]. What is most important is the ability to use the HTTP protocol in parallel with ESP-NOW. The main scope of this protocol is small automation systems and smart home systems, where the number of devices is no more than 50.
The HTTP protocol is an excellent alternative to ESP-NOW due to its high popularity and good energy efficiency compared to complex MESH network protocols. However, the network structure is becoming standard for Wi-Fi networks, which limits the number of devices. With a high network load, the power consumption of microcontrollers increases, and the risks of connection loss and network destruction increase [7,9,10].
The ESP-MESH protocol uses almost all the resources of the ESP8266. A complex network topology requires constant monitoring of the surrounding devices, which leads to high power consumption [14][15]. However, the reliability of such a network is very high. Nodes are self-healing and can form large networks of 100 or more devices. But this all affects the performance of the controller. Fig. 13. Comparison of the results obtained for the regular operation of the microcontroller.

The approximation of experimental results to energy-saving operating modes
To estimate the energy gain and reduce the carbon footprint, we calculate the possible reduction in energy consumption due to the use of energy-saving operating modes of the ESP8266EX microcontroller. According to [16], the controller supports three power-saving modes (Modem sleep, Light sleep, and Deep sleep), during which the quiescent current consumption is reduced to 15 mA, 0.4 mA, and 15 µA, respectively.
For the experimental data presented in Fig. 4, 7, 10, while maintaining the current values during the events, the quiescent current in the normal mode was replaced by the corresponding current in the energy-saving mode, and the average power consumption was calculated ( Table 1). The results show both a radical decrease in the total power consumption during the transition from normal mode to deep sleep mode and an increase in the share of the influence of the number of events on the total power consumption. For a visual assessment of the carbon footprint that forms each of the IoT devices in different operating modes, the energy consumed and the equivalent amount of CO2 during continuous operation of the device during the year are calculated ( Table 2). [17][18] The energy equivalent of CO2 is taken as 0.325 kg/kWh [1]. A slash in the Carbon eq graph indicates the percentage of the maximum carbon footprint generated in regular operation with ESP-MESH technology. Based on the results obtained, it follows that due to the use of deep energy-saving modes, and optimal communication technology, it is possible to reduce the carbon footprint of an IoT device based on ESP8266SX controllers to 0.08% of the nominal modes, that is, more than 1000 times.

Conclusion
This study's analysis helps determine the most effective communication tools for devices when organizing the Internet of Things or when creating embedded automation systems with network support. We get the maximum energy efficiency when organizing ESP-NOW networks, and their combination with the HTTP protocol allows us to expand the network area covering [10]. The use of the MESH network protocol on the ESP8266 microcontrollers has many disadvantages. The main area of application of these systems is a small area mesh network covering up to 500 m2. This corresponds to about 100 microcontrollers, and a larger number of them leads to a greater load on the network and individual nodes. At the same time, the high power consumption of the ESP8266 with the ESP-MESH protocol requires more capacious autonomous power sources.
When using the HTTP protocol, the reduction in power consumption is 3.34%, and the percentage of energy-consuming events drops by 50.85%. Also, with HTTP, the peak values of the consumed current are reduced by 5.39%. When using ESP-NOW, energy efficiency increases by 5.35%, and the number of energy-consuming events decreases by 83.05%. At the same time, the peak values of the consumed current decreased by 10.59%. The value of the carbon footprint generated by the device during the year was, for the three communication technologies used, 2 kg 500 g, 2 kg 320 g, and 2 kg 290 g of CO2, respectively.