MCU Low Power Design (III) Products

Publisher:心愿成真Latest update time:2016-08-14 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction:

Energy consumption is a major issue for battery-powered products. Once the battery runs out, the device will "go on strike." In "MCU Low Power Design (I) Theory," we introduced the principles of energy saving; in "MCU Low Power Design (II) Practice," we measured the low power consumption of the STM8L151C8.

This article introduces the low-power design of wireless communication products. First, the power consumption of MCU and RF chip I/O settings is measured, then the power consumption of RF chip in different modes is tested, and then the energest module of Contiki system is used to track energy consumption in real time. Finally, the low-power design is summarized and the low-power characteristics in wireless networking are expected. Let's go!

1. Introduction to wireless communication products


The iWL881A wireless communication module is a LoRa long-distance, low-power product of "Changsha Ruimi Communication Technology Co., Ltd. (www.rimelink.com)" (as shown below). It has an embedded, efficient and powerful IoT operating system Contiki, supports star/tree/MESH networks, and forms an "end-pipe-cloud" system with the company's concentrator and cloud server. Typical application scenarios include: residential meter reading (water/electricity/gas), street light control, factory collection, security alarm, etc.

 

The application scenario of this micro-power wireless communication product is basically powered by batteries, so low-power design has become the first "main battlefield". The MCU uses ST's ultra-low-power processor STM8L151C8, and the radio frequency chip (RF) uses Semtech's SX1278. This chip is based on the LoRa spread spectrum communication principle and can achieve a distance that is 4 times closer than FSK modulation under the same conditions. For the LoRa communication principle, please refer to the author's blog post "LoRa Wireless Communication Design (I) Principle".


MCU and RF are connected through SPI bus. In addition, there are some control pins. The hardware schematic diagram of SX1278 is as follows: RF sends notification signal to MCU through DIO0~5 pins, NSS/SCK/MISO/MOSI is SPI bus, and NRRST is the pin for MCU to reset RF.

2. Static low power consumption

1. MCU pin configuration

To truly achieve low power consumption of a product, the first thing to do is to correctly configure the I/O pins, and the energy consumption of a single I/O port should reach the mA level. In other words, if you accidentally miss or misconfigure an I/O pin, it will ruthlessly "swallow" the results you have achieved by painstakingly managing the MCU low power mode.

The MCU's I/O pins are roughly divided into four categories: unconnected, connected to 3.3V, IC input MCU output, and IC output MCU input. Next, we will conduct a series of experiments to see how to configure these four types of pins.

 

Experiment 1: I/O ports connected to 3.3V need to be set to Output, high level. Is push-pull or open-drain appropriate? Select 5 I/O pins connected to 3.3V. The experimental results are as follows:

push-pull: 0.4 uA

open-drain:29.3 uA

Conclusion: For 3.3V I/O, the energy saving mode needs to be set to Output, push-pull, high level.

 

Experiment 2: Set the 36 floating I/O ports to the following 6 modes. The energy consumption data of each mode is as follows:

       Input, floating:                         536 uA

       Input, pull-up:                          0.4 uA

       Output, open-drain, low level:            0.4 uA

       Output, open-drain, high-impedance level: 530 uA

       Output, push-pull, low level:              0.4 uA

       Output, push-pull, high level:             0.4 uA

Conclusion: Floating I/O pins can be set to: (1) Input, pull-up; (2) Output, push-pull, high (low) level.

 

Experiment 3: Set the 6 I/O ports connected to RF (RF is the input direction) to the following 6 modes. The energy consumption is as follows:

       Input, floating:                          489 uA

       Input, pull-up:                          482 uA

       Output, open-drain, low level:            660 uA

       Output, open-drain, high-impedance level: 494 uA

       Output, push-pull, low level:              661 uA

       Output, push-pull, high level:             574 uA

Conclusion: The external IC is the input pin, and in energy saving mode it needs to be set to: Input, pull-up.

 

