📜 ⬆️ ⬇️

Measurement of power consumption of Intel Edison in different operating modes



I have an Intel Edison board, and I wondered what current it consumes, and whether it can be compared with the Arduino in this parameter.
The Intel Edison specification specifies standby consumption only:

- Waiting without radio modules - 13 mW.
- Standby (Bluetooth 4.0 enabled) - 21.5 mW.
- Standby (WiFi included) - 35 mW.
')
13 mW looks pretty impressive. We test all possible modes of operation and with different loads.

My Arduino board is a Chinese version of the Arduino UNO with a frequency of 16 MHz. Edison module is installed on the Arduino-adapter board, which provides contact compatibility with Arduino UNO. There are both pros and cons. Since the board is compatible with Arduino UNO, they are on an equal footing. But on the other hand, this adapter board contains a lot of chips, which also consumes some current, so really we will not achieve the minimum consumption, which can be obtained directly from Intel Edison.

Test stand


I will measure current consumption. For this, I assembled the simplest circuit in order to connect an ammeter to the power break. Since Intel Edison has an operating system inside it, I didn’t want to accidentally de-energize it without running shutdown. Therefore, the device is connected in parallel with the power switch. That is, when the switch is on, you can safely reconfigure the device or even turn it off.

As a battery, I used a battery of type Krone - Kodax MAX. With a rated voltage of 9 V. Naturally, while I was conducting experiments, the battery sat down a little. And under load, it gave an average of 7.7 V. So we will count in all tests.
Of course, it would have been better to use a network power supply, but at that time I did not have suitable connectors to make the connection.

Test Arduino


For a basic comparison, run the simplest example sketch on Arduino UNO that switches the built-in LED in one second.

void setup() { pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); } 

Arduino board consumes about 45-50 mA. (346-385 mW)



Naturally, this consumption at maximum performance. And if you translate the microcontroller to a lower frequency, the consumption will significantly decrease.

Initial tests


Let's start with the usual work without load. Access to the board is via USB in the mode of the serial port, which is not powered.

Connect the power. Linux bootup starts. Current consumption jumps from 60 to 150 mA (462-1155 mW). WiFi is on by default, but no data is transmitted. After entering the system, when all transients are normalized, the current consumption is set in the range of 65-70 mA (500-539 mW). CPU load a few percent.

Normal Minimum Load


We write a program in C, which polls the state of one of the ports with a connected button, and, depending on this, turns on the built-in LED connected to GPIO-13. The polling period of the button is 10 ms.

 #include <mraa.h> int main() { mraa_gpio_context led; mraa_gpio_context button; led = mraa_gpio_init(13); button = mraa_gpio_init(2); mraa_gpio_dir(led, MRAA_GPIO_OUT); mraa_gpio_dir(button, MRAA_GPIO_IN); while(true) { int value = mraa_gpio_read(button); mraa_gpio_write(led, value); usleep(1000*10); } return 0; } 

If the LED is off, then the consumption is 65-67 mA (500-516 mW).
If the LED is on, then 69-71 mA (531-547 mW).

Turn everything off


Turn off the entire board. Finish Linux by running the command:

 shutdown now 

After turning off Linux, when the LED on the board turns off, I expected to see no power consumption, but oddly enough the current is 13 mA (100 mW). That is, really the chips that are on the Arduino communication board consume current. Perhaps in operation it is even more.

WiFi without load


By default, when the WiFi system boots, the module is turned on, but data is not transmitted through it. You can turn off WiFi from the console with the command:

 systemctl stop wpa_supplicant 

Check that WiFi does not work by looking at the network interfaces:

 ifconfig 

The list should not be wlan0. Although the documentation and recommends for shutdown use:

 ifconfig wlan0 down 

My team did not turn off WiFi. So, having tried to turn on and off WiFi without data transfer, I did not notice the difference in consumption. As it was about 67 mA, it remained. Maybe the WiFi module was not completely de-energized.

WiFi with load


We transfer data using WiFi. For testing under load, we will use a large file that will be sent from both the Intel Edison board to the host computer, and vice versa. The file will be stored in the / tmp folder, which is located in RAM in tmpfs and therefore does not use flash memory, which can also consume current. I used PSCP from the Putty set. When transferring a file from the host computer to Intel Edison, the current consumption was about 150 mA (1155 mW). When transferring from Intel Edison to the host, 240 mA (1848 W).

Bluetooth


By default, when the system boots, Bluetooth is not enabled. Bluetooth check music playback on an external speaker. How to do this can be found in the article “Playing Audio on Intel Edison via Bluetooth Using the Advanced Audio Distribution Profile” (A2DP) .

