*2.1. Sensors*

Motion can be monitored in several ways. A camera-based motion capturing system such as [6] can be used. These systems are highly accurate but expensive and cannot be used anywhere. Another method of monitoring movement that is more suited for our requirements, is by using an IMU. This type of sensor consists of several internal sensors. A 6 Degrees of Freedom (DoF) IMU is commonly used in recent works [7,8]. It has a constant drift in the resulting measurement data that cannot be corrected for. To eliminate this problem, our design uses a 9 DoF IMU in which the additional magnetometer provides a fixed reference. It consists of a Microelectromechanical Systems (MEMS) gyroscope, accelerometer, and compass. The IMU (ICM-20948 from Invensense ) [9] was chosen for its ultra-low power operating current and high accuracy. The gyroscope is set to ±2000 dps full scale, the accelerometer is set to ±4 G full scale and the magnetometer is set to ±4900 μT. The sample rate of all sensors is set to 50 Hz.

To obtain accurate orientation data, sensor fusion is needed. As used in [10], a Digital Motion Processor (DMP) can be very e fficient for running specialized sensor fusion algorithms. By o ffloading computationally heavy calculations from the main processor, the system can be more power-e fficient. The lack of control of the sensor fusion and calibration is a significant drawback. By implementing our own sensor fusion and calibration, we can implement the most suited fusion algorithms and have full control over the calibration. Some systems use sensor fusion algorithms like a Kalman filter [7], which provide very accurate results but can be computationally intensive. A complementary filter, which is very easy to process but typically provides less accurate results than a Kalman filter, is sometimes used. It uses a high pass filter for the gyroscope values and a low pass filter for the accelerometer values. This method of sensor fusion is inaccurate during long measurements with a lot of movement. In [8] for example, [8] use a complementary filter for measuring static angles, thus primarily depending on the accelerometer values. We need high dynamic accuracy with low processing power thus implemented a Madgwick filter [11], which combines the best of both worlds.

The algorithm runs on the central microcontroller (ARM Cortex M0+ microcontroller (EFM32HG) from Silabs) [12]. It is designed by [11]. By combining the e fficiency of this algorithm with a high accuracy, a bit of battery power is saved. Quaternions, a very good way of representing orientations, are used for the calculations. Figure 2 illustrates the functional block diagram of this filter with ⊗ a quaternion product, . q a quaternion derivative and qˆ a normalized vector. The algorithm has two adjustable parameters, β and *f*. β represents the error on the gyroscope measurements as the magnitude of a quaternion derivative. It determines the proportion of the correction value for the gyroscope. *f* represents the frequency of the measurements. The orientation is mainly calculated by integrating the changes in angular velocity from the gyroscope (1). At the same time, an orientation is calculated using the accelerometer and magnetometer values. A gradient descent algorithm, represented by , is used to find the most likely solution in the set of infinite solutions. (3) represents the measured orientation from the earth's magnetic field. In (4), the measurements are normalized and mapped to the plane of the earth. In (5) = *f*, the orientation from magnetometer and accelerometer values is calculated using a gradient descent algorithm. These values are normalized in (6) and used to correct gyroscope values with a factor β. These corrected gyroscope values are integrated in (2). Everything is further normalized in (7) to form unit quaternions and the results form is given as in Equation (1).

$$q = a + b \cdot i + c \cdot j + d \cdot k \tag{1}$$

**Figure 2.** Block diagram Madgwick algorithm [11].

By using quaternions, we avoid the gimbal lock problem, the inability to uniquely represent an orientation, of Euler angles. When for example the pitch angle is 90◦, yaw and roll cause the sensor to move in exactly the same fashion. Another problem is the inability to produce reliable estimates when an angle approaches 90◦ [13]. The benefit of the Madgwick algorithm is that we can run it at a very low speed and still ge<sup>t</sup> accurate results. At 50 Hz, the sample rate used by the sensor node, we ge<sup>t</sup> a static error of ±1◦ and a dynamic error of ±2◦ [11].

The sensor node goes to sleep as much as possible to conserve battery energy. When the sensor node is picked up, the always-on accelerometer generates an interrupt and wakes up the system. Figure 3 illustrates this procedure. When the Madgwick parameters are set correctly, just a small portion of the accelerometer and compass values are used to correct the gyroscope error. When the sensor node wakes from sleep, the gyroscope has no reference orientation thus it would take approximately 30 s to obtain a correct orientation, depending on how much the actual orientation, when the sensor is picked up, differs from the orientation in sleep. After wake-up, the parameters of the Madgwick filter are dynamically adjusted to obtain a correct orientation quicker. The accelerometer and compass are used in the first few seconds of activity to obtain a correct reference frame. After this, the parameters are automatically adjusted to a high accuracy mode. In this mode, the integration of changes in angular velocity from the gyroscope is mostly relied on for calculating the orientation of the node. The accelerometer and the compass are only used to make small corrections.

