ECE/Bas Novmember 2014 - page 36

electronica Nov 2014
36
M
ICROCONTROLLERS
clock, peripheral module clock, ADC clock
and flash clock. It’s a valuable design option
when application requirements differ between
function blocks. Each peripheral module also
has a separate stop control bit. This feature
allows software to exercise individual con-
trol of the MCU on-chip functions to further
reduce dynamic current.
The remainder of this article discusses the use
of a 32-bit low power microcontroller like the
RX100 in a real life application, in this case
a flow meter. This application is useful for
exploring and explaining various ultra-low
power system-design techniques. This applica-
tion highlights appropriate low-power design
techniques and/or options, and explains how
to best apply key features of RX100 MCUs.
Performance data is used to calculate the aver-
age current usage of this example design and
show the resulting battery lifetime.
Modern flow meters are evolving from simple,
manually read mechanical units to microcon-
troller based electronic versions with wireless
connectivity. More advanced designs offer
flexible monitoring and data communications,
allowing control by the central control system
of the utility company. Such advanced features
must be implemented despite the fact that the
meter is always on. Therefore, the electron-
ics must consume only miniscule amounts
of power on average. Battery operation is the
norm, since AC power is seldom available to
run the meter. Typical design specifications
mandate a battery lifetime of over 20 years. The
primary low-power requirements of an elec-
tronic flow meter can be grouped according to
the major functions the unit performs. Most of
the time, the micro-controller operates in the
lowest power modes, with just the real-time
clock (RTC) and low voltage detector (LVD)
running. Also, it’s generally recommended that
the SRAM be kept active so that it can store
intermediate processing results, eliminating
the need to continually write data to the flash
memory. Periodically, the meter wakes up
and makes a flow measurement. Key param-
eters (used for billing) are saved in non-vola-
tile memory so they won’t be lost if power is
interrupted. Communications with the central
control system are implemented via the serial
transceiver whenever data has to be collected
or updates implemented. Additionally, the volt-
age levels of the battery are checked regularly to
manage the MCU operating modes.
The following discussion of a typical flow
meter design looks in detail at key aspects of
its operation to obtain information essential
for estimating battery lifetime. For this exam-
ple, data is derived from an implementation
based on an RX111 chip (figure 2). The RX111
processor, memory and peripherals integrate
most of the flow meter functions. The main
peripherals used are the analog-to-digital
converter (ADC) that measures the output of
the flow sensor, an SPI port that connects to
the central controller that collects data from
a variety of meters, and another SPI port that
drives the LCD that shows flow-usage data
and system status. Additionally, the RTC of
the MCU keeps accurate track of the time
each measurement is made, and the low-volt-
age detector (LVD) continuously monitors the
voltage of the meter battery.
In order to estimate the power use and bat-
tery lifetime of the flow meter, it’s necessary to
identify key facts: the main functions that the
meter MCU has to execute, what modules are
utilised in performing the tasks, how often the
functions are performed, how long it takes to
execute those functions, and the current the
MCU uses in handling those tasks. Some of
the on-chip peripherals of the MCU, like the
RTC and LVD, operate continuously, while
others, like the ADC or SPI ports, are needed
for only short periods of time.
The function battery monitor checks the volt-
age level of the battery, producing information
that’s included in the operational status data
sent periodically to the central control system.
The battery monitor can also perform a tam-
per-detection task to determine whether or
not the meter has been subjected to an attack.
The measured battery voltage (and its varia-
tion over time) is used to adjust the frequency
of operation of various meter functions,
because by extending the time between oper-
ations as the battery level drops, battery life-
time can be extended. When battery voltage
gets too low, the monitor can initiate a going-
off-air signal that causes vital flow-usage and
system data to be stored in flash memory for
later retrieval and diagnostics. This operation
is seldom needed, so it isn’t included in the
battery lifetime calculation. System engineers
are urged to set the low-level warning trip-
point of the battery monitor high enough to
ensure that sufficient power remains for the
MCU to execute any last-gasp data collection,
security and safety tasks.
In the Flow Monitor function the MCU ADC
reads the output of the sensor to accurately
measure the flow rate. The data it provides
subsequently must be processed to determine
actual billable metrics. The requisite compu-
tations are well within the processing capa-
bility of the RX111 MCU. The function Send
Update communicates key data (flow rate,
battery level, quality of service, etc) to the cen-
tral control system. The time between send
and receive transmissions can be extended as
the battery runs down in order to conserve
battery power. The Flow Meter Receive func-
tion is activated on an as-needed basis by the
central controller. When the meter receives
update data, its MCU has to be able to quickly
perform important housekeeping functions
before executing the update. A basic func-
tion table, like the one shown in table 2, is a
convenient way to organise these basic oper-
ating functions. It shows the active peripher-
als associated with each meter function, how
often the task is performed, and how long it
takes the MCU to execute each function. The
data in table 2 comprise estimated values for
the MCU processing time required for each
function instead of measured values, because
the functions weren’t actually implemented.
Still, they are best conservative guesses based
on similar functions designed in other appli-
cations and are valid for these power-use cal-
culations.
Several implementation options typically exist
when designing a low-power MCU-based
system. One common software option is to
place the system in a power-down mode, and
then turn it on after a specified time interval
has elapsed. This option is called a periodic
wake-up. Applying this approach to the flow
meter design example, the following opera-
tional schedule was specified. Software wakes
up the CPU every second. The MCU has to
execute the Send Update function at each
10-minute interval, perform the Battery Mon-
itor task at each 1-minute interval and activate
the Flow Monitor function at each 1-sec-
ond interval. However, the Receive Update
function is different. It’s an exception to the
operational schedule because it executes asyn-
chronously to the MCU timebase whenever
the central control system requests it. For
Table 2. Functional characteristics of the flow meter
1...,26,27,28,29,30,31,32,33,34,35 37,38,39,40,41,42,43,44,45,46,...56
Powered by FlippingBook