network requires an analysis of power consumption. Due to the limited ... collect the weather data. The gateway node ..... The MagPi, march 2016. [11] Raspberry.
Minimizing the Power Consumption in Raspberry Pi to use as a remote WSN Gateway Fabián Astudillo-Salinas, Daniela Barrera-Salamea, Andrés Vázquez-Rodas, Lizandro Solano-Quinde Departamento de Eléctrica, Electrónica y Telecomunicaciones (DEET) Universidad de Cuenca Cuenca, Ecuador 010150 Email: {fabian.astudillos, daniela.barrera, andres.vazquezr, lizandro.solano}@ucuenca.edu.ec
Abstract—The reliability of Raspberry Pi minicomputer as a remote gateway in a wireless sensor network requires an analysis of power consumption. Due to the limited energy conditions, when a station is powered by a photovoltaic system, it is essential to reduce its energy consumption to maximize the lifetime of the network. This paper presents a comparative analysis of Raspberry Pi power consumption profile under multiple settings: reduced hardware elements, installation of different operating systems and, downclock CPU (700 M Hz to 100 M Hz), SDRAM (400 M Hz to 100 M Hz) and GPU (250 M Hz to 50 M Hz) units. Based on the results, the energy consumption is reduced up to 20% which is equivalent to a saving of 0.25 W . The minimum Raspberry Pi power consumption reached is 0.97 W .
I. Introduction PROMAS1 monitors a wealth of environmental information regarding wind, rain, temperature, humidity, and barometric pressure. For this, around 130 remote weather stations have been deployed in a large area of Azuay, Cañar and Chimborazo. Currently, a research team is working on the design and implementation of a wireless network to gather the sensors information and transmit it to the PROMAS data center. The goal is to take advantage of the wireless technologies to reduce the displacement of people in charge of downloading the data at the sensor location. This, consequently, will maximize the availability of weather information in an hour-based transmissions, reduce the risk of losing information, and diminish the mobilization expenses to use that budget only for maintenance purposes. The described project requires the implementation of a station with a gateway role. It will behave as the coordinator in a ZigBee [1] mesh network. Such coordinator must perform the following functions: to keep periodic communication with all the remote stations, to carry out synchronization tasks, to manage the network and to collect the weather data. The gateway node will also be equipped with the required hardware to establish a WiFibased [2] long distance point-to-point link. Its aim is to 1 PROgrama
para el Manejo del Agua y del Suelo
establish a communication backhaul with the PROMAS facilities. For this gateway node, a device capable of interfacing between the two referred networks is needed. Therefore, the use of a Raspberry Pi (RPi) mini-computer is evaluated since it meets these network requirements, and it provides an easy and fast implementation of the gateway. The proposed design for the gateway station is shown in Figure 1. Due to the energy constraints of a remote station, this gateway node must keep a low power consumption. It is powered by a photovoltaic system limited by the sun hours availability and the batteries capacity. Then, the problem to analyse is the reliability of using the RPi under a limited energy supply, and the strategies to reduce the energy consumption of this device in order to maximize the node lifetime. Knowing there are not required computationally intensive applications. In this context, the main contribution of this work is a comparative study of RPi power consumption under different scenarios to evaluate its feasibility as a remote gateway. The rest of this paper is structured as follows. Related work on RPi power consumption is discussed in Section II. Section III describes basic information about the minicomputer, the sensor used for measurements and the test scenarios. The evaluation results are shown in Section IV. Finally, Section VI provides conclusions and future work. II. Related Work There is a limited amount of reported work regarding techniques to minimize the power consumption of the RPi minicomputer that is available. For instance, a power consumption mathematical model for RPi has been developed in [3], a comparative analysis with commercial sensor node platforms is presented in [4] and diverse literature has been published detailing the widespread uses of this device including some sensor node applications [5], [6]. The work on [3] focuses on developing a PowerPi mathematical model. For this, the authors measure the power states of the RPi with different CPU and network loads. It allows to estimate a power consumption value with an error range lower than 3.3% and the authors claim that
c 978-1-5090-5137-3/16/$31.00 2016 IEEE
Zigbee Transmitter
WiFi Transmitter RPi
Solar Panel Charge Controller
Battery Fig. 1. Gateway Node Design
it can produce an optimization of the energy consumption by varying the RPi software load. A comparison of RPi characteristics and constraints with some sensor nodes hardware is performed in [4]. Authors assert that the RPi is a perfect platform with PC’s advantages to act as sensor or controller node in a Wireless Sensor Network (WSN). Nevertheless, the power consumption is identified as the main disadvantage of this device among the other platforms. In [7] is presented a detailed comparison among RPi and other available Internet of Things (IoT) devices, demonstrating that RPi has a better performance considering computing workload, size and cost. A similar analysis is discussed additionally in [8]. It exhibit a current consumption comparison between different IoT platforms, being the RPi one of the most energetically expensive equipment. A sensor network for environmental monitoring with RPi board as the main node is described in [5], [6]. However, the power supply was not a limitation for these applications because they were not deployed on remote locations. Thus, a power consumption analysis is not carried out. Overall, the RPi is acknowledged as a fully customizable and programmable computer board. This device interfaces with many different external peripherals and has essential network capabilities as a gateway node. However, its major disadvantage is its energy consumption compared to other platforms. III. Methodology The approach to minimize the RPi energy consumption involves the analysis of its behaviour under different hardware and software settings: minimizing the peripherals connected to it, installing different operating systems and down-clocking its CPU, SDRAM and GPU units. To profile its energy consumption, physical measurements were completed with an external current sensor. This section describes the device under test, the current sensor, and the evaluation scenarios. A. Device under test The RPi is a cheap, powerful, general-purpose computer board. It is a platform used for many applications: from
controlling different hardware devices with Python, up to developing games or using it as a media-center or web server [9]. There are different RPi models commercially available, and the last one to be released was the RPi 3 which has the highest performance but draws more power compared to other models [10]. To this assessment, the model Raspberry Pi B+ V1.2 has been tested, and its technical specifications are summarized on Table I. The RPi’s processor is a Broadcom BCM2835 System-on-Chip (SoC). It is designed to run a Linux Operating System (OS) that needs to be flashed on to a SD card. Several Linux distributions have been modified to run on this minicomputer with different features depending on the target application [11]. The General Purpose Input/Output (GPIO) port allows the RPi to interface with other hardware devices. It supports I2C, Serial and SPI communication protocols, but it lacks of A/D converters. The basic electrical specifications for the power source are to supply a regulated 5V DC and a current of 1A [9]. TABLE I RPi Technical Specifications Description SoC
Broadcom BCM2835
CPU
ARM1176JZF-S
GPU
VideoCore IV
RAM
512M B
Networking Storage
10/100 Ethernet microSD
GPIO
40−pin header
Ports
HDMI, 3.5mm analogue audiovideo Jack, 4 × U SB 2.0, Ethernet, Camera Serial Interface, Display Serial Interface
B. Hardware data acquisition system An accurate estimation of the RPi’s power consumption can be obtained using an external current sensor. The M AX471 sensor module that measures instantaneous current consumption is used for this analysis. The sensor is inserted interrupting the power lines of the USB connection in the 5V line, as shown in Figure 2. The sensor’s maximum measured current is up to 3A, it endures 3V − 36V input voltages and draws less than 100µA. The output voltage conversion factor is 1V /A ±2.5% for a fullscale value of +3V at ±3A. That means that for a 200 mA current draw the output voltage is 200 mV [12]. To digitalize the measured values, an Arduino UNO board is used, it is based on easy-to-use hardware and software. This board allows to read an analogue input from any sensor and convert it to a digital value just by sending a few instructions to the microcontroller [13]. With the Arduino’s 10 bits A/D converter and selecting a reference voltage of 1.1V , it is possible to measure a few mV with an accuracy of 1 mV . Parallel, with a reference voltage of 5V
Source USB
EXT
MAX471 AREF GND L
ICSP
PWR
1
3 2 1 0 9 8 7 6 5 4 3 2 1 0 1 1 1 1 DIGITAL
ADRUINO
ANALOG IN 0 1 2 3 4 5
www.adruino.cc
GND
RPi
RESET 3V3 POWER 5V Gnd Vin
-
+
TX RX
+
TX RX
Arduino
P♦✇❡r ❈♦♥s✉♠♣t✐♦♥ ✭W ✮
PWR SEL
✶✳✷ ✶ ✵✳✽ ✵✳✻ ✵✳✹ ✵✳✷ ✵
Fig. 2. Current Sensor Circuitry
in the Arduino, the input voltage in the RPi is measured with an accuracy of 4.8 mV .
C. Evaluation Scenarios Different test scenarios were established to analyse the feasibility of the RPi’s usage as an isolated station. First of all, the connection of external peripherals as screen, keyboard and mouse results unnecessary since the RPi is controlled through a SSH connection. Thus, the current draw from these elements is discarded. The next approach is a comparative analysis of power consumption from the RPi running four different Linux distributions: •
•
•
•
Raspbian, a free operating system based on Debian. It is optimized for best performance RPi hardware, and offers more than 35000 packages and pre-compiled software on an easy to install format[11]. Raspbian LITE, a minimum OS image based on Debian Jessie, without X server and its installed components. It requires less disk space and it can run from a smaller SD card [11]. PiCore, a Tiny Core Linux distribution modified for RPi that runs entirely in RAM. It only has a command line interface (CLI), and it offers a set of tools to create a customized system [14]. Pidora, a Linux distribution for RPi from Fedora [15].
With each of the mentioned OSs, a number of system configurations has been tested. On Test 1, the device current draws have been measured on idle default state and after powering off. Also, disconnecting peripherals supposes to reduce the power consumption, thus, measurements were performed after disabling the HDMI port and disconnecting the Ethernet cable. Further, the RPi behaviour has been compared varying the clock settings of the system: SDRAM frequency was varied on Test 2, GPU frequency on Test 3, and CPU frequency on Test 4. Each set of measurements were performed without any additional computing workload in the RPi, during 10 minutes with a rate of 10 samples per second. That means a total of 600 values per minute that were averaged to compare them with the results from the different OSs.
■❉▲❊
❊❚❍❊❘◆❊❚ P❖❲❊❘❖❋❋ ❍❉▼■ ❆❯❉■❖ ❉■❙❈❖◆◆❊❈❚❊❉ ❉■❙❆❇▲❊
▲✐t❡ P✐❞♦r❛
P✐❝♦r❡ ❘❛s♣❜✐❛♥
Fig. 3. RPi Power Consumption - Test 1
IV. Results A custom built software constantly acquires the measurements from the Arduino device, and it stores the data with a time-stamp. To calculate the power consumption (P pi), the output current (Is) from the sensor is multiplied by the voltage (V l) of the 5V line. P pi = Is ∗ V l
(1)
A. Test 1 - Energy consumption by OSs On Test 1, the computation of RPi power consumption running the different OSs on idle state was performed. As shown on Figure 3, Raspbian Lite and Pidora distributions, without any computational intensive load or system modification, exhibit the lower energy consumption compared to the other OSs, with 1.22 W . The main power consuming elements are peripherals, as shown on Figure 3. After disabling the HDMI controller, a reduction of approximately 8% on power consumption was obtained with all OSs. By disconnecting the Ethernet cable from the port an average of 19% saving was measured. This is because some hardware components are no longer used and automatic network recognition is not carried out. However, the Ethernet cable is needed in the gateway node to connect the WiFi router and to allow the long distance point to point link. Thus, it can not be disconnected to save energy. After powering off the RPi, and without disconnecting the USB power cable, there was a constant energy consumption of approximately 0.3 W . Therefore, if the RPi is awake just on certain time lapses, when it is shut down the power consumption mentioned will remain as a constant load to the batteries. This is shown on Figure 3, where it can be seen a reduction of 78%. B. Test 2 - Down-clocking SDRAM unit To get extra performance out of the RPi, users overclock the frequency parameters to get higher speeds without compromising stability. However, more work supposes
✶✳✷✵
✶✳✶✺
✶✳✶✺
P♦✇❡r ❈♦♥s✉♠♣t✐♦♥ ✭W ✮
P♦✇❡r ❈♦♥s✉♠♣t✐♦♥ ✭W ✮
✶✳✷✵
✶✳✶✵ ✶✳✵✺ ✶✳✵✵ ▲✐t❡ P✐❞♦r❛ P✐❝♦r❡ ❘❛s♣❜✐❛♥
✵✳✾✺ ✵✳✾✵
100
150
200
250
300
350
✶✳✶✵ ✶✳✵✺ ✶✳✵✵ ▲✐t❡ P✐❞♦r❛ P✐❝♦r❡ ❘❛s♣❜✐❛♥
✵✳✾✺ ✵✳✾✵
400
50
100
❙❉❘❆▼ ❋r❡q✉❡♥❝② ✭M Hz ✮
150
200
250
●P❯ ❋r❡q✉❡♥❝② ✭M Hz ✮
more energy, thus, it has been applied the opposite approach reducing clock speeds to assess the power consumed by RPi under minimum conditions. Table II shows the default clock settings established to RPi. TABLE II Default RPI’s clock settings Description
Default value (MHz)
Sdram_freq
SDRAM frequency
400
Gpu_freq
GPU frequency
250
Arm_freq
ARM processor frequency
700
On Test 2, the input RPi configurations correspond to the settings that exhibit the best results on the previous test. That is, the HDMI controller was disabled, the default GPU and ARM parameters were kept, and only the SDRAM frequency was reduced from 400 M Hz down to 100 M Hz, in steps of 50 M Hz. A maximum 10.7% saving has been obtained with Pidora OS and with a frequency of 100 M Hz, as shown on Figure 4. The distributions, Raspbian and Raspbian Lite had a similar behavior, because they reached their highest energy saving of 9.3% and 9.8% respectively, with a 100 M Hz frequency. However, on Test 2, the current draw behavior was not always decreasing with a lower frequency. Actually, Picore OS exposed an opposite performance on 100 M Hz frequency. Its power consumption increased when the SDRAM frequency was reduced. C. Test 3 - Down-clocking GPU unit On Test 3, the 100MHz SDRAM configuration was used (best result on Test 2 ), and just the GPU frequency has been changed. After computation, a significant energy consumption difference between 250 M Hz and 50 M Hz can be conclude (Figure 5). However, Picore and Pidora distributions did not boot under a GPU frequency of 50 M Hz. Thus, they could not be tested in that setting. A 100 M Hz frequency is selected for analysis and as a fixed parameter
Fig. 5. GPU Frequency vs. Power Consumption - Test 3 ✶✳✷✵
P♦✇❡r ❈♦♥s✉♠♣t✐♦♥ ✭W ✮
Fig. 4. SDRAM Frequency vs. Power Consumption - Test 2
✶✳✶✺ ✶✳✶✵ ✶✳✵✺ ✶✳✵✵ ▲✐t❡ P✐❞♦r❛ P✐❝♦r❡ ❘❛s♣❜✐❛♥
✵✳✾✺ ✵✳✾✵
100
200
300
400
500
600
700
800
900 1000
❈P❯ ❋r❡q✉❡♥❝② ✭M Hz ✮
Fig. 6. ARM Frequency vs. Power Consumption - Test 4
for Test 4. On average, a 0.08 W saving was reached which represents a 6.8%. D. Test 4 - Down-clocking CPU unit The ARM processor frequency was increase to 1000 M hz and it was varied down to 100 M hz, with a 100 M hz step, on Test 4. A maximum reduction of 0.06 W was measured that represents a 5.2% and corresponds to a 100 M hz CPU frequency on Pidora OS. However, as expected, the RPi performance was slower after reducing ARM resources. V. Photovoltaic Energy System The photovoltaic power system requires an accurate sizing of the solar panels array and batteries. This, to satisfied the energy demand and to reach a specific number of days of autonomy without receiving an input charge from the solar array. The minimize power consumption from the RPi, was considered to estimate the load demand of the gateway node, including the power of the WiFi radio equipment and the ZigBee radio module. After calculating the power of each device, these values were multiply by their respective daily hours of use, and divided by the nominal system voltage (12V ). A 2% factor was considered to overcome losses caused by wiring and a
10% safety factor from expected battery efficiency. Getting a total amp-hour load of 3.8AH/day. Solar radiation data from the gateway location was essential to calculate the photovoltaic modules needed, specifically, the number of hours per day of full sunlight available to generate electricity. At the location evaluated this value is 3.3h/day. The total amp-hour load was divided by this value to calculate the design current. The final design current is compare to commercial solar modules parameters, to seek a specific output current and operating voltage. A 20W solar panel with 1.39A output current was selected, which concluded a requirement of just one photovoltaic module for the gateway node. Finally, to calculate the number of the batteries needed, the total of days of system autonomy have to be define, in this case 6 days. Considering, a battery with a 12V and 26AH capacity, only 1 battery would have to be installed to the node. The results of this last section were compared to the sizing of the photovoltaic system considering the RPi in idle state. In terms of the total days of system autonomy, an extra autonomy day can be achieved with the RPi under minimum conditions. VI. Conclusions and Future Work From an overall analysis, Raspbian Lite distribution draws less energy among the other OSs, displaying a better power consumption performance in every test scenario. The following RPi configurations are the best-case scenario for a maximum energy saving. The operating system selected is Raspbian Lite. The HDMI controller must be disable. The Ethernet cable needs to be connected to control the WiFi router. And the clock settings chosen are: 100 MHz SDRAM frequency, 100 MHz GPU frequency and 100 MHz CPU frequency. With this settings, the RPi power consumption is 0.97 W , and it represents a 20.1% saving compared to the power consumption on idle state. This energy savings are equivalent to an extra autonomy day of the gateway photovoltaic system, which increases the lifetime of the network. After a final evaluation of the RPi under the minimum configurations selected, it was determined that the gateway functions, including the transmission and reception of data from the WiFi and ZigBee transceivers, can be successfully performed. In future, to the RPi best-case scenario defined, a power consumption analysis under different computing work-
loads will be performed, simulating the computational load required for the gateway node. Also, an external power switch will be designed to avoid the constant energy consumption generated after powering off the RPi, mentioned in Test 1. Its behaviour and the power consumption will be also evaluated. Acknowledgment The authors would like to thank to DIUC research department and PROMAS engineering department from Universidad de Cuenca. References [1] ZigBee Specification, ZigBee Alliance Std. [2] IEEE 802.11 Std. for Information technologyTelecommunications and information exchange between systems Local and Metropolitan area networks, Institute of Electrical and Electronics Engineers Std. [3] F. Kaup, P. Gottschling, and D. Hausheer, “Powerpi: Measuring and modeling the power consumption of the raspberry pi,” in 39th Annual IEEE Conference on Local Computer Networks, Sept 2014, pp. 236–243. [4] V. Vujović and M. Maksimović, “Raspberry pi as a wireless sensor node: Performances and constraints,” in Information and Communication Technology, Electronics and Microelectronics (MIPRO), 2014 37th International Convention on, May 2014, pp. 1013–1018. [5] S. G. Nikhade, “Wireless sensor network system using raspberry pi and zigbee for environmental monitoring applications,” in Smart Technologies and Management for Computing, Communication, Controls, Energy and Materials (ICSTM), 2015 International Conference on, May 2015, pp. 376–381. [6] M. Ibrahim, A. Elgamri, S. Babiker, and A. Mohamed, “Internet of things based smart environmental monitoring using the raspberry-pi computer,” in Digital Information Processing and Communications (ICDIPC), 2015 Fifth International Conference on, Oct 2015, pp. 159–164. [7] M. Maksimović, V. Vujović, N. Davidović, V. Milošević, and B. Perišić, “Raspberry pi as internet of things hardware: performances and constraints,” design issues, vol. 3, p. 8, 2014. [8] R. Fisher, L. Ledwaba, G. Hancke, and C. Kruger, “Open hardware: a role to play in wireless sensor networks?” Sensors, vol. 15, no. 3, pp. 6818–6844, 2015. [9] E. Upton and G. Halfacree, Raspberry Pi user guide. John Wiley & Sons, 2014. [10] R. Pi, “Raspberry pi 3 is out now! specs, benchmarks & more,” The MagPi, march 2016. [11] Raspberry pi official web site. [Online]. Available: https://www.raspberrypi.org/ [12] Maxim. Precision, high-side current-sense amplifiers max471/max472. Maxim. [Online]. Available: http://pdfserv.maximintegrated.com/en/ds/MAX471MAX472.pdf [13] C. Doukas, Building Internet of Things with the ARDUINO. CreateSpace Independent Publishing Platform, 2012. [14] Picore official web site. [Online]. Available: http://tinycorelinux.net/ [15] Pidora official web site. [Online]. Available: http://pidora.ca/