As a low power design consideration, inactivity is detected by checking the gyroscope values every second in an interrupt service routine, called from an Real Time Counter (RTC) interrupt. The gyroscope values are supposed to be zero when idle. This procedure automatically puts the sensor node in sleep when it is not used.

**Figure 3.** Flowchart code: The sensor node is calibrated once at initialization, a Wake On Motion (WOM) interrupt wakes up the system and measurements can start, an Real Time Counter (RTC) timer is used to periodically check the status of the sensor node to maximize autonomy.

## *2.2. Calibration*

Calibration is an essential part of motion capturing systems. With calibration, the accuracy of the measurements can be drastically increased. In this design, a manual one-time calibration is used. The manual calibration allows the use of a very energy-e fficient microcontroller and can yield calibration values with high accuracy. First, the gyroscope and the accelerometer are calibrated. This happens by simply putting the sensor node on a flat, leveled surface. During these measurements, no changes in angular velocity from the gyroscope or acceleration forces from the accelerometer are expected. The accelerometer and gyroscope are temporarily set to the most sensitive measurement range of ±250 dps full scale and ±2 G full scale to obtain the highest calibration accuracy possible. A few thousand measurements are taken by filling the First In First Out (FIFO) bu ffer of the IMU. From these measurements, a gyroscope and accelerometer bias o ffset is calculated and further subtracted from the actual measurements. After calibration of the gyroscope and accelerometer, the measurement ranges are changed back to ±2000 dps full scale and ±4 G full scale.

The compass is calibrated by rotating the device 360◦ around its three axes or performing a figure-8 movement. For these measurements, the maximum sampling frequency of 100 Hz is temporary used to have more data to work with and therefore obtain a better calibration. After calibration, the magnetometer sample rate is changed back to 50 Hz. The result of such a measurement is shown in Figure 4, a 2D visualization of the three planes of the 3D sphere after rotating the sensor node. Two types of distortions can occur on the IMU measurements: hard and soft iron distortions [14]. Hard iron distortions, caused by a permanent magnetic material, create a constant o ffset on the sphere. These o ffsets can be determined by calculating the center of the sphere and subtracting this value from the measurements. Soft iron distortions are caused by materials like iron. These materials do not create their own magnetic field but create a deformation on one or more axes. This will generally create an ellipse instead of a circle in a 2D plot. Soft iron distortions are more di fficult to correct. Each axis is multiplied with a scale factor to calibrate the measurements. The minimal and maximal compass values captured in the calibration procedure of each axis are measured determined. The span of the compass values for all three axes is calculated, as well as the mean span for the three axes. The scale factor per axis is thus mean divided by the span of the axis that will be corrected. Equation (2) provides the equation for the x-axis scale factor, exemplary for the three axes. The result of these corrections, with the three circles perfectly round and centered, is given in Figure 5, showing that the calibration procedure operates correctly.

$$\text{Scalefactor} = \frac{\max\_{\mathbf{x}} - \min\_{\mathbf{x}} + \max\_{\mathbf{y}} - \min\_{\mathbf{y}} + \max\_{\mathbf{z}} - \min\_{\mathbf{z}}}{3 \cdot (\max\_{\mathbf{x}} - \min\_{\mathbf{x}})} \tag{2}$$

**Figure 4.** 2D plot of a sphere after rotating the sensor node around each axis before calibration. The circles are not perfectly round (elliptical sphere in 3D) caused by soft iron distortions. Also, offsets between the centers of the circles and the origin, caused by hard iron distortions, are present.

**Figure 5.** 2D plot of a sphere after rotating the sensor node around each axis after calibration. The circles are perfectly round (near perfect sphere in 3D) and no offsets between the center of the circles and the origin are visible.

#### *2.3. Wireless Connectivity*

Many wireless connectivity standards for Wireless Body Area Networks (WBAN) are available. We here briefly comment on the most considered technologies given the application focus of the presented design.

ZigBee operates with very low power usage. It works on top of the IEEE 802.14.4 standard, has a range of up to 100 m, and can be implemented as a mesh network. The low data rates of up to 250 kbps at 2.4 GHz make ZigBee less suited [15]. A second wireless standard is Z-Wave, a low data rate communication protocol with data rates of 40 kbps—100 kbps and a range of up to 30 m. Since it uses the 900 MHz band, it is not bothered by interference from 2.4 Ghz wireless communication like WiFi. It is commonly used in home automation for interconnecting energy efficient sensor nodes. The master-slave type network has a typical latency of 200 ms [16]. A third wireless standard is Bluetooth. It is based on the IEEE 802.15.1 standard, has a higher data rate of up to 2 Mbps and a range of up to 100 m. The more advanced Bluetooth protocol is widely used for data and audio transmission. It uses a master-slave model for communication [17]. For the design of the low power sensor node, Bluetooth Low Energy (BLE) is more appropriate. This special Bluetooth version is specifically designed for applications with very low power usage. A maximal data rate of 1 Mbps