Experiment 4: Set the 9 I/O ports connected to RF (RF is output direction) to the following two modes. The energy consumption is as follows:

       Input, floating:                         430 uA

       Input, pull-up:                          574 uA

Conclusion: The pin of the external IC as output needs to be set to: Input, floating in energy saving mode.

 

 

The basic principles of MCU pin configuration are summarized as follows:

legend

characteristic

Energy saving configuration mode

 

IC output, MCU input: input, floating

Input floating, no external interrupt

 

IC input, MCU output: input, pull-up

Input pull-up, no external interrupt

 

3.3V pin: output, pull-up, high level

Output push-pull, high level, 2MHz

 

Unconnected pin: output, pull-up, low level

Output push-pull, low level,2MHz

 

In actual development, we can first use an Excel table to list the configuration requirements of the MCU pins. For the above four types, we can refer to the "subway line" color (invented by the British) logo, such as:

No.

I/O

name

Low power configuration

effect

14

PE0

LORA_RXTX

Input floating, no external interrupt

RF output: indicates whether RF is currently receiving or transmitting

15

PE1

NC

Output push-pull, low level, 2MHz

 

16

PE2

LORA_RXE

Input pull-up, no external interrupt

RF reception: RXE=1, TXE=0

17

PE3

UART2_RX

Output push-pull, low level, 2MHz

did not use

18

PE4

UART2_TX

Output push-pull, low level, 2MHz

19

PE5

NC

Output push-pull, low level, 2MHz

 

20

PD0

LED1

Output push-pull, high level, 2MHz

External 3.3V, set push-pull high level to save energy

 

2. RF operating mode

For wireless communication products, the radio frequency module (RF) greedily "devours" electrical energy. Let's first look at the energy consumption value officially declared by SX1278:

 

Serial number

1

2

3

4

model

Sleep

Standby

Receive

Transmit

20dBm

17dBm

13dBm

7dBm

Energy consumption

0.2 uA

1.6 mA

12 mA

120 mA

87 mA

29 mA

20 mA

 

 

In actual products, what is the power consumption of the entire MCU+RF device? Let's continue to look at the experimental data:

 

Experiment 5: MCU configures all I/O pins to low power mode, sets RF to Sleep mode through SPI bus, MCU turns off SPI clock and restores SPI bus pins to low power mode, and enters Halt mode.

Result: Total power consumption = 0.6 uA.

In "MCU Low Power Design (II) Practice", we know that when the MCU enters Halt mode, the power consumption is 0.4 uA; plus the 0.2 uA of RF in Sleep mode, the total is 0.6 uA.

 

Experiment 6: MCU configures all I/O pins to low power mode, sets RF to Standby mode through SPI bus, MCU turns off SPI clock and restores SPI bus pins to low power mode, and enters Halt.

Result: Total power consumption = 1.493 mA.

The power consumption of 1.493 mA is the power consumption of RF in Standby mode, because the power consumption of MCU is only 0.4 uA at this time, which is almost negligible.

 

Experiment 7: MCU configures all I/O pins to low power mode, sets RF to Receive mode through SPI bus (this mode can be maintained for a long time), MCU turns off SPI clock and restores SPI bus pins to low power mode, and enters Halt.

Result: Total power consumption = 15.97 mA.

When RF is in Receive listening mode, the power consumption is as high as nearly 16 mA, which is much greater than the power consumption of the MCU running at full speed (about 5 mA).

 

Experiment 8: MCU configures all I/O pins to low power mode, sets RF to Transmit mode via SPI bus, MCU executes WFI (Wait for Interrupt) instruction to save energy, wakes up after transmission is completed, and sends data frames in a loop. Test the power consumption under transmission power of +20dBm on PA_BOOST and +7dBm on RFO_LF respectively:

Result: +20dBm on PA_BOOST=123mA, +7dBm on RFO_LF =11mA

The transmission power is amazing, especially when the power amplifier is turned on and adjusted to the maximum power of +20dBm, the current reaches 123 mA.

3. Dynamic Low Power Consumption

