Historically, wearable design has been difficult to prototype. The core issue is scale. Most off-the-shelf development boards and systems are designed for desktop environments where size and weight are not critical.
Larger circuit board sizes let manufacturers support low-cost development through relatively simple printed circuit board production lines. The relatively large board area also accommodates traditional plug connectors for expansion. The large pin sizes and pitches on these plug connectors make breadboards and very low-cost prototyping services easy to use for custom I/O extensions.
Although desktop-built, high-performance systems can perform the functions of wearable devices and guide initial development, they do not meet the needs of trial users and early adopters who must use a system as if it were a real product. For usability testing and other in-situ experiments, uncomfortable or heavy fitness wearables are not viable. What is needed is a platform that offers most of the flexibility of traditional development boards while having a form factor that makes sense for wearable designs.
Platforms such as MikroElektronika's Hexiwear provide a way to build applications and test them in real user environments. The Hexiwear platform centers on an integrated MCU and peripheral solution presented in a wearable form factor and supported by an open development environment. More importantly, it uses a compact hexagonal module enclosure that easily mounts to a wristband and functions as a smartwatch for IoT support. It can also be placed in a pendant ring, used as a brooch, or integrated into clothing.
The form factor is also suitable for a wider range of smart-home environments, where it can be deployed as a removable wall-mounted module or as a component inside larger mechanical systems. Hexiwear-based smart-home projects include a bathroom scale that transmits measured weight to the user's smartphone, doorbells that remotely report activity to homeowners and display custom messages to visitors, and refrigerator magnets that report internal temperature to the Hexiwear display.
At the platform core, Hexiwear is based on NXP's Kinetis K64F MCU, which uses an ARM Cortex-M4 core running up to 120 MHz and supports a variety of peripherals, including ADC, DAC, timers, and serial interfaces (Figure 1).

Figure 1: Block diagram of the core Hexiwear device. Image source: MikroElektronika
The wearable includes a Bluetooth Low Energy SoC and eight sensors optimized for health and other typical IoT applications, such as a six-axis accelerometer and magnetometer, a three-axis gyroscope, a pressure sensor, temperature and humidity sensors, and an optical heart-rate sensor. It also includes a 1.1-inch OLED color display.
Most onboard peripherals communicate over the I2C bus. Expansion is provided through MikroBUS, arranged as two parallel eight-pin headers. This allows connection of MikroElektronika Click boards as well as custom expansion modules and modules from other vendors. The MikroBUS pin pitch is designed to be compatible with standard 100-mil breadboards, enabling easy initial prototyping of custom I/O modules.
MikroBUS provides access to multiple serial I/O buses and exposes analog, PWM, and interrupt pins. In addition to I2C, peripherals can connect via SPI and UART. Click-format modules include GPS receivers, RFID readers, GSM transceivers, and even coil-based lightning sensors.
The motion sensor suite on Hexiwear lets the platform move beyond wearables and home applications. The combination of accelerometer, gyroscope, magnetometer, and pressure sensor enables the creation of an inertial measurement unit with up to ten degrees of freedom for GPS-free aerial navigation. One user applied this capability to create an airborne flight-monitoring system for aerial photography drones and quadcopters. Hexiwear's small size and light weight suit unmanned applications. The system supports low-visibility flight by providing accurate feedback on drone position and heading. When used with sensor-fusion techniques, the different motion sensors help compensate for each other's weaknesses. The pressure sensor improves altitude reporting accuracy.
Accelerometers such as the NXP FXOS8700CQ used in Hexiwear are based on MEMS structures. A single-axis accelerometer uses a flexible cantilever attached to electrodes, with a proof mass that can move relative to a second electrode. The overall structure acts as a capacitor. As the mass moves, the distance between capacitor plates changes, causing capacitance variation. By tracking these capacitance changes, the sensor interface detects acceleration along the cantilever motion axis. Three orthogonally mounted axes provide three-axis detection.
The tendency of the accelerometer's moving mass to oscillate leads to short-term capacitance changes and sensitivity to vibration. By contrast, a gyroscope is based on vibrating microstructures whose amplitude changes when the device rotates. Like larger rate gyroscopes that rely on rotating elements, MEMS gyros are relatively insensitive to short shocks and external vibration. However, gyroscopes are prone to drift and are more sensitive to temperature changes.
Combining gyroscope and accelerometer readings with the magnetometer in the FXOS8700CQ enables removal of most motion-noise sources from gyroscope data. In relatively simple sensor-fusion applications, a complementary pair of filters can remove the majority of each sensor type's noise (Figure 2). For example, when computing tilt angles from angular data, a low-pass filter reduces short-term errors from converting accelerometer readings to angle coordinates, while a high-pass filter removes long-term drift and temperature-induced variations from the gyroscope. Comparison with magnetometer readings can confirm heading.

Figure 2: Complementary filtering of accelerometer and gyroscope data.
These sensors can be applied and combined in Hexiwear-based wearable applications. One example is a fall detector for the elderly. Another is a personal cardiac monitor for users seeking to improve fitness. Both applications demonstrate the effectiveness of sensor fusion and the ability of multiple sensor types to produce reliable outputs.
If the sensor-fusion techniques used for drones are applied to fall detection, it is possible to build a sensor that is less prone to false alarms caused by short-term noise on the accelerometer. When worn on the waist or wrist, the gyroscope will detect body or arm rotation during a fall, and the accelerometer will register a sudden increase followed by a sudden stop and slight motion for a short time. Software can recognize this fall pattern. Many research papers have analyzed typical motion curves for falls, which can be used to choose appropriate thresholds for fall-detector applications. Machine-learning techniques trained on motion data captured during fall tests have been shown to help develop more robust detection methods. Combining data from multiple sensors reduces the risk of false positives while keeping false negatives low.
People recovering from major congestive cardiac events can use the Hexiwear-deployed sensors similarly. In that case, inputs include signals from the Maxim MAX30101 heart-rate sensor. Light exercise is important during recovery from congestive heart failure, but overexertion is also risky. By tracking activity together with heart rate, a wearable application can help determine whether a patient is meeting exercise goals without overexertion. Abnormal heart-rate readings relative to activity can trigger alerts relayed by the host smartphone to healthcare providers. Heart-rate data can also augment fall detection to help determine the wearer's condition after an event.
When building applications, hardware I/O, processors, and sensors are only part of the equation for using Hexiwear in wearable or other sensor-driven uses. To simplify application creation, the platform is supported by a full open-source toolchain and libraries available from online GitHub repositories and ARM's mbed codebase. These libraries include modules for cloud connectivity and access to services such as WolkSense.
The core of the Hexiwear development kit is the NXP Kinetis Software Development Kit (SDK). This toolchain is based on Eclipse and GNU toolchains. The IDE is Eclipse-based and supported by the GNU Compiler Collection (GCC) and the GNU Debugger (GDB). After downloading and installing the Kinetis tools, users can add modules from the GitHub Hexiwear repository. Another development environment is Zerynth, which provides a path to start module development for programmers more familiar with Python.
GitHub downloads include example bootloaders and project files usable as target templates. Typically, downloads and hardware support are enabled through the Hexiwear dock, with USB drivers from mbed handling USB communication.

Figure 3: Block diagram of the Hexiwear and dock combination. Image source: MikroElektronika
Example code modules provided on GitHub commonly use a simple loop main() structure. Applications execute statements in main() and then loop back to the start. A common strategy to prevent an always-on, battery-powered platform from excessive activity is to insert a wait(x) call at the end of the main() loop. Even with such a simple structure, the core of health-monitoring wearable applications is present. Many modules in the Hexiwear GitHub repository support operating systems such as mbed OS or FreeRTOS, which provide more flexible options, including multiple cooperating threads that can be triggered by hardware interrupts from various peripherals.
A typical IoT wearable application is an activity monitor that periodically reports status to a smartphone or tablet over BLE. In a simple main() structure, the easiest way to organize the application is to poll the sensors of interest each pass, filter the data, and buffer processed values. Although sending data over BLE on every pass is possible, it can rapidly drain the battery and is mostly unnecessary. One approach is to use a global counter variable and buffer data in a queue until a counter threshold is reached. A simple if-then statement can determine whether to trigger BLE transmission. This routine collects data from the buffer, reestablishes a connection to the smartphone, and sends the data. The Hexiwear front panel initially supports pairing with a target smartphone over BLE without requiring that functionality to be written into the application, at least for prototyping.
The BLE module is accessible through C++ classes defined in the Hexi_KW40Z.h header file. This provides many functions for sending and receiving data over BLE. The default version of this class includes packet definitions set up for transmitting health data as well as weather and motion-sensor data.
In multi-threaded implementations mediated by operating systems such as mbed, applications can be organized into multiple threads. In a health monitor, a typical structure feeds one or more sensor-recording threads into processing and filtering threads. Then a separate thread handles BLE communication. One strategy is to use a timer interrupt accessed via callback functions to periodically wake a thread. The BLE communication thread's period is usually longer than that of the sensor-recording threads. Threads can buffer their data so the filtering thread runs only as often as the BLE thread.
However, in monitoring scenarios, it can be important to filter and process data as quickly as possible to respond to anomalous data and trigger alerts. In that case, a separate BLE thread may be needed to send alert messages in response to triggers identified by the processing thread. Alternatively, a flag can be set for the BLE thread to use when it wakes to send an alert and data. The choice depends on how quickly the smartphone application must respond. In many cases, BLE timer intervals are short enough to support the latter architecture.
Conclusion
By adding extra Click modules, functionality can be easily extended to support detection of environmental factors such as humidity that may relate to the wearer. The Hexiwear platform therefore provides flexible and easy-to-use support for a variety of IoT applications. It is suitable not only for wearables but also for other sensor-oriented devices.
ALLPCB