and a range of a few tens of meters can be achieved. BLE can use a master-slave model in a star topology or BLE devices can form a mesh network [16]. The advantage of BLE is its ability to directly connect to a smartphone or Bluetooth enabled device without the need for a separate receiving station. Following up with WiFi, based on the IEEE 802.11 standard with a very high data rate of 54 Mbps. The high power consumption makes WiFi less suited for a low power design [17]. We also studied the possibility of using a proprietary solution. The advantages are a possible further reduction in power consumption by packets with increased information density. Table 1 summarises the different wireless connectivity options in terms of power consumption, range, data rate and price. BLE is chosen for its low power consumption, sufficient range, relatively high data rate, low price, and high compatibility with existing devices.

**Table 1.** Comparison between available wireless technologies: ZigBee, Z-Wave, Bluetooth 5, BLE, and WiFi [15–17].


A WBAN is necessary for transmitting the measured data. BLE is chosen for its high throughput, minimal power consumption, and interoperability with other devices [16]. The Proteus II module (AMB2623 module from WE based on an nRF52832) [18] is chosen for its small form factor and integrated PCB antenna. The data is transmitted at 0 dBm.

The data packet, sent out at 50 Hz, contains a preface, the module ID of the receiver, the RSSI, the data, and a checksum for error correction. This is clarified in Figure 6.


**Figure 6.** Bluetooth Low Energy (BLE) data packet structure: The data is composed of a preface, the module ID, three Euler angles, the remaining battery charge (percentage) and a checksum.

The quaternions from the Madgwick sensor fusion filter are converted to Euler angle floats. The three floats each take up four bytes in memory [19]. Exactly those bytes will be read from memory and transmitted wirelessly to ensure no loss in accuracy. One byte is added to transmit the battery status.

To guarantee a low power design, some software features are added. When the sensor node is picked up and cannot connect to a receiving device within five seconds, the sensor node enters sleep mode. The automatic reconnection of the sensor node with the receiving device is also built-in.

The receiving device is based on a development board (STM32L4+ microcontroller on an ST NUCLEO L45ZI development board) [20]. The same BLE module is chosen for this device. To be able to receive the transmitted data fast enough, an interrupt-based method is used together with a circular buffer [21]. The UART interrupt receives data and stores it in the buffer in the background. The received data is processed independently in the main program. A second UART transmits the data to a pc. A 3D representation of the orientation is written in VPython for visualization purposes.

#### *2.4. Wireless Charging*

Inductive wireless energy transfer is mainly used to recharge batteries of smartphones, wearables or, Internet of Things (IoT) devices. Implementation standards such as Qi, PMA, or AirFuel ensure a safe, efficient transfer of energy. Low power applications, below 5 W, often use e.g., proprietary solutions such as the "LinkCharge Low Power" technology from Semtech. Wearable devices, Electric toothbrushes, or LoRa based sensors are some of the many applications for the implementation of this technology [22]. ST Microelectronics also o ffers wireless power solutions for Smartwatches, or IoT battery-powered smart devices. The last option is to design your own Wireless Power Transfer (WPT) system without using existing standards. Building more e fficient systems is time-consuming and not necessary since a lot of research has already been carried out in the 5 W WPT range.

In recent years, it has been generally accepted that the Qi is preferred over all other standards. The Wireless Power Consortium (WPC) manages and develops this standard. In the meantime, PMA, AirFuel and WPC have started a collaboration. All Qi-certified devices can communicate with each other. Charging a Qi-supported device can be performed by any Qi-certified charger. A series of functions in the standard ensures a safe charge cycle, such as thermal shutdown protection, foreign object detection, and overvoltage AC clamp protection [23].

The first wirelessly rechargeable smartwatches used proprietary WPT standards. New wearables switched to the Qi standard in contrast to wirelessly rechargeable smartphones, which were immediately equipped with the Qi standard. Recent smartphones are available with the option "Reverse Charging", which means that the internal smartphone coil can be used to charge devices that support Qi [24]. This new feature o ffers the possibility of recharging smartwatches with a smartphone. It makes sense that Qi was chosen above all other options for the sensor module. In most households, a Qi charger or a smartphone that supports reverse charging is available. Future measurements with this sensor can be used within families, as they can recharge their sensor modules at home.