The column was at a distance of half a meter. The consumed current is 72-103 mA (554-793 mW). Basically it was 90 mA (693 mW).

More calculations


Now we will load the main processor with something serious. We will calculate the sinuses in the cycle.

 #include <mraa.h> #include <iostream> #include <math.h> int main() { for( float k = 0; k < 1000; k++ ) { float sum = 0; for( float s = 0; s < 10000000; s++ ) { sum += sin(s+k); } std::cout<<"sum="<<sum<<std::endl; } return 0; } 

I do not just calculate the sines, but I find their sum and display on the screen so that the optimizing compiler does not throw out these calculations as unnecessary. Compile to executable file and run with the command:

 ./highload & 

so he stayed to work in the background. Run the top command to make sure the processor is fully loaded.



It can be seen that the load is about 50%, which is correct, since the main Atom processor has two cores. So, the current consumption is 92 mA (708 mW).

More calculations


Now we will load both processor cores. At first I wanted to write a two-threaded application, but then I decided that you can just run the previous application twice. So, we do one and two:

 ./highload & ./highload & 

In the top loading 98-100%:



The device shows 107 mA (824 mW). And I think it's cool. The consumption of the board when the CPU is fully loaded is only 2.5 times greater than that of the Arduino, and this is a dual-core Atom at 500 MHz.

Two cores plus WiFi


We will load two cores at the same time as in the previous example and launch the file transfer over WiFi to the host computer. Consumption of 290 mA (2233 mW).

Built-in microcontroller (MCU)


Intel Edison inside contains not only a powerful Atom, but also a microcontroller, made on the Intel-486 architecture, compatible with Pentium and operating at 100 MHz. When the processor enters sleep cycles, the frequency drops to 38.4 MHz. It runs a real-time operating system and therefore provides good temporal accuracy of work.

This microcontroller can be used for different purposes. Guaranteed time accuracy of his work can be used in time-critical tasks. For example, measuring the time interval, as in the article "Using the built-in microcontroller in Intel Edison" . Or you can use the fact that the consumption of this microcontroller is less than that of the main processor. Therefore, you can assign some simple tasks to it, and put the main processor into sleep mode, and wake up only when necessary. Just so, and you can achieve the most good efficiency of the device.

The microcontroller has access to all GPIOs, only their numbers are internal and differ from those used, for example, from the mraa library on the main processor. At the moment, the program for the microcontroller can only be updated when the entire system is rebooted and it runs continuously. No updates on the fly.

We connect the microcontroller


We write a program on the microcontroller, which is waiting for most of the time and sends debugging information to the development environment.

 #include "mcu_api.h" #include "mcu_errno.h" void mcu_main() { debug_print(DBG_WARNING, "Start\n"); const int LEDpin = 40; // GPIO-13 const int DIR_out = 1; gpio_setup(LEDpin, DIR_out); while(1) { mcu_sleep(1000); // sleep 10 s. 1 tick = 10 ms debug_print(DBG_WARNING, "blink\n"); gpio_write(LEDpin, 1); mcu_sleep(10); // sleep 100 ms gpio_write(LEDpin, 0); } } 

Do not forget to configure the ports from Linux for the microcontroller to work.

 ./init_DIG.sh -o 13 -d output 

Consumption has not changed from normal operation without load - 67 mA (516 mW).

We load the microcontroller


Now let's see what happens if we load the microcontroller to the maximum. At first I tried to do likewise as with a central processor. Calculate the amount of sines and send it to the debug output. But for some reason the code did not work. It turned out that the program doesn’t like it when using float data, especially when mixing it with int in operations. The program just stops at such a point. Therefore, the test program simply calculates a sequential sum of numbers. Interestingly, the amount received is not used anywhere, but the compiler left all the code, that is, the compiler does not do much optimization. After studying the documentation, it turned out that float cannot be used, this leads to stopping the code. It would be better not compiled.

To show the difference in consumption, the program will be 10 seconds in standby mode and 10 seconds in full load mode.

 #include "mcu_api.h" #include "mcu_errno.h" const int proc_time = 10;// in seconds void func_highload(int waitTimeSec) { unsigned long startTime = time_us(); unsigned long delta; do { int sumD = 0, k; for( k = 0; k < 1000000; k++ ) sumD += k; delta = time_us() - startTime; } while (delta < waitTimeSec * 1000000 ); } void mcu_main() { debug_print(DBG_WARNING, "Start\n"); const int LEDpin = 40; const int DIR_out = 1; gpio_setup(LEDpin, DIR_out); while(1) { debug_print(DBG_WARNING, "Simple\n"); mcu_sleep(1000); // 10 s debug_print(DBG_WARNING, "Highload\n"); func_highload(10); } } 