SigFox of France and some Russian companies often claim that their wireless meter reading products can work for 10 years with two ordinary AA batteries. At first, I thought they were either bragging or their technology was so advanced that Chinese people felt inferior. How did they achieve this? Let's take a look.

From the above experiment, we know that when the wireless product is in Sleep mode, the power consumption is only 0.6uA, in Receive mode, the power consumption is 16mA, and in TX mode, the power consumption is 100mA (ultra-long distance). The core of any wireless communication energy-saving technology is to sleep as much as possible, which will bring extremely low average power consumption of the whole machine.

 

Let's take an example. Most energy meters require wireless reading to send a data frame about every 15 minutes, which is about 100ms. They need to wake up within 4 seconds, which means they need to receive and listen for 5ms every 400 seconds. The rest of the time they are in sleep mode. Taking 15 minutes (900 seconds) as a unit, the energy consumption is as follows:

Send: 100ms * 100mA = 10mA.s

Receive: (900 / 4) *5ms * 16mA = 18mA.s

Sleep: 898s * 0.6uA = 0.54mA.s

Average power consumption: (10mA.s +18mA.s + 0.54mA.s) / 900s = 0.0317mA

Assuming the total power of two AA batteries is 3000mAH, the energy consumption time is: 3000mAH / 0.0317mA = 94637H = 10.8 years.

 

From the above examples, it can be seen that the following design principles are required to extend the life of wireless communication products as much as possible:

l Sleep as much as possible, and keep the power consumption as low as possible during sleep;

l Reduce the listening time;

l Improve the communication success rate and avoid conflict and retransmission as much as possible.

To realize the above design, an excellent network protocol stack is needed, especially the RDC (Radio Duty Cycle) layer algorithm must be reasonable; and the basis of the protocol stack and software operation is the operating system, which confirms the rule of "30% hardware and 70% software" in smart product design.

 

iWL881A uses the power-hungry IoT operating system Contiki and the Rime wireless communication protocol stack. The dynamic power consumption of the product is tracked using Contiki's energest module.

The Contiki system has designed an energest module to facilitate energy conservation tracking, which can track component running time. Its data structure is shown in the figure below. energest_total_time records the total running time of the component, energest_current_time records the start time of the component, and energest_current_mode records whether the component is currently turned on. The unit of time is rtimer_clock_t.

Energest Data Structure

When a component is turned on, ENERGEST_ON() is called, and when the component is turned off, ENERGEST_OFF() is called. The timing logic of these two actions is shown in the figure below.

Energest sequential logic

When the user needs to count the running time of a component, first call the energest_flush() function, which settles the running time of all components to the current time; then call the energest_type_time() function to retrieve the running time of the corresponding component; finally, it can be converted into power consumption based on the power of the component.

 

iWL881A can print energy consumption tracking information in real time using Contiki's energest module:

CPU=5977ms, RF_TX=179ms,RF_RX=1512ms, IRQ count=30303

CPU=6023ms, RF_TX=181ms,RF_RX=1507ms, IRQ count=30304

CPU=5984ms, RF_TX=180ms,RF_RX=1497ms, IRQ count=30303

The above time is the statistical value within 300 seconds, which shows that: the CPU duty cycle is about 6000 / 1000 / 300 * 100% = 2%, the RF transmission duty cycle is about 180 / 1000 / 300 * 100% = 0.06%, the RF reception duty cycle is about 1500 / 1000 / 300 * 100% = 0.5%, and the number of interruptions is about 30300 / 300 = 101 times (the test system includes a 100Hz "heartbeat" clock).

4. Low power consumption in networking

When wireless products are operating in a network, there are often multiple communication modes such as conflict retransmission, sleep wake-up, routing forwarding, etc. Tracking energy consumption here will be more challenging. Please continue to pay attention to the LoRa networking series of blog posts of "Changsha Ruimi Communication Technology Co., Ltd."

Keywords:MCU Reference address:MCU Low Power Design (III) Products

Previous article:MCU Low Power Design (II) Practice
Next article:Some commonly used C language control programs for msp430---ZLG7289

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号