We here further discuss the actual implementation of the battery charging circuit in the design of the sensor node presented in this paper. Since energy is transferred wirelessly via the Qi protocol, a Qi receiver IC was used. A TI Qi receiver IC (BQ51050) [23] was selected because of its high e fficiency, wireless power receiver, integrated rectifier, and battery charger in a single package. The BQ51050A variant, combined with a Li-Ion battery is chosen because of its 4.20 V output voltage limitation. It is paired with an inductor coil (760308101214 coil from WE) [25], chosen for its very small size and a relatively decent Q-factor. The charging current is 200 mA with a termination current of 20 mA to ensure fast and safe charging. Temperature control with automatic cut-o ff functionality at 60◦ is implemented by using a Negative Temperature Coe fficient (NTC) resistor. Because of the small coil, we implemented some extra shielding to ensure a more optimal WPT.

Figure 7 shows the two coils in the system with corresponding resonant circuits. A power transmitter coil is present in each charger pad and a receiver coil in each battery-powered device. Wireless charging achieves higher link e fficiencies when implementing LC resonant circuits on both the receiver and transmitter. The coupling factor between the two coils is very low. Therefore implementing a resonant circuit can filter out the leak inductance and improve the link e fficiency drastically [26]. A Qi charger pad has a built-in amplifier connected to an LC series resonant circuit. The energy receiver side consists of an LC resonant circuit with L, *Cs*1, and *Cs*2. These capacities can be calculated with the Equations (3) and (4). *L s* represents the inductance measured when the receiver coil is placed on top of a charger pad. *Ls* is the free-space inductance. *fs* and *fD* are fixed values respectively 100 kHz and 1 MHz [23].

$$\mathcal{C}\_1 = \frac{1}{\left(2\pi \cdot f\_s\right)^2 \cdot L\_s'} \tag{3}$$

$$\mathcal{C}\_2 = \left( \left( f\_D \cdot 2\pi \right)^2 \cdot L\_s - \frac{1}{\mathcal{C}\_1} \right)^{-1} \tag{4}$$

Filling in the formula and converting to values for which actual hardware components are commercially available gives 100 nF for *Cs*1 and 1 nF for *Cs*2. Three other types of capacitors have an important function in the circuit. The BOOT, COMM, and CLAMP capacitors. The BOOT or bootstrap capacitors are used for driving the high-side FETs of the synchronous rectifier. The COMM capacitors allow communication with the charger pad. Here, capacitive load modulation is used. An extra capacitance is connected to the resonance circuit, which changes the resonance frequency. This change

is visible on the charger pad side. Load modulation allows communication between the power receiver charging circuit and the power delivery pad circuit. Guidance values for resistive load modulation can be found in the datasheet. The CLAMP capacitors ensure overvoltage protection. Above the rectified voltage of 15 V, the CLAMP capacitors are switched to change the resonance frequency and protect the circuit against high voltages. The datasheet provides suggestions for these values. Values of 10 nF, 470 nF and 47 nF were used for the BOOT, CLAMP and COMM capacities, respectively [23].

**Figure 7.** Wireless Power Transfer (WPT) setup. A Qi power transmitter with a Qi power receiver and load, based on LC resonant circuits.

#### *2.5. Optimization for Low Energy*

One of the main focuses of this work is the realization of a node with a convenient autonomy. A Li-Ion battery is chosen for its high energy density and low weight. The round battery with a capacity of 200 mAh is ideal for this prototype. This battery is rechargeable. With compatibility and ease of use in mind, Qi-compatible wireless charging is implemented. The whole system is powered at 2 V with an ultra-low Iq buck converter. In this configuration, a buck converter is much more efficient than a Low-dropout (LDO) regulator, even in sleep mode. The IMU works at 1.8 V. Here, the use of an LDO for the voltage drop of 0.2 V is more efficient. By running the whole system at 2 V instead of the traditional 3.3 V, a theoretical power difference of 9.610 mW is calculated when quiescent currents are neglected. This translates to a gain in the autonomy of 29.3 %. The sensor node consumes 0.102 mW in sleep mode and 25.839 mW in active measurement mode. This is reflected in an autonomy of 28 h in operation and of 261 days in sleep mode, which is well above the five hours put forward. An active power consumption of 25.839 mW is very low for this kind of system and can't be significantly improved with the hardware we are currently using. This power consumption in combination with a 200 mAh battery allows for a long enough time between charges. The sleep current of 0.102 mW can possibly be improved by disabling the Qi-wireless charger completely when it's not being used, thus eliminating quiescent currents. This can be done by using a MOSFET.
