Wireless sensor networks, once relegated to a few niche markets, are enabling a wide range of new applications. Designing a basic low-power wireless sensor network is straightforward if you follow the advice detailed in this article.
The global demand for "green" technology and better use of power is driving a new generation of extreme low-power wireless networks. Wireless networks are being developed for use in remote sensor-based systems, for both industrial and control applications. This new generation of wireless networks also enables more applications to better utilize true wireless solutions that do not require any network cables or power lines.
Sensor-based networks for monitoring and control are not new concepts. Technologies exist for both wired and proprietary wireless implementations. Wired implementations have found widespread use, owing to their simplicity and low-cost nature. Wireless, on the other hand, has been limited to just a few niche applications.
It is possible to develop these types of wireless systems today by utilizing designs that require very little power. Next-generation wireless networks can last longer on their batteries, and require little to no maintenance over the lifespan of the application. In the future, energy harvesting may even provide the power required, eliminating the need for batteries.
This article highlights the various extreme low-power control features found on next-generation embedded microcontrollers, as well as how engineers can use these features to extend the expected battery life of wireless sensor nodes.Power management features
So, what is low-power? Before continuing, let's first discuss some terminology. "Energy" refers to the total amount of work performed, whereas "power" measures the rate at which the work is performed (energy used per unit of time). In electronics, energy = power × time and power = voltage × current. So, the key system attributes that we are interested in are voltage, current, and time. More specifically, what voltage is the application running at, how much current is it drawing, and for how long?
Looking at this from the microcontroller viewpoint, we need to first take a look at the various power modes available on newer microcontrollers (see Figure 1).
|Figure 1: Basic MCU power modes.
Applications involve a set of preset operating modes that differ markedly with respect to their processing needs. The embedded microcontroller can utilize one of its many peripherals to sample signals from its surrounding environment. The microcontroller might have nothing else to do until the peripheral collects a certain amount of samples. Therefore, the microcontroller might "sleep" or enter an extreme, low-power "standby" mode in between each data sample. Once the application reads enough data samples, the microcontroller can easily switch to a "fully on" mode, where it is awake and running at maximum operating speed.
To emerge from its various power-down modes, the microcontroller typically receives some type of wake-up event. This event could be triggered by an external stimulus, such as an I/O pin toggle, or by internal processor activity, such as an interrupt event caused by a timer peripheral. Microcontrollers differ in the exact power modes they support, but there are usually some commonalities among the various power modes. Typical power modes include:
"Always on" mode
- An "always on" mode
- A "sleep" or "standby" mode, where memory stays powered
- A "hibernate" or "deep sleep" mode, where the memory is unpowered for maximum power savings
"Always on" mode, embedded systems consist of devices that are continuously powered and in a running state. In these systems, the average power requirements are most likely in the sub-milliampere range, which directly limits the microcontroller's achievable processing performance. Fortunately, next-generation embedded microcontrollers can dynamically control their clock switching frequency to help reduce active current consumption when higher computing power is not needed."Standby" mode
In "standby" mode, the system is either on, or in a low-power inactive mode. For these systems, both active and standby current consumption are very important. In most "standby" mode systems, the embedded microcontroller can retain all of its internal states and the contents of its memory because it is still powered, although at a greatly reduced current draw. Additionally, the microcontroller could wake up in a few microseconds. These types of systems typically spend most of their time in this low-power mode, but they also require fast startup capabilities to catch an external or time-critical event. Keeping the memory powered helps to keep both the software parameters and the current state of the application software intact. Typical startup times from this power mode are usually in the 5 to 10 µs range."Deep sleep" mode
In "deep sleep" or "hibernation" mode, the system is either fully on, or in an extreme, power-saving mode. This mode is of particular interest because it achieves maximum energy savings by entirely powering down the embedded microcontroller core, including the on-chip memory. Therefore, any critical information must be written to non-volatile memory prior to entering "deep sleep" mode. This mode reduces the power consumption of the microcontroller to an absolute minimum, sometimes as low as 20 nA. Additionally, all memory parameters need to be reinitialized after wake-up, which adds to the overall wake-up reaction time. Typical startup times from this mode are usually in the 200 to 300 µs range.
In extreme low-power saving mode systems, battery life (see Table 1) is often determined by the current consumption of the other components in the circuit. Care should therefore be taken to look at not only the current consumed by the microcontroller, but also the current consumption of the other components on the Printed Circuit Board (PCB). For example, designers can use ceramic capacitors instead of tantalum capacitors where possible, as the latter typically have larger leakage currents. Designers can also determine which other circuits are powered in the low-power state of the application.Taking advantage of power modes
Next, consider a representative situation, where the choice of a microcontroller's power modes can make a big difference in overall power usage. Think about a basic remote temperature sensor (see Figure 2) that collects data over a long time period, perhaps manipulating it using a more sophisticated noise-filtering algorithm, and then puts the microcontroller back into a "standby" mode until more sample measurements are required. This application also reports the temperature information to a centralized control console using wireless Radio Frequency (RF) transmissions.
|Figure 2: Remote temperature sensor.
At regular intervals, the Real-Time Clock and Calendar (RTCC) wakes the MCU from "sleep" mode and determines if there is another task to perform. If not, it puts the MCU back to sleep (see Figure 3). Sampling temperature (see Figure 4) requires the use of the MCU's on-chip Analog-to-Digital Converter (ADC) and only a modest amount of processing power. During the noise-filtering phase (see Figure 5), the microcontroller must use a higher processing power mode to calculate an advanced filtering algorithm and store the results back into memory as quickly as possible. Therefore, the overall amount of time the microcontroller spends running and consuming power is reduced.
|Figure 3: The RTC wakes up the MCU at regular intervals.
|Figure 4: The MCU takes a sample from the sensor and returns to "sleep" mode.
|Figure 5: The noise filter manipulates the clock and executes its algorithm before returning the MCU to "sleep" mode.
Every so often, at predefined time intervals, the microcontroller combines all of the sample results and transmits them to the central control console (see Figure 6) using an RF transceiver device. Accurate timing is needed to ensure that the wireless sensor transmits this information during a predefined assigned time slot, thereby allowing multiple wireless sensor nodes to work together within the same system.
|Figure 6: Finally, the MCU transmits the sensor data to the remote console.
How do we manage the rate at which the processor wakes up? Using an integrated 32 kHz oscillator circuit combined with a timer peripheral, the microcontroller can very accurately generate interrupts once per second, allowing it to keep accurate time. This interrupt event also enables the microcontroller to fill the sampling buffer with temperature data on a predetermined schedule.
After the microcontroller fills the temperature-sampling buffer, it switches to a higher processor speed mode, completes the more sophisticated noise filter algorithm calculation, and returns back to sleep as quickly as possible reducing the amount of "on" time. The microcontroller uses this same real-time clock feature to determine whether it is time to transmit any captured data samples back to the central control console. Determining the optimum power mode for the microcontroller to achieve the absolute lowest overall current consumption depends upon various factors.
Optimizing power consumption in low-power applications
To minimize overall power consumption, it is not enough to simply select the lowest-power mode on the microcontroller. We must also determine the amount of work needed to complete each of the microcontroller tasks — for example, sampling the external temperature sensor. Once we've determined the performance requirement for each task, we must also determine the optimum energy usage for each task. Remember that energy = time × voltage × current. Normally, we cannot vary voltage levels, because these are determined by overall system needs and the actual source of power. So the two attributes we can adjust are time and current. We need to analyze the trade-offs between time and current consumption for the microcontroller. Let's look at some microcontroller-specific parameters that need to be kept in mind when performing this analysis.
When we put the processor into a low-power mode, a number of external sources can wake it up. This wake-up event might occur via a USB event, a real-time clock event, or even an external trigger on an I/O pin. The time the microcontroller takes to wake up and start executing code from the low-power "sleep" mode is very important. We typically try to keep this time as short as possible. This is also where it becomes important to select between the "sleep" and "deep sleep" modes of operation. If the microcontroller wakes up once every second, the "sleep" mode is probably the best option, seeing that it can start executing code within 10 µs without first initializing any software memory locations. If the microcontroller stays in the low-power state longer — for example, minutes or even hours at a time — the "deep sleep" mode might be the best option. The key is to keep the overall current consumption of the microcontroller to an absolute minimum. If a longer low-power down time is used, the 300 µs wake-up time is minuscule compared to minutes or hours of "deep sleep".
Another good example of a system-level wake-up event can be demonstrated with an external RF chip that connects to the processor via a serial interface. When the processor is not in use, it can be placed into one of the low-power states, with only the RF chip running. The logic in next-generation RF chips consumes very little current in this operating state, as it is only looking for incoming RF data packets. Once a valid data packet associated with the unit's assigned address is received, it will wake the microcontroller to start processing the information. This type of power mode scheme is more often used in radio network-based solutions, such as a ZigBee based wireless protocol.
A microcontroller derives its system clock frequency from either an external or an internal clock source. The microcontroller divides this clock frequency by the operating frequency that is needed by the application software. Lower frequency typically translates to lower power consumption. Sometimes, the microcontroller can also multiply the external clock frequency by means of a Phase Locked Loop (PLL). The external clock signal normally comes from a crystal or crystal oscillator.
Microcontrollers can also disable the input crystal amplifier circuit when the device enters a low-power mode, saving perhaps several milliamperes of current draw. One trade-off comes in the form of increased oscillator turn on time (due to the startup delay of the external crystal) when it resumes. However, some microcontrollers use a two-speed startup mode, where they immediately start running from an internal oscillator, then automatically switch over to the external and more accurate clock source once they have had enough time to stabilize.
The microcontroller's ability to control its own clock frequency allows software engineers to pick the appropriate clock speed needed for a specific task while minimizing overall current consumption. For this, engineers need to evaluate the time × current elements of the energy equation to determine if it is better to run at full speed for a shorter time period, slower for a longer time period, or something in between.
In our remote wireless sensor application example, the system needs to maintain an accurate sense of time. This can easily be done using an RTCC peripheral, in addition to the system clock. The primary function of an RTCC is to track the date and time. However, in our case, the RTCC is very useful for controlling power modes. The RTCC also allows the microcontroller to schedule accurate wake-up events, trigger sample measurements, or initiate RF synchronization with the centralized control console.
There are numerous ways to implement an RTCC in your system. The first is to use a dedicated RTCC chip that connects to the microcontroller. The second is to use an integrated 32 kHz crystal oscillator with some basic timekeeping software. The third method is to have a dedicated RTCC peripheral on the microcontroller. System cost constraints typically eliminate the first option immediately. The choice between the last two is typically driven by the application's other needs for the microcontroller and to some degree, cost. This discussion will utilize the second option, a 32 kHz oscillator with some very basic software.
The external 32 kHz crystal oscillator drive circuit, combined with a 16-bit timer, is used to wake the processor up once every second. The processor then updates the RTCC timer, possibly measures the current temperature, then returns to its low-power mode. This approach provides a very low "on" duty cycle scheme and only draws 600 nA for the majority of the device's operation, ensuring extremely long battery life (see Table 1).
|Peak RF Transceiver Current
|Display Update Current
|MCU "Sleep" Current
|32KHz Oscillator Current
|# of Wake Up Events for Calendar Update
||86,400 times per day
|Charge in "Sleep" Mode as Percent of Total
|Battery Life Estimate
Table 1: Usage scenario for a 3 V CR2032 coin cell with 225 mAh capacity and self-discharge at 1 percent per year.
Building an RF wireless sensing node
The availability of single-chip, highly integrated, universal ISM-band FSK transceiver solutions combined with low-power microcontrollers makes the implementation of these wireless sensing applications easy. The microcontroller connects to the radio device through a serial communication port, in this case an SPI interface. The microcontroller is also used to initialize the radio configuration settings on the transceiver device. Once configured, sending data and receiving RF data is handled mostly by the transceiver device through very basic serial commands from the microcontroller. By simply combining these two technologies, a basic network can be constructed that remotely monitors various wireless sensor nodes, both digital and analog, such as in our remote temperature sensor example.
Looking at the overall power budget of the wireless system, the datasheet parameters we are most interested in are the transmit power consumption, the receiver power consumption, the standby power consumption, and the startup time of the radio. Knowing all this, we can determine how much current the unit will consume when transmitting and receiving data through the wireless RF channel. Two other key aspects to keep in mind when developing an RF solution are the data length of the transmission and security. The next section will briefly touch on these two aspects.
RF transmission time
An important parameter that is normally overlooked is the length of the RF data packets that need to be transmitted. In fact, RF transmission time has a major impact on the performance, quality, and power consumption of a wireless solution. Using shorter packet sizes will help reduce the amount of energy needed from the power source, and even help to reduce the size of the battery. When defining a new low-power RF protocol, this trade-off must be kept in mind.
For this wireless temperature sensor design, we've evaluated various RF communication protocols that are available today. Protocols such as ZigBee, ZigBee Pro, Microchip's MiWi, and MiWi P2P (peer-to-peer) protocols were all evaluated. Because of the low-power behavior needed for this application, we've decided to use a very basic Time Divisional Multiple Access (TDMA) time-sliced protocol scheme.
By assigning predefined time slots within the RF data frame and using the first as the start-of-frame marker sent by the centralized microcontroller, we can easily ensure precise timing latency within the overall sensor-monitoring system, while also reducing power consumption. Using this basic time-slicing scheme, both the microcontroller and the RF transceiver can spend most of their life in the lower power "standby" mode.
Recognizing the security issues involved with wireless networks, most RF systems employ strong algorithms to protect the data. The adoption of the Advanced Encryption Standard (AES) with a 128-bit key length ensures data integrity and resistance to hacking, both highly important for commercial applications. AES security can be implemented in software. Being able to execute the AES calculation as fast as possible is important for wireless sensor nodes that need to minimize the amount of wake time, during which the nodes consume most of their power. Microcontrollers can dynamically change their processing power as needed to help to achieve this goal. This goes without saying for battery-operated devices, but it also holds true for wired systems. Power consumption has thermal, size, and financial impacts upon all systems, wired or wireless.
As we all know, when designing a system, such as our wireless temperature sensor, total system cost always plays a very important role. A key factor in determining the cost of wireless microcontrollers is the amount of program and data memory required. Developers of sensor networks and related products expect to have access to a range of microcontrollers with optimized memory footprints to meet the needs of their applications. The development of larger applications, based upon network protocol layers such as ZigBee, requires larger memory footprints, greater than 250 KB in some instances. If you can implement a simpler transmission protocol, especially in extremely cost-sensitive designs, a lot of these microcontroller power control features can be used to minimize cost and power consumption.
The design example in this article uses a single, highly-integrated universal ISM band FSK transceiver chip, combined with an extremely low-power microcontroller. The extreme low-power PIC16LF1827 microcontroller was used in the sensor unit to measure the analog temperature sensor (once per second), store results in a data buffer, run the complex noise-filtering algorithm, and transmit the resulting data using the RF transceiver. For security reasons, this information was secured using the AES algorithm and transmitted at a predefined assigned time slot. Additionally, the microcontroller initializes the RF transceiver radio configuration settings after power-up, and controls the power mode on the radio as needed.
This article showed the ease of implementing a very basic, low-power wireless sensor network. By better understanding the various power management features found on extreme low-power microcontrollers, system engineers can develop "green" wireless solutions. By simply picking the right extreme low-power microcontroller and RF radio products, properly reviewing all system-level task requirements, and then utilizing the microcontroller's power management settings, the system can be kept in a low-power "sleep" state, resulting in a lower-cost, extremely low-power solution that gets the job done.
Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Corporation or official policies of Digi-Key Corporation.