Introduction
Historically, prototyping wearable designs has been difficult. The core issue is form factor. Most off-the-shelf development boards and systems are designed for desktop environments where size and weight are not critical.
Larger board sizes let manufacturers use relatively simple PCB production lines to provide low-cost development support. Relatively abundant board space also supports traditional plug connectors for expansion. The large pin sizes and pitch on those plug connectors make it easy to use disposable breadboards and very low-cost prototyping services for custom I/O extensions.
Although powerful systems can be built using desktop-oriented development platforms that implement wearable functionality, they fail the usability test for trial users and early adopters who expect something closer to a real product. Uncomfortable, bulky fitness wearables cannot meet usability and in-theatre testing needs. What is required is a platform that offers much of the flexibility of traditional development boards while having a form factor appropriate for wearable designs.
Hexiwear Platform Overview
Platforms such as MikroElektronika's Hexiwear provide a way to build and test applications in real user environments. The Hexiwear platform centers on an integrated MCU and peripheral solution offered in a wearable form factor with an open development environment. More importantly, it uses a compact hexagonal module package that can easily attach to a wristband to serve as a smartwatch supporting the Internet of Things, or it can be mounted in a pendant, used as a brooch, or integrated into clothing.
The form factor is also suitable for a broader smart home environment and can be deployed as a removable element in wall-mounted modules or larger mechanical systems. Hexiwear-based smart home projects include smart bathroom scales that transmit measured weight to a user's smartphone, doorbells that report activity to homeowners and display custom messages to visitors, and smart refrigerator magnets that report internal temperature to the Hexiwear display.
The Hexiwear platform is based on the 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).

Sensors and Connectivity
The wearable includes a Bluetooth Low Energy (BLE) SoC and eight sensors optimized for health and typical IoT applications, such as a 6-axis accelerometer and magnetometer, a 3-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 use an I2C bus for communication. Expansion is available via MikroBUS, arranged as two parallel eight-pin headers. This allows connection of MikroElektronika Click boards as well as custom extension modules and third-party modules. The MikroBUS connector pin spacing is designed to be compatible with standard 100 mil pitch breadboards, simplifying initial prototyping on custom I/O modules.
MikroBUS exposes multiple serial I/O buses and provides analog, PWM, and interrupt pins. In addition to I2C, connections are available via SPI and UART. Available Click modules include modules such as GPS receiver, RFID reader, GSM transceiver, and even a lightning sensor based on a coil antenna.
Motion Sensors and Sensor Fusion
The motion sensor suite on Hexiwear enables applications beyond wearables and home devices. The combination of accelerometer, gyroscope, magnetometer, and pressure sensor makes it possible to create an inertial measurement unit with up to ten degrees of freedom for navigation without GPS. One user has used this capability to create an onboard flight monitoring system for aerial photography drones and quadcopters. Hexiwear's small size and light weight support unmanned applications by providing accurate feedback on position and heading in low-visibility conditions. When used with sensor fusion techniques, the different motion sensors help compensate for each other's weaknesses. The pressure sensor improves altitude accuracy.
Accelerometers such as the NXP FXOS8700CQ use 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 a change in capacitance. By tracking these capacitance changes, the sensor interface detects acceleration along the direction of cantilever motion. Three orthogonally mounted elements provide three-axis detection.
The oscillatory behavior of the moving mass in an accelerometer results in short-term capacitance changes and sensitivity to vibration. Conversely, gyroscopes are based on vibrating micro-mechanical elements that register increased amplitude when the device rotates. Like larger rotation-dependent gyroscopes, MEMS gyroscopes are relatively insensitive to short shocks and external vibration. However, gyroscopes are prone to drift and are more temperature sensitive.
Combining gyroscope and accelerometer readings with the magnetometer readings in the FXOS8700CQ allows elimination of most motion noise sources. In relatively simple sensor-fusion applications, a complementary pair of filters can remove much of the noise for each sensor type (Figure 2). For example, when calculating tilt angles from angular data, a low-pass filter helps remove short-term errors from accelerometer readings converted to angular coordinates, while a high-pass filter removes long-term drift and temperature-induced variation from gyroscope data. Comparison with magnetometer readings can provide heading confirmation.