Without load 67 mA. At full load, we get 71 mA. Those. it seems that the integrated microcontroller at full load consumes about 4 mA (31 mW).

Saving big


To further reduce power consumption, turn off the main processor and leave only the built-in microcontroller to work. Judging by the documents, in this case we can expect consumption in the region of 13 MW. This is about 1.6 mA. Of course, this is without an Arduino board. Here you can already talk about the operation of the device for several days.

So, our task is to run some code on the MCU, which most of the time is in sleep mode, occasionally waking up. And, most importantly, you need to put the main processor in standby mode. There are several options for economy mode: S1, S2, S3.

We are interested in the S3 mode - Suspend to RAM. Power is supplied only to the memory, everything else is turned off. When we transfer the main processor to this state, it will remain in it until the wake-up signal arrives. Such a signal can be sent from the built-in microcontroller.

It turns out such a scenario. Run the program on the MCU, then put the main processor in standby mode. The MCU checks any signals on the GPIO, for example, buttons, and if necessary, awakens the main processor. After his work is finished, he again goes into sleep mode.

It should be noted that I did not manage to completely transfer the main processor to sleep for a long period of time. Searches on the Internet have shown that there is such a problem. When switching to sleep mode, you must turn off WiFi, otherwise it will not allow you to make such a transition.

 systemctl stop wpa_supplicant 

And since we turn off WiFi, the connection to Intel Edison should be made via USB. Then I used various options for switching to sleep:

 echo devices > /sys/power/pm_test echo mem > /sys/power/state 

This is a test check of the sleep mode for 5 seconds. She sometimes worked. Sometimes it stopped working altogether and a system restart was required, maybe even with power off. And the team for the full translation:

 echo none > /sys/power/pm_test echo mem > /sys/power/state 

almost never worked. Something hurt. Judging by the dmesg it is the SC - south complex:

 [ 2313.362056] SC device/devices not in d0i3!! 

I couldn't make it work yet. But still it turns out that, in principle, the system can be transferred to a more economical mode. Hope this problem will be solved in the future.

So, when putting the processor into sleep mode and running a light program on an MCU, we get a consumption of 25 mA (192 mW). And this is the limit that I managed to achieve from Intel Edison installed on the Arduino adapter board. Well and the most important, the processor sleeps, it is necessary to wake him up. This can be done on the arrival of data on the serial port that connects the CPU and MCU. Here is an example of how to make a wake up every two minutes, the text being sent is not important:

 #include "mcu_api.h" #include "mcu_errno.h" void mcu_main() { while (1) { mcu_sleep(12000); /* wake up CPU every 2 minutes */ host_send((unsigned char*)"wake up!\n", 10); } } 

To allow the main processor to go into sleep mode when there is no data on the serial port, the following command must be executed in Linux:

 echo auto > /sys/devices/pci0000\:00/0000\:00\:04.3/power/control 

You can read more in the article “Waking up the host CPU using the MCU” . But again, for some reason, my processor did not fall asleep.

findings


Although I could not reach the power consumption of 13 mW, perhaps due to the presence of an Arduino-adapter, Intel Edison pleasantly surprised me anyway. Honestly, I expected a lot more difference between Intel Edison and Arduino. And for some reason thought that Intel Edison is not intended for autonomous systems. It turned out that it is not.

Summary results in ascending order:
Everything is turned off (shutdown) - 13 mA (100 mW).
Only MCU, mainly in sleep - 25 mA (193 mW).
Only MCU, mainly in sleep - 29 mA (223 mW).
Normal Linux operation is 67 mA (516 mW).
Linux C ++ program is mainly in sleep mode - 67 mA (516 mW).
Linux MCU sleep - 67 mA (516 mW).
Linux MCU loaded - 71 mA (547 mW).
Linux Bluetooth - 90 mA (693 mW).
Linux One main processor thread is 92 mA (708 mW).
Linux Two streams of the main processor - 107 mA (824 mW).
Download Linux OS - 60-150 mA (462-1155 mW).
Linux WiFi reception - 150 mA (1155 mW).
Linux WiFi transmission - 240 mA (1848 mW).
Linux WiFi transmission + 2 streams - 290 mA (2233 mW).

And, for clarity, the diagram:

Power consumption Intel Edison + Arduino Board (mW)

Source: https://habr.com/ru/post/366387/


All Articles