Low power consumption research is a hot topic in wireless sensor network research, which can be divided into two levels: hardware and software. This paper introduces the technical background of low power consumption research from the software level, especially the operating system perspective, and analyzes the strategies adopted by the existing typical sensor network operating systems in low power consumption management, and proposes a low power consumption improvement method for μC/OS-II in wireless sensor networks. After transplantation and testing, the improved μC/OS-II has significantly improved in low power consumption.
introduction
Wireless sensor networks are a dynamic, adaptive distributed computing platform formed by sensor nodes with data collection, computing and communication capabilities through self-organizing networks. Each sensor is a typical embedded system with small storage capacity, poor computing power, low power consumption and easy failure. Therefore, it puts higher demands on traditional embedded application developers and urgently requires careful design of system software to meet its reliability and durability requirements. The characteristics of wireless sensor networks determine that reducing system power consumption as much as possible has become one of the core elements of system design. For this reason, in some sensor network operating systems currently developed, power consumption management is designed as an important module. For example, TinyOS of the University of California, Berkeley, SOS of the University of California, New York, and MantisOS of the University of Colorado, all operating systems designed for sensor network nodes have their own low power management strategies.
This paper mainly studies the mechanism and strategy of reducing the power consumption of wireless sensor network systems from the perspective of software, and proposes a low-power improvement strategy based on μC/OS-II. This is of great significance for extending the life cycle of wireless sensor network systems and popularizing their applications.
1 Low-power software system design principles
In embedded systems, when the hardware platform has been determined, the software system mainly reduces power consumption from two aspects: CPU and external devices.
CPU-related power consumption management can be achieved by controlling the CPU's operating mode. The CPU generally has running mode, idle mode, sleep mode, sleep mode and power-off mode, which correspond to different operating frequencies inside the CPU. The conversion relationship between them and the order of power consumption are shown in Figure 1. The principle of power saving is that the processor is in running mode only when there is user operation or task processing, and is in sleep mode at other times to maximize power efficiency.
The power consumption management of peripheral devices can be realized by entering the corresponding power consumption mode of the device according to the events issued by the system when entering a specific power consumption mode, or the user can set the peripheral device controller to enable the peripheral device to achieve the purpose of controlling the power consumption of the peripheral device. In recent research, it has begun to consider dynamically changing the voltage and frequency of the processor at the same time to further reduce power. This is a more complex and systematic project involving relevant content from hardware to operating system and application layer.
2 Low Power Consumption Strategy of Wireless Sensor Network Operating System
The wireless sensor network operating system is a combination of sensor node hardware and application software, and the power consumption management module is also implemented here. The quality of this module design directly determines the life of the entire sensor network system. The following introduces several typical power consumption management methods of wireless sensor network operating systems.
TinyOS is an open source operating system developed by the University of California, Berkeley, designed for wireless embedded sensor networks. It has component-based features and can be innovated and implemented quickly with minimal code under the condition that sensor networks are inherently strictly limited in memory. Its power consumption management is mainly reflected in the following points:
◇Every service of TinyOS can be stopped by StdControl.stop command;
◇ The component controlling the peripheral device can switch the peripheral device to a low power consumption mode;
◇The HPLPowerManagement component of TinyOS puts the processor into the corresponding low-power mode by checking the I/O pins and register status of the processor;
◇The scheduler will automatically put the processor into low power mode when the ready task queue is empty.
SOS is a wireless sensor network operating system developed by the University of California, New York, which uses the idea of dynamic reprogramming to dynamically load and unload code modules in a single node. Similar to TinyOS, it provides a general abstract interface to manage the power consumption state of sensor node peripherals, and the scheduler will automatically put the processor into low-power mode when the ready task queue is empty.
MantisOS is a wireless sensor operating system developed by the University of Colorado in the United States. It is designed for ease of use and flexibility. It supports the rapid and flexible construction of wireless sensor network prototype systems. It achieves energy optimization by managing the SLEEP function similar to the Unix system. When all user threads are asleep, the scheduler can control the system to enter a low-power mode, thereby avoiding the busy waiting state that consumes energy. The specific task scheduling process is shown in Figure 2.
Contiki is a lightweight operating system developed by the Swedish Academy of Sciences and designed specifically for 8-bit machines. It does not have an explicit power management strategy, but it transfers control to each application module, and the scheduler provides information about the event queue in the current state. This information can help applications shut down the processor and enter low-power mode when there is no event task scheduling.
3 Low power consumption strategy based on ATmegal28L and μC/OS-II
3.1 Hardware Features
In this low-power model, the data processing unit uses Atmel's ATmegal28L microcontroller. It is an 8-bit microcontroller based on RISC structure produced by low-power CMOS technology. It is the most powerful single-chip microcomputer in the current AVR series, with rich resources and extremely low power consumption. It has 128KB of program Flash and 4KB of data SRAM on the chip, which can be expanded to 64KB of E2PROM; 8 10-bit ADC channels, 2 8-bit and 2 16-bit hardware timers/counters, and can work in a variety of different modes; 8 PWM channels, programmable watchdog timer and on-chip oscillator, on-chip analog comparator; UART, SPI, I2C bus interface and JTAG interface. In addition to the normal operating mode, it also has 6 different levels of low-power modes. Each mode has different characteristics, as listed in Table 1.
3.2 Software Features
μC/OS-II is a simple and efficient embedded real-time operating system kernel. It has a preemptive real-time multi-task scheduling system function and provides system services for synchronization, mutual exclusion and communication between tasks. These functions can be tailored according to different needs. Its minimized kernel can be compiled to 2KB and has been ported to many architectures such as x86, ARM, PowerPC, MIPS, etc. Based on its compactness and strong portability, μC/OS-II is very suitable for wireless sensor network node chips.
3.3 μC/OS-II porting on ATmegal28L
(1) Define basic configuration
◇Define compiler-related data types;
◇Define macros to enable and disable interrupts;
◇Define the growth direction of the stack;
◇Define the macro OS_TASK_SW() for task switching.
(2) Implement the system structure related functions of OS_CPU_A.ASM file
OSStaerHighRdy: Responsible for obtaining the stack pointer of the new task and restoring all processor registers of the new task from the stack pointer.
OSCtxSW: Responsible for saving the processor registers of the current task into the stack and restoring the task's stack pointer as needed to restore the processor registers.
OSIntCtxSW: Saves the processor registers of the current task and restores the processor registers of the new task when an interrupt occurs.
OSTickISR: timer interrupt function.
3.4 μC/OS-II low power improvement strategy
μC/OS-II is a preemptive multi-task embedded real-time operating system. Task scheduling uses a 64-level bitmap priority algorithm, and only one task is allowed for each priority. Therefore, excluding the 8 tasks reserved by the system, μC/OS-II allows users to use 56 tasks with different priorities. This priority algorithm is conducive to ensuring the real-time performance of the system and enabling high-priority tasks to be responded to in a timely manner. However, this multi-task concurrent scheduling does not take low-power applications into consideration and is difficult to play a role in wireless sensor networks with extremely limited resources. Therefore, it needs to be improved.
In μC/OS-II, when no other tasks are scheduled to be executed in the system, the scheduler starts to execute the idle task. This task performs a busy wait operation, constantly looping and waiting for interrupts. Therefore, the processor is always in a running state, consuming more energy.
To ensure high efficiency and flexibility of system power management, we provide corresponding mechanisms to ensure that applications can directly control power consumption modes, mainly including the following three aspects:
First, when designing an application, the system power consumption mode can be set as needed. In μC/OS-II, a dedicated system call interface is provided for the application.
Second, during operation, the system can automatically manage power consumption according to the system's operating status, so that the system operates in a power consumption mode that is suitable for the system status.
When there are no other active tasks in the system, the idle task is executed and the system automatically enters the idle mode; if an external event occurs, the system will return to the running mode. When the system's working time in idle mode exceeds the preset value, the system automatically enters the sleep power consumption mode; if an external event occurs that requires the system application to process, the system will automatically return to the running mode. In sleep mode, if no event occurs that requires the system to process, the system automatically enters the sleep mode. For sleep mode, if an external event occurs, the system returns to sleep mode. If the event is a valid event for the system, the system will enter the running mode. When a task is sleeping, the task is hung in the sleep queue. When all tasks in the system are sleeping, the system enters sleep mode. When the sleep time of a task in the sleep queue expires, an interrupt is triggered, the CPU is activated, and scheduling is restarted.
Third, a specific power consumption mode can be enabled or disabled.
In the specific implementation process, the following strategies were adopted:
① A sleep task queue is extended in the μC/OS-II kernel. The queue receives sleep tasks and sorts them according to the length of sleep time. If the sleep time of the task at the head of the queue expires, the task is removed from the queue and the sleep time in the queue is readjusted.
② Modify the task scheduler of the μC/OS-II kernel. When there is no task to execute in the ready queue, it will no longer execute the energy-consuming empty loop operation. It first determines whether there is a task suspended on the I/O operation. If so, the system enters the sleep mode. At this time, if an external valid I/O operation occurs, the system resumes the running mode. If all tasks call the SLEEP function, the system enters the sleep mode, and then the external timer maintained by the sleep task queue is responsible for waking up the sleeping system.
③Implement related functions such as task sleep and power consumption mode switching.
④ Implement and encapsulate related functions such as power consumption mode enabling and switching, and provide corresponding interfaces for user tasks to explicitly call.
4 Performance Test Results
The improved μC/OS-II has been transplanted to the ATmegal28L development board, and the system runs stably. Table 2 and Table 3 show the system power consumption measured in various software states before and after the improvement.
Performance Test Results
5 Conclusion
As an embedded device, wireless sensor network nodes are in an idle state without any tasks for a long time. If the power consumption can be automatically managed according to the working state of the system, so that the system operates in a power consumption mode that is suitable for the system state, the system power consumption can be greatly reduced, thereby extending the life of the system. This is of great significance in wireless sensor networks with extremely high energy consumption requirements.
Previous article:Hall sensor--design of signal acquisition and display system
Next article:Implementation of Micro Nodes in Wireless Sensor Networks
Recommended ReadingLatest update time:2024-11-16 21:38
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Milestone! SmartSens CMOS image sensor chip shipments exceed 100 million units in a single month!
- Taishi Micro released the ultra-high integration automotive touch chip TCAE10
- The first of its kind in the world: a high-spectral real-time imaging device with 100 channels and 1 million pixels independently developed by Chinese scientists
- Melexis Launches Breakthrough Arcminaxis™ Position Sensing Technology and Products for Robotic Joints
- ams and OSRAM held a roundtable forum at the China Development Center: Close to local customer needs, leading the new direction of the intelligent era
- Optimizing Vision System Power Consumption Using Wake-on-Motion
- Infineon Technologies Expands Leading REAL3™ Time-of-Flight Portfolio with New Automotive-Qualified Laser Driver IC
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 6. DMA implementation of USART1 sending and receiving
- PICO's Wireless REPL
- 【GD32E503 Review】 Test screen display characters
- AM5708 platform transplants Ubuntu system and docker container
- Microchip Live FAQ|Manufacturing Logistics Challenges of Secure Key Provisioning: Advantages of Discrete Secure Elements
- Show the screen of E-coin exchange
- What exactly do you earn from a 5-yuan PCB proofing?
- Teach you to write microcontroller timer interrupt program
- Compilation warning: last line of file ends without a newline
- CC2541 Bluetooth Learning - General I/O Port Interrupt