How to Efficiently Detect Motion in Wearable Devices
Consumer and medical wearable device designs bring unique challenges for developers in terms of small size, low power, and high functionality. With more integrated sensors such as accelerometers and gyroscopes, developers must find the right sensor and microcontroller combination that also ensures optimal balance between accuracy, resolution, and power consumption to extend battery life.
This article will describe how to balance power and performance in wearable devices. It will then discuss sensor selection before introducing sample sensor solutions and how to apply and power them.
Balancing power consumption versus performance
The most common wearable application is fitness or health monitoring, so all wearables contain sensors that measure some external parameter and feed it to the system microcontroller. Given the size and cost constraints and the need for a positive user experience, the most important design target to meet when designing a wearable device is to extend battery life. As a result, the choice of components is extremely critical; it’s not uncommon for wearable developers to take months making sourcing decisions for less than a dozen components.
For embedded systems, power consumption typically increases as performance increases. This requires the developer to perform a balancing act, selecting components with the right combination of performance and power. Selecting components with a high degree of flexibility allows developers to experiment during the development cycle to find this balance.
Microcontrollers and some sensors are usually programmable enough so that this balance can be achieved during firmware development. For example, microcontrollers have a sleep state where most internal circuits are turned off, reducing power consumption to a trickle. While some sensors often have sleep or low power modes, many also have adjustable sampling rates. This is important as the power consumption of a sensor increases linearly with the sampling rate, so firmware developers can experiment with sampling rates while monitoring the power consumed.
Selecting sensors
The most common sensor for a wearable is an accelerometer to sense the change of movement of the system. Gyroscopes sense angular rotation around an axis, which can be used to sense the direction of that movement. Here are the key factors to consider when selecting a typical accelerometer and gyroscope:
Size and shape: Given the size and weight constraints, the first criteria to look at when selecting sensors is size and shape. No matter how impressive the specifications, if it won’t fit inside the enclosure it’s a no-go, and any unnecessary weight can affect the user experience.
Power consumption: Many small sensors are designed specifically for small, battery-powered applications where power consumption is critical. Look for sensors that are 5 mm x 5 mm or smaller.
Accuracy and resolution: Look at the accuracy and resolution requirements of the application and then select sensors that handily beat these requirements. This simplifies development and saves time. It also allows the device to accommodate firmware updates that may be required to improve accuracy if a problem occurs, or if requirements change. A 12-bit resolution or more is common for most wearables.
Microcontroller interface: Look at how the sensor interfaces to the microcontroller. There are two types of interfaces, analog and digital. Analog interfaces output a voltage proportional to the value of the environmental behavior being sensed. These have limited use in wearable applications because they require the microcontroller to use a power-hungry analog-to-digital converter (ADC) or comparator. A serial digital interface, such as I2C or SPI, is preferred. Many modern sensors have both available.
It can be time consuming to find the right sensors from all the suppliers available by the criteria listed above. However, authorized distributors like Digi-Key Electronics make this easier by providing online resources for sensor selection. For example, Digi-Key’s online selection page for accelerometers greatly simplifies sensor selection by criteria, turning an afternoon’s sourcing exercise into a few minutes work.
Some suppliers, such as Bosch Sensortec, have entire product lines targeted specifically for wearables. These feature low power, small size, and flexible modes for balancing accuracy versus power.
For example, the Bosch Sensortec BMA423 is a 3-axis, 12-bit accelerometer that comes in a 12-pin LGA package measuring 2 mm x 2 mm (Figure 1). It can be configured to support either an SPI or an I2C interface and has programmable acceleration ranges of ±2 g, ±4 g, ±8 g, and ±16 g.
The BMA423 can be called a “smart sensor” because it takes the raw data of the internal accelerometer and internally processes the data to provide useful results for the developer. This takes some of the processing load off of the microcontroller and speeds development. When used in a wearable fitness application it can detect if the user is standing still, running, or walking.
Figure 1: The Bosch Sensortec BMA423 is a small 3-axis, 12-bit accelerometer for wearables that has a footprint of 2 mm x 2 mm and a height of 0.95 mm. (Image source: Bosch Sensortec)
The BMA423 is designed to minimize external component count as shown in Figure 2. For noise immunity, it is recommended to use 100 nanofarad (nF) decoupling capacitors between VDDIO and ground, and between VDD and ground. These capacitors can be omitted to save precious space, but there may be a loss of accuracy.
Figure 2: The Bosch BMA423 3-axis accelerometer is designed for minimal parts count and simplifies board layout when using the I2C interface. (Image source: Bosch Sensortec)
Bosch Sensortec provides firmware for all its sensors. On powering up the BMA423, it goes through an internal Power On Reset (POR) sequence. After system POR, the microcontroller should run Bosch’s BMA423 initialization procedure to properly configure the chip.
The initialization procedure first reads the internal chip ID and compares it with the chip ID stored in firmware. This verifies that the BMA423 is available and is communicating properly with the microcontroller. Next, the initialization procedure runs a short self-test to verify proper operation, the results of which are sent back to the microcontroller. Once the device is initialized, it is in Performance Mode, the highest power and highest performance state for the sensor.
The BMA423 has many features for low-power operation including a 1024 byte wide FIFO. This lets the accelerometer sense and store data while the microcontroller is in a low power or Sleep Mode. This saves power during non-real-time applications by not requiring the microcontroller to constantly communicate with the BMA423. Once the accelerometer data in the FIFO has reached a pre-programmed FIFO level, an interrupt is generated to wake up the microcontroller, which then vectors to the driver subroutine to read the FIFO data.
The lowest power mode for the BMA423 is Suspend Mode. During Suspend Mode, no internal accelerometer measurements are performed, while the state of the FIFO and internal registers are maintained.
To reduce operational power in non-real-time applications, the BMA423 should be put into Low Power Mode instead of its default Performance Mode. This turns off sections of the BMA423, including the external I2C and SPI interfaces, while logging data into the FIFO. While in Low Power Mode, the BMA423 regularly changes between Performance Mode and Sleep Mode according to a sampling rate set by a firmware programmed duty cycle. The lower the sampling rate, the lower the BMA423’s power consumption. Tweaking this duty cycle balances the accuracy required against the sensor’s power consumption.
When using the BMA423 in a fitness wearable application, development is made easier by using the Interrupt Feature Engine. It acts like a pedometer to automatically detect the number of steps taken, and detect if the user is walking, running, or standing still. It can also detect if the user tilts the wearable, detect the shock of a double or single tap on the device, or detect if the device is moving or not. Using the feature engine instead of writing custom code simplifies development.
For more complex wearable applications requiring extreme accuracy, an inertial measurement unit (IMU) sensor can be used. IMUs incorporate an accelerometer and a gyroscope in one package. The Bosch Sensortec BMI160 IMU has a 3-axis 16-bit microelectromechanical systems (MEMS) accelerometer and a 3-axis 16-bit MEMS gyroscope in one package. The IMU accelerometer performs all the functions of the BMA423, while the gyroscope lets the device detect direction of motion. This allows the BMI160 to determine relative position, distance and speed, but at lower power than a GPS. However, it is often used to augment a GPS in more advanced wearables. In such applications, a GPS provides absolute position and location information, but if a GPS signal fades, the IMU can keep track of motion and acceleration until the GPS signal is re-acquired.
The package of the BMI160 is similar to the BMA423, except the footprint is 2.5 mm x 3.0 mm with a height of 0.83 mm. Like the BMA423, it also supports I2C and SPI interfaces, and has a 1024 byte FIFO.
Dead reckoning using an IMU
Accelerometers do not sense constant velocity, only changes in it. However, velocity can be calculated by taking the integral of acceleration data over time. For acceptable accuracy, this requires an accelerometer with 16-bits of resolution or better. The higher the sampling rate, the more accurate the estimate of velocity, which can then be used to calculate the distance travelled. In the past, estimating velocity and distance with consumer grade IMUs used to introduce small errors that accumulated over time. However, modern advancements in MEMS sensors have made dead reckoning using consumer-grade IMUs more practical.
Like the BMA423, the BMI160 accelerometer can also detect if the user is walking, running, or standing still. By combining the distance travelled, as calculated from accelerometer readings, and the direction of movement calculated from gyroscope readings, sensor fusion calculations can determine the position of the unit.
To speed development, the Bosch Sensortec Environmental Cluster (BSEC) Fusion Library for ARM™ microcontrollers is available for download. This is a complete sensor fusion suite that is compatible with the LPCXpresso™ LPC54102 sensor processing/motion evaluation board from NXP Semiconductors. This board comes with options for evaluating several Bosch Sensortec MEMS sensors, which most recently includes the BMI160.
Figure 3: The NXP LPC54102 sensor processing/motion evaluation board can be used to evaluate many Bosch Sensortec MEMS sensors, including the BMI160. (Image source: Bosch Sensortec)
The BSEC Fusion Library is included with the NXP LPC54102. The evaluation board can be powered by the USB connector or by an external power supply. Development is accomplished by first installing the included LPCXpresso software on a PC. The connection to the LPC5102 is made by starting the LPCXpresso software, and following the simple on-screen instructions. Once connected, the BMI160 demo program can be downloaded and installed.
Wearables and batteries
As wearables get smaller and more powerful, battery suppliers are challenged with producing smaller and higher capacity batteries. TinyCircuits manufactures two small batteries for wearables. The TinyCircuits ASR00011 is a 3.7 volt lithium ion battery rated at 70 mAh. It has a fully charged voltage of 4.2 volts, and completely discharges down to 3.0 volts. The battery uses a micro JST SH 2-pin 1.25 mm female connector (Figure 4).
Figure 4: The compact TinyCircuits ASR00011 3.7 volt lithium ion battery measures 16.0 mm x 15.0 mm x 5.0 mm and weighs 1.65 grams, small enough for a fitness watch. (Image source: TinyCircuits)
If more battery capacity is needed, the TinyCircuits ASR00008 3.7 volt lithium ion battery is rated at 1100 mAh. At 42.0 mm x 39.0 mm x 5.5 mm it’s too big for a fitness watch, but appropriate for a health monitor.
Conclusion
Wearables bring unique challenges to developers, requiring accurate sensors and low power in a small size. Electronic components suppliers are manufacturing devices specifically for wearables making component selection easier, while providing smart sensors with features that speed design.
Comment