Applications: Fall Detection and Cardiac Monitoring
These sensors can be applied and combined for wearable applications developed with Hexiwear. One example is a fall detector for the elderly. Another example is a personal cardiac monitor for people wishing to improve their health. Both applications demonstrate the effectiveness of sensor fusion and the ability of multiple sensor types to produce reliable outputs.
Applying the sensor-fusion techniques used in the drone example to a fall detector produces a sensor that is less likely to generate false alarms due to short-term noise on the accelerometer input. When worn on a belt or wrist, the gyroscope will detect rotation of the body or arm during a fall, and the accelerometer will record a sudden increase followed by a sudden stop and then smaller movements over time. Software can identify the pattern associated with a fall. Many studies have characterized typical motion curves for falls, which help set appropriate thresholds for a fall detector. Machine learning techniques trained on motion data captured from fall tests have been shown to help develop more robust detection algorithms.
People recovering from major congestive cardiac events can use sensors deployed on Hexiwear in a similar fashion. In this case, inputs include signals from a Maxim MAX30101 heart-rate sensor. Light exercise is important for recovering from congestive heart failure, but avoiding overexertion is also important. By tracking activity combined with heart rate, a wearable application can help determine whether a patient is meeting exercise goals without experiencing excessive stress. Abnormal heart-rate readings relative to activity can trigger alerts relayed by a host smartphone to healthcare providers. Heart-rate data can similarly enhance fall detection to help determine the wearer’s condition after an event.
Software and Development Tools
When building wearable devices or other sensor-driven applications with Hexiwear, the hardware I/O, processor, and sensors are only part of the equation. To simplify application creation, the platform is supported by a complete open-source toolchain and libraries available through online repositories such as GitHub and ARM's mbed codebase. These libraries include modules for cloud connectivity, providing access to services such as WolkSense and similar services.
The core of the Hexiwear development kit is the Kinetis Software Development Kit (SDK). This is an Eclipse- and GNU-based toolchain. The IDE is based on Eclipse, and the GNU Compiler Collection (GCC) and GNU Debugger (GDB) provide compiler and debugging support. After installing the Kinetis tools, users can add modules from the Hexiwear GitHub repository. Another development environment is Zerynth, which offers a way for programmers familiar with Python to start developing for the module.
GitHub downloads include example bootloaders and project files that serve as templates for target applications. Typically, downloads and hardware support are enabled via the Hexiwear dock, with drivers downloaded from mbed handling USB communication.
Example code modules on GitHub often use a simple loop main() structure. The application executes each statement in main(), then loops back to the start. A common strategy to prevent an always-on, battery-powered platform from being overly active is to insert a wait(x) function at the end of the main() loop. Even with such a simple structure, the core of a health-monitoring wearable application is present. Many modules in the Hexiwear GitHub repository support operating systems such as mbed OS or FreeRTOS, which offer more flexible options that can instantiate multiple cooperating threads 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 via BLE. In a simple main() structure, the easiest organization is to poll sensors of interest on each pass, filter the data, and buffer processed values. Although communicating data over BLE on every pass is possible, it can quickly deplete the battery and is often unnecessary. One method is to implement a global counter variable and buffer data in a queue on each pass until a counter threshold is reached. A simple if-then statement can determine whether the BLE access function should be triggered. That function collects data from the buffer, reestablishes connection to the smartphone, and sends the data.
The BLE module can be accessed through C++ classes defined in the Hexi_KW40Z.h header file, providing many functions for sending and receiving data over BLE. The default class includes packet definitions set up for transmitting health data and weather and motion sensor data.
In a multithreaded implementation mediated by an OS such as mbed, the application can be divided into multiple threads. In a health monitor, a common structure feeds one or more sensor logging threads into processing and filtering threads. A separate thread handles BLE communication. One strategy is to use timer interrupts accessed via callback functions to periodically wake threads. The BLE communication thread’s period is typically longer than the sensor logging threads’ period. These threads can buffer their data so that the filtering thread runs as infrequently as the BLE communication thread.
However, when the monitor must respond quickly to abnormal data and issue alerts, it may be important to process and filter data as quickly as possible. In that case, a separate BLE thread may be required to send alert messages in response to triggers identified by the processing thread. Alternatively, the BLE thread can use flags that indicate it should wake to send an alert and the associated data. The choice depends on how quickly the smartphone application must respond. In many cases, BLE timing intervals are short enough to support the latter architecture.
Conclusion
Functionality can be easily extended by using additional Click modules to detect environmental factors such as humidity that may be relevant to the wearer. The Hexiwear platform therefore provides flexible and easy-to-use support for a wide range of IoT applications. It is suitable not only for wearables but also for other sensor-oriented devices.