Design and Implementation of an Ultra-Low Resource Electrodermal Activity Sensor for Wearable Applications

While modern low-power microcontrollers are a cornerstone of wearable physiological sensors, their limited on-chip storage typically makes peripheral storage devices a requirement for long-term physiological sensing—significantly increasing both size and power consumption. Here, a wearable biosensor system capable of long-term recording of physiological signals using a single, 64 kB microcontroller to minimize sensor size and improve energy performance is described. Electrodermal (EDA) signals were sampled and compressed using a multiresolution wavelet transformation to achieve long-term storage within the limited memory of a 16-bit microcontroller. The distortion of the compressed signal and errors in extracting common EDA features is evaluated across 253 independent EDA signals acquired from human volunteers. At a compression ratio (CR) of 23.3×, the root mean square error (RMSErr) is below 0.016 μS and the percent root-mean-square difference (PRD) is below 1%. Tonic EDA features are preserved at a CR = 23.3× while phasic EDA features are more prone to reconstruction errors at CRs > 8.8×. This compression method is shown to be competitive with other compressive sensing-based approaches for EDA measurement while enabling on-board access to raw EDA data and efficient signal reconstructions. The system and compression method provided improves the functionality of low-resource microcontrollers by limiting the need for external memory devices and wireless connectivity to advance the miniaturization of wearable biosensors for mobile applications.


Introduction
Advances in miniaturizing and increasing computational functionality of wearable biosensors have revolutionized the delivery of modern healthcare services by providing pragmatic and timely solutions that are scalable outside of the hospital. Embedded microcontrollers (MCUs) play critical roles in wearable biosensor systems, providing high-performance digital signal processing (DSP) capabilities at ultra-low power consumption due to efficient usage of their single core central processing units (CPUs). The gains in power efficiency and compact size come at the cost of low internal storage capabilities (∼1 kB to 512 kB range) and lower processing capabilities when compared to larger, multi-core microprocessors and system-on-a-chip (SoC) solutions.
Designers of wearable, ultra-low-power or energy harvesting biosensors must address the challenge of maximizing sensor performance while minimizing physical size, weight, and power tonic features shown in Figure 1 are the average skin conductance level (SCL), the standard deviation of the EDA signal (EDA_Std), the signal maximum amplitude (SC_Max) and minimum (SC_Min). Phasic features relate to the rapid fluctuations of skin conductance (SC) in response to a stimulus and have been helpful in evaluating stress [12,13], anxiety [14,15], the orienting response [16], and applications related to emotional sensing [18,19]. These skin conductance responses (SCRs) have both an SC amplitude (SCR_Amp), measured from the trough to peak of a SC pulse, and a duration (SCR_Dur), measured as the time between the onset of an SCR to the point when the SC level reaches 50% of its peak amplitude. The area under the curve of an SCR (SCR_AUC) is measured according to SCR_AUC = 1/2 SCR_Amp × SCR_Dur to provide a relative estimate of an SCR size. Studies involving EDA are commonly interested in the psychophysiological response to emotional stimuli which can vary depending on the measurement location. Sweat gland concentrations are not evenly distributed across the body, with the largest densities being measured on the soles of the feet (620/cm 2 ), the forehead (360/cm 2 ), the palms and cheeks (300/cm 2 ), and the thighs (120/cm 2 ) and not all measurement locations are equally responsive to emotional stimuli [16,20]. In 2012, Van Dorren et al. [21] compared 16 different measurement locations for sensing emotional sweat on the body and report the mean amplitude and standard deviation of these locations. This study confirmed that emotional sweating can be recorded at measurement sites other than the palmar and plantar surfaces but often at a reduced amplitude and activation levels. In this study, EDA is measured at the wrist since the form factor of wrist-worn biosensors are commonly accepted in commercial devices and bracelets provide good mounting surfaces for attaching electrodes to the skin. Ideally, this proposed system could be further miniaturized to record EDA at the palmar surfaces (where SCR activity is more prominent) without being obtrusive or encumbering daily activity. Features of the skin conductance response (SCR). The skin conductance level (SCL) was computed as the average skin conductance (SC) value across a 64 s window, SCR_Dur is the time from the beginning of the SCR to the 50% amplitude level, and SCR_Amp is the amplitude from the minimum to the maximum of an SCR.

Wavelet Transformations
The discrete wavelet transform (DWT) has multiple applications in bioengineering that include artifact removal, signal de-noising, event detection, and signal compression [22] due to its ability to capture and localize temporal variations of a signal at a variety of scales [23]. The wavelet transformation has specifically been implemented on microcontrollers to detect respiration from a photoplethysmogram (PPG) signal [24], perform QRS-wave peak detection and denoising of an electrocardiogram (ECG) signal [25], improve energy performance of transmitting ECG and electromyogram (EMG) data wirelessly [26], and compress images and reduce transmission bandwidth in wireless sensor nodes [27]. The DWT, shown in Equations (1) and (2), is useful for its unique time-scale representation of physiological signals that are created during the convolution of an input signal, x[n], with a wavelet basis, h[n]. The Daubechies wavelet family is a popular wavelet family for physiological signal processing and is characterized by a set of scaling and wavelet coefficients that have low-passing and band-passing characteristics similar to that of quadrature mirror filters: where A and D are the scaling and wavelet coefficient vectors and h 0 and h 1 are the Daubechies (db3) scaling and wavelet coefficients, respectively. This convolution decomposes the input signal into a series of time-scale or time-resolution representations useful in signal analysis. If the DWT is applied recursively, a multiresolution decomposition is possible. The coefficients of the multilevel discrete wavelet transform (ML-DWT) algorithm at a given transformation level, L, are calculated as: where A L and D L are the approximation and detail coefficient vectors at a specific level and [5] are the Daubechies (db3) scaling and wavelet coefficients, respectively, with ||h 0,1 || 2 2 = 1. This algorithm recursively applies the DWT to produce a multiresolution decomposition of the EDA signal, as shown in Figure 2. Equations (3) and (4) produce a dyadic wavelet transformation, where A L+1 and D L+1 are each half the length of the previous approximation coefficient vector, A L . For each coefficient vector A L , the next level transformations, A L+1 and D L+1 , represent low-passed and band-passed versions of A L , respectively, providing the multiresolution decomposition of the EDA signal in the wavelet domain. Additional details on the wavelet transform and the filtering effects of the multiresolution decomposition can be found in [22,[28][29][30]. The complete ML-DWT of the EDA signal can be represented as a 1D array, W 4 , by concatenating the highest level approximation vector, A 4 , along with all detail coefficients vectors, D 4 − D 1 , as shown Figure 2. These coefficients are all that is needed to fully reconstruct the original input signal, x[n]. , through the application of a multilevel discrete wavelet transformation. This technique was applied within the microcontroller to allow for effective signal compression. Each level of the transformation represents low-passed and band-passed versions of the original signal at different scales.

Data Compression
Various methods for compressing physiological signals have been developed over the past 20 years to improve sensor size and power although few have been applied in the field of electrodermal activity. Data compression methods can often be separated into lossless or lossy compression. Lossless compression methods create perfect reconstructions from compressed data but are often processing intensive and challenging to implement on resource-constrained devices [31]. In contrast, lossy compression methods create reconstructions which are approximations to the original data and enable large levels of data compression at the expense of signal distortion. Since wearable biosensors are often resource-constrained devices, lossy compression methods are attractive for their ease of implementation and compression performance on embedded devices if the distortion can be tolerated [5,31]. Traditional data compression methods commonly involve sampling a physiological signal above the Nyquist rate, transforming the data into a sparse domain (having many near-zero values), and compressing the data using a certain threshold criteria. Data compression has been used in ECG and EMG applications to improve energy performance of transmitting data wirelessly [26], and to compress images and reduce transmission bandwidth in wireless sensor nodes [27].
Compressive sensing (CS) is a new and promising field of research that is being applied to data compression on wearable devices. The fundamentals of CS presented by Candes, Tao, and Donoho [32,33] use a compressed sampling process that randomly sub-samples a signal below the Nyquist rate and, by leveraging sparsity and well-suited basis function, creates an approximation to the original signal by solving an underdetermined system of linear equations. Compressive sensing methods are beneficial when minimal on-board processing and data storage is desired. Chen et al. [34] provide one of the first implementations of an on-chip compressive sensing device for recording EEG signals stating that their method is agnostic to the input signal type assuming that the signal is sparse. This assumption is non-trivial in regards to the EDA signal since it is characterized by large shifts in baseline SCL and SCRs over time. A variety of studies have examined different models and basis functions to characterize the EDA signal in a sparse domain, such as sigmoid-exponential function [35], biexponential impulse function [36], dynamic casual model using variational Bayesian decomposition [37], and a multi-level (db3) wavelet transformation [9]. A recent paper by Chaspari et al. [10] is the only study to our knowledge presenting a CS-based method to compress the EDA signal. Their study uses EDA-specific dictionaries of tonic and phasic atoms to represent the long-term and short-term fluctuations of the EDA signal and the reconstruction is achieved by solving the CS minimization problem using orthogonal matching pursuit (OMP) techniques. Although this technique was not implemented on a wearable device, the results from this study provide a helpful performance comparison between our on-board approach and these CS compression methods.

System Description
A low resource biosensor was designed to continuously measure the electrodermal activity signal for multiple days using only a low-resource 16-bit microcontroller for signal processing and data storage. The sensor system ( Figure 3) is composed of an analog front end (AFE) to amplify and filter the EDA signal and a digital signal processing back end within the MCU to compress and store the EDA signal. All sensor electronics were designed to fit within a small Fitbit Flex style wristband ( Figure 4). Data are downloaded from the device to a laptop using the universal asynchronous receiver-transmitter (UART) protocol for serial communication.  . The complete EDA sensor assembly is shown above. Two, Ag/AgCl electrodes (1 cm diameter) were fastened along the inside of the wristband and measured electrodermal activity at the ventral wrist. Velcro strips were used to provide flexible sensor adjustment and to ensure a tight fit. The footprint of the printed circuit board (PCB) shown is 3.73 cm 2 . The system additionally has a three-axis accelerometer, skin temperature sensor, and event marker, although they were not used in this study.

Analog Front End
The AFE is composed of an EDA amplifier followed by a 4th order low pass filter (LPF). The LPF (Appendix B) was designed to pass the EDA signal from 0-1 Hz since the frequency response of sympathetic activities for physical and cognitive stress fall below 0.25 Hz [38,39]. The EDA amplifier measures electrodermal activity at the ventral wrist using a single op-amp (Analog Devices, AD8603, Norwood, MA, USA) topology, found in [16]. This topology (Appendix A) uses a quasi constant-current model for skin conductance measurement. The 1 cm diameter Ag/AgCl electrodes (Thought Technologies LLC, Montreal, QC, Canada) are replaceable and snap into place on the inside of the wristband shown in Figure 4. The electrodes are mounted using 1.5 cm center-to-center spacing. The accuracy and sensitivity of the device is shown in the Results section.

Microcontroller
This system uses an ultra-low power, 16-bit embedded microcontroller (Texas Instruments, MSP430FR5969, Dallas, TX, USA) for digital signal processing and on-board data storage of the EDA signal. The MSP430 is regulated at 2.8 V with a low-noise linear voltage regulator (Texas Instruments, LP5907, Dallas, TX, USA) supplied by a rechargeable 3.7 V, 40 mAh lithium ion battery (Sparkfun, PRT-13852, Niwot, CO, USA). We used an interrupt-based embedded code model [40] to set the MSP430 in ultra low-power mode between intervals of sampling and signal processing. The EDA signal is sampled at 2 Hz from the AFE using a 12-bit ADC on the MSP430. EDA data are stored into a sample buffer before being compressed. All signal compression is conducted in real time and compressed EDA data are saved into the lower 48 kB of non-volatile memory on the MSP430, as shown in Figure 3. Timing for the real-time clock (RTC) and analog-to-digital converter (ADC) is maintained using an external crystal oscillator at 32.768 kHz. All signal processing in active mode is performed at 1 MHz.
To extend device lifetime, we also designed a user-configurable periodic sampling scheme. At the beginning of each recording session, the device can be programmed to continuously record EDA or periodically record 64 s windows of EDA starting at any integer multiple of the on-board real time clock (RTC) minute register. By adjusting the number of minutes between sample windows, users can extend battery life and long-term storage capabilities of the 16-bit microcontroller.

On-Chip Signal Compression
This study implements on-chip signal compression in real time to expand the long-term monitoring capabilities using the available internal memory of a microcontroller. The compression method applied can be subdivided into three stages: (1) computing the wavelet transform of the input EDA signal, (2) sorting the wavelet transform coefficients by magnitude, and (3) encoding the largest coefficients along with their locations. These methods are described below.

Wavelet Transformation of EDA Signal
In our application, Algorithm 1 is used to transform a 1D vector of skin conductance values, x[n], into a 1D vector in the wavelet domain, W 4 [n], which is sparse and can be efficiently compressed. The ML-DWT procedure begins by initializing the A 0 approximation vector (step 4) with 128 samples of skin conductance values, x, representing 64-s of EDA. The Pad() function (step 8) in this procedure improves upon the methods described in Addison [22] to perform the ML-DWT by symmetrically padding the input vector before performing the DWT. Given an input vector A of length N, the Pad() function will return a new vector, A pad , which is a copy of A with four additional elements on the left and right sides that mirror the perimeter elements of A, such that: The length of A pad is N + 8, which results in two additional coefficients being generated (one coefficient on each end) during the DWT. This step prevents the generation of large coefficients at the signal borders that can lead to reconstruction errors if omitted in the compression process [41]. Other signal extension modes were considered (no-padding, zero-padding, and periodic-padding), but none led to lower reconstruction errors of the compressed EDA signal than symmetric extension. The symmetrically padded vector, A pad , is then input into the WT() function (step 10) to produce the approximation coefficients (step 33) and the detail coefficients (step 34) at the next transformation level using the ML-DWT algorithm described in Equations (3) and (4). Each A L and D L are half of the length of A pad due to dyadic scaling factor of 2i. This process is recursively applied four times to generate the level-4 approximation and detail coefficients, A 4 and D 4 . The band passing nature for each transform level is shown in Figure 2 where short-term ('high-frequency') variations are captured in the lower level transformations and long-term ('low-frequency') variations are retained in the higher transform levels. The output of the ML-DWT algorithm is a 1D vector of wavelet coefficients, W 4 , containing the highest approximation coefficients, A 4 , and all detail coefficients, D 4 − D 1 . The coefficients in W 4 represent a multi-scale wavelet transformation of the original EDA signal and contain all the information needed to completely reconstruct the original signal using the inverse wavelet transformation.

Sorting Wavelet Coefficients
The W 4 vector has many values near zero and is considered sparse. This implies that only a few wavelet coefficients play a considerable role in reconstructing the original EDA signal during the inverse wavelet transformation. This study compresses the EDA signal by leveraging the sparsity of the ML-DWT to create a subset,Ŵ 4 , that encodes only the largest K coefficients of W 4 , along with their positions, using less memory than required to store the original signal. Essentially,Ŵ 4 is an approximation of W 4 composed only of its largest K coefficients where lower values of K lead to higher compression ratios.
The Compression procedure described in Algorithm 2 begins by sorting the largest K coefficients of W 4 where K is defined as the desired number of W 4 coefficients to retain. The ARGSORT() function returns a list of sorted indices (LSI) that represents the top K coefficients of the W 4 vector. The LSI and W 4 vectors are then input into the ENCODE() function (step 3) to encode the value and position of the top K coefficients of W 4 into a block of memory, as shown in Table 1.

Encoding Wavelet Coefficients
We create a custom encoding of the compressed wavelet coefficients to optimize memory usage for the application. The A 4 coefficients represent the low-pass filter of the skin conductance signal and are represented using unsigned, 12-bit values since all skin conductance values are positive. The MSP430 is based on a 16-bit architecture so the A 4 coefficients can be encoded in the 12 most significant bits within a 16-bit memory register, shown in the ENCODE() function of Algorithm 2 (step 25). The detail coefficients can be negative and are represented using a signed, 8-bit integer (step 28). The addresses of each D coefficient, D.addr, range from 12-144 and are encoded with 8-bits. The D.addr values are split into 2, 4-bit segments where they can be stored alongside the A 4 coefficients (steps 31 and 32), as shown in Table 1. Since the A 4 coefficients are always in the top 12 largest coefficients, there is no need to store their location if they are encoded in their original order. The compressed EDA ofŴ 4 in Table 1 is an optimized data structure for a 16-bit architecture and helps extend long-term monitoring capabilities on this low-resource device. : : Encoding the W 4 coefficients was optimized by determining the expected range and sign of wavelet coefficients produced from applying the ML-DWT procedure on a collection of EDA signals shown in Figure 5. These EDA signals were recorded during a stress induction protocol conducted across 14 participants (7 male and 7 female) with ages ranging from 24-36 years of age (average age: 27.6 year; median age: 26.5 year; std: 3.57 year). These participants were recruited by email and fliers for an Institutional Review Board (IRB) approved protocol to evaluate the performance an early prototype of the developed system. Each participant wore the EDA sensor on their right wrist and remained in a seated position while being subjected to a series of tests known to simulate every day stressors [42][43][44][45]. Each stress induction test began with 10 min of relaxation to establish a baseline EDA measurement without stress. When the initial rest period was over, the participant was exposed to a stress induction period lasting 4 min. There were three different stress induction methods: an auditory startle (periodically dropping a textbook on the floor while the participant sat quietly with their eyes closed), a mental arithmetic test (counting backwards from 500 in steps of 7), and public speaking (reciting William Faulkner's acceptance speech for the Nobel Prize in front of laboratory staff). Each stress induction period was followed by a 5 min period of rest. The order of stress induction tests were randomized and participants conducted anywhere from one to two stress induction tests (with 5 min of rests in between), depending on their willingness to participate in the full experiment. EDA data recordings were visually inspected and data segments having 'flat-line' skin conductance values below 0.01 µS, assumed as having poor or no electrode contact with the skin, were removed from the dataset (ex. data collected before the electrodes are attached to the body). In this way, the compression performance and signal distortion of the new ML-DWT compression algorithm is analyzed only from quality EDA signals recorded in a controlled environment during a stress-induction protocol. These signals were filtered using a Chebyshev type-II filter (0.6 Hz passband at 3 dB; 0.9 Hz stopband at 74 dB) before being compressed. All EDA signals were subdivided into 64 s windows for the evaluation, resulting in 253 independent EDA signals. These recordings are mainly used to characterize the expected performance of an EDA compression algorithm when applied across a population experiencing relaxation and induced stress.
Before performing the ML-DWT, the skin conductance values in x are converted from units of 1 µS to units of 0.01 µS so that the W 4 coefficients can be cast from Q15.16 format (1 signed bit; 15 integer bits; 16 fractional bits) into signed, 16-bit integers (Q15.0) and maintain a resolution of ±0.01 µS. Table 2 summarizes the minimum memory requirements to encode the W 4 coefficients by computing the maximum coefficient value in binary notation (bitwidth = log 2 (max(|X|)) for X ∈ {A 4 , D 4 , D 3 , D 2 , D 1 , LSI}). The magnitudes for each ML-DWT coefficient computed from the EDA signals of Figure 5 are shown in Figure 6. This histogram was used to determine the maximum bits needed to represent the W 4 coefficients in binary notation. The final required bitwidths to store the W 4 coefficients and the LSI are summarized in the last column of Table 2 which defines the encoded data structure of Table 1. Figure 6. The distribution of wavelet coefficient values for the approximation vector, A 4 , and detail coefficients, D 4 − D 1 , that compose the 1D wavelet transformation, W 4 . A total of 253 EDA signals were transformed using the ML-DWT algorithm and, for each signal, the maximum magnitude of the wavelet coefficient was recorded. This distribution is used to define the maximum bits required to store the wavelet coefficients.

Reconstruction
The compressed EDA signal is downloaded to an external device via UART communication for reconstruction. The original EDA signal, x, is reconstructed from W 4 by populating an empty W 4 vector with the coefficients retained inŴ 4 and filling the remaining values with zeros. The symmetric signal extension described earlier was designed to use Python's PyWavelet library (https: //github.com/PyWavelets) for reconstructing the EDA signal from W 4 using the inverse DWT function, pywt.waverec().

Compression Ratio
The compression ratio defines the memory savings achievable with our ML-DWT implementation and is expressed as: where N x , N wt , and N i are the number of bits used to encode the EDA signal, the wavelet transform coefficients, and W 4 indices, respectively. Each EDA sample is represented using 32-bit fixed point floats (Q15.16) at a sample rate of 2 Hz, leading to an input data rate of 64 bits/s.

Compression Distortion
Lossy compression inevitably distorts the original signal during reconstruction when signal energy of the ML-DWT is omitted. We use the percent root mean square difference (PRD) [26,46,47] to evaluate the distortion of the reconstructed EDA signals, which is defined as: The Root Mean Square Error (RMSErr) is also computed to enable a performance comparison between our wavelet-based compression method and a compressive sensing method presented by Chaspari et al. [10]: In both equations, x andx represent the original and reconstructed signals, respectively, and N is the length of the uncompressed signal.

Energy Compaction
The energy compaction of the ML-DWT was evaluated by calculating the percentage of total signal energy (%Energy) contained within each approximation and detail coefficient vector of W 4 by: where c is an approximation or detail coefficient vector of length n and W 4 is the entire multilevel wavelet transformation vector of length N.

EDA Feature Reconstruction Errors
We hypothesize that, since a majority of signal energy is contained in a small number of coefficients, the EDA signal is well-suited for being compressed without significant loss of features associated with the signal. We evaluated this by extracting common EDA features shown in Figure 1 from the original and reconstructed signals and comparing the extracted features as a function of the CR.
For the phasic EDA features, the sum of the skin conductance response (SCR) amplitudes (Sum_Amp) and sum of the SCR durations (Sum_Dur) and their product, the Sum of the Area (Sum_AUC), were computed for each 64 s EDA signal using the third party algorithms provided by Taylor et al. [48].
For each of the 253 EDA signals, the relative error (RE) for a given feature, f = (Sum_Amp, Sum_Dur, or Sum_AUC), was computed as follows: where f orig and f recon are features extracted from the original and reconstructed EDA signals, respectively. Additionally, the tonic features extracted from the EDA signal were the Skin Conductance Level (SCL or mean), minimum, maximum, and standard deviation for each EDA signal. The absolute error in (µS) between the original and reconstructed signal was used to evaluate the distortion.

Results
A reconstructed signal from the developed compression method is shown in red in Figure 7, along with the original EDA signal in blue. The compression method used in Pope et al. [9] in green is shown to visually compare the reconstruction quality between the two methods. In this figure, both methods compress 64-s windows of EDA signals, consisting of 512 bytes each, into 30-byte encodings ofŴ 4 (CR = 17.1×). In this way, any observable improvement in signal reconstruction quality is related to improvements of the algorithm's compression efficiency at encoding W 4 information intô W 4 . The newly developed method shown in Figure 7 is capable of encoding the top 18 coefficients of W 4 -as opposed to only the top 14 coefficients for the method shown in green from [9]. This improved encoding scheme in Algorithm 2 improves the RMSErr by 31.8% (from 0.0274 µS to 0.0208 µS) at the same compression ratio. An EDA signal is shown in blue along with a reconstructed EDA signal using the newly developed compression method in red. The previous compression method from Pope et al. 2018 [9] is shown in green for comparison. The original signal is compressed from a data rate of 64 bits/s to 3.75 bits/s in both methods (CR = 17.1×) (The input data rate in [9] used a signed 16-bit representation of skin conductance values instead of the more appropriate 32-bit float representation used here and in [10]. Therefore, the CRs reported in [9] should be doubled for comparison.) The developed method in red is able to encode 18 total W 4 coefficients, whereas the previous method in green is only capable of encoding the top 14 coefficients leading to a 31.8% improvement in root mean square error (RMSErr). Both reconstructions are composed of four, 64-s compression/decompression cycles spliced together.

Compression Performance
The distortion of the reconstructed signal is evaluated using the RMSErr and PRD distortion metrics from Equations (6) and (7) to evaluate the quality of the compression process. Figure 8A shows the RMSErr for each reconstruction over a range of compression ratios based on the 253 EDA signals from Figure 5. For CRs up to 23.3×, the RMSErr is below 0.023 µS for 75% of all signals evaluated and the average RMSErr is no greater than 0.016 µS. For CRs up to 23.3×, the PRD is below 1.1% for 75% of the EDA signals evaluated. As the CR exceeds 23.3×, the PRD rapidly increases as coefficients from the A 4 vector are omitted. The ML-DWT transformation tends to compact signal energy into the higher coefficient vectors, leading to a sparse W 4 vector. This energy compaction leads to >99% of the total signal energy (%Energy) being packed into the A 4 coefficient vector across a sample of 253 unique EDA signals (Table 3). This allows the original signal to be compressed and reconstructed using very few wavelet coefficients, as shown in Figure 7. The %Energy for each coefficient vector in Table 3 was computed for all 253 EDA signals and shows that a majority of signal energy in the wavelet domain can be retained with very few wavelet coefficients. Table 3. Average percent energy of wavelet coefficient vectors.

EDA Feature Performance
The features of the EDA signal are not equally impacted at increasing compression ratios. The tonic features are preserved quite well throughout the range of CRs (Figure 9). SCL and standard deviation (Std) feature errors are <0.01 µS up to a CR of 23.3× and are negligible. Errors associated with the EDA maximum (Max) and minimum (Min) are effected more at higher compression ratios. The omission of detail coefficients at higher CRs has a low-pass filtering effect which moves the EDA signal Max and Min towards the mean SCL. Figure 9. The absolute reconstruction errors of four EDA features computed on 253 EDA signals that were collected during in-laboratory stress tests. The SCL (EDA mean) and standard deviation are hardly effected by compression. While the low-passing filtering effect of compressing the 1D array of wavelet coefficients introduces larger error on the EDA maximum and minimum at higher compression ratios, error within the interquartile remains below 0.015 µS for CRs up to CR = 23.3×.
Features related to phasic EDA (Sum_AUC, Sum_Amp, and Sum_Dur) are more sensitive to compression and experience greater errors at higher CRs, as shown in Figure 10. The relative errors for these features (based on Equation (9)) show that the phasic features can be preserved quite well up to a CR of 8.8× with a relative error <5.0%. Above this CR, phasic feature errors increase, leading to a 28% relative error when CR = 19.7×. Compression above this point begins to filter out SCRs of increasingly larger amplitudes-leading to relative errors exceeding 75% for the Sum_AUC, Sum_Amp, and Sum_Duration features as less information encoded within the detail coefficients is included in the compressed signal.

Sensor Performance
The designed system has high energy efficiency, consuming 655 µW for continuous EDA signal sampling, processing, and recording. Figure 11 shows the current consumption between a 64 s sampling window (232 µA) and deep sleep modes (16.6 µA). These low power modes provide large energy savings when used in combination with periodic sampling method discussed previously. Figure 11. Measured current consumption for the entire system across operational modes with a supply voltage of 2.8 V. The average current draw is 16.6 µA during deep sleep mode, 232 µA for sampling the EDA signal, and 280 µA while processing the ML-DWT.
The processing of the ML-DWT, compression encoding, and data storage of the 128 sample EDA signal occurs within 0.92 s and requires an average current of 280 µA. This provides efficient end-to-end processing speed at low current consumption, making it competitive with traditional peripheral storage devices and wireless transmission methods used for data storage-especially given the relatively low clock rate of the MSP430 at 1 MHz.
We evaluated the accuracy of the EDA sensor's analog front end on a range of fixed resistance values, as shown in Figure 12. The series of fixed resistors ranging 150 kΩ-3.88 MΩ were measured to determine the EDA sensor's conductance measurement error, using the formula G = 1/R. Figure 12 shows that the maximum conductance error is <0.075 µS for a range of conductance values between 0.25 µS-6.67 µS with a minimum sensitivity of 0.02 µS. Each error bar shown consists of 100 individual conductance measurements that were compressed on-board the MSP430 using a CR = 17.1×.

EDA Recording Experience
This ultra-low resource sensor operates as a 'plug-and-play' recorder of electrodermal activity. Each sensor is designed to download data from the device to file on a laptop when the sensor is plugged in for charging. The charging cable also serves as a serial connection to the EDA sensor and a set of Python scripts are used to automatically download data from the device and configure it for the next recording. Each sensor can be programmed to record in 'Lab' mode which continuously records EDA without compression at a sample rate of 2 Hz or in 'Field' mode, in which EDA data is compressed before storing it into internal memory. Higher levels of compression lead to longer recording times at the expense of distorting EDA feature according to the results presented in Figures 9  and 10. Table 4 summarizes the maximum recording duration at a given compression ratio (CR) if saving data into the lower 48 kB of the MSP430FR5969.

Discussion
In this study, we present an ultra-low resource system for recording the EDA signal at high fidelity entirely within the memory of a 16-bit microcontroller. A multilevel wavelet transformation is implemented on an embedded MCU in real time to create a sparse representation of the EDA signal so that it can be compressed and stored within the internal memory of the MSP430. The system developed here was designed to be a fully autonomous EDA recording device optimized for size and power using minimal resources. The low-resource compression techniques described here could be extended to wireless EDA sensors where size, weight, and power come at a premium.
Many wireless MCUs today, such as Texas Instrument's CC2650 and Nordic Semiconductor's nRF51822 (Oslo , Norway), have on-board storage capabilities of 2-32 kB of RAM and 64-256 kB of non-volatile flash memory. At a sample rate of 2 Hz, EDA data could be recorded in raw format for 2.2 h in RAM and 17.8 h in flash memory. The developed method would extend this recording range to 19 h in RAM and 6.3 days using flash memory with very little impact on signal quality, as shown in Figures 7 and 8, to enable long-term monitoring capabilities without the need for continuous wireless connectivity. For example, the ring-based EDA sensor from Moodmetric (Tampere, Finland) requires a very small footprint and currently relies upon an external wireless device to actively record raw EDA data since, "The Moodmetric ring does not store raw data due to limited memory size" [49]. In this use case, our developed methods could (1) enable on-chip storage capabilities to extend physiological recording in moments without wireless connectivity, and (2) reduce the power required to transmit data wirelessly by compressing the EDA signal information.
Implementing the wavelet-compression on-board the MCU is competitive to CS-based methods. Our results in Figure 8 show the mean RMSErr distortion errors of 0.0046 µS at CR = 14.2× and 0.016 µS at CR = 23.3× when compressing 64 s windows of EDA. In comparison, the compressive sampling method from [10], which uses knowledge-based dictionaries as atoms (basis functions) to reconstruct the EDA signal, achieves average RMS errors (approximately) below 0.02 µS with CRs below 17.7×, using 10 s windows for each reconstruction and >12 orthogonal matching pursuit (OMP) iterations per reconstruction. This method would require roughly 72 OMP optimization iterations during the reconstruction of a 64 s EDA signal as opposed to the single inverse DWT required for our wavelet-based method. Therefore, our on-board compression approach may be better suited for applications intending to implement EDA signal reconstructions on another mobile device, such as data visualization on a mobile phone, where efficient and quick processing of EDA signal reconstructions is desired. Although direct comparisons are challenging, a compressed sensing approach does not appear to provide large gains in compression performance compared to our wavelet-based method. The results from Lou et al. [50], who used CS methods based on multi-level wavelet transforms, states that their CS method, "...possesses enough advantage [over on-board compression] in some circumstances e.g., there is a rigid demand on compression time and a loose limit on decompression, or it is not easy to get complete original data." The work from this study provides support that (1) the compression time of the EDA signal is minimal (0.9 s, shown in Figure 11) compared to the signal length period of 64 s and (2) given the low data rate of the EDA signal, the original data is easy to acquire in real time and could be used for further signal processing. Furthermore, the cost of compressing the original signal on-board the sensor may provide additional signal processing benefits that are not available using CS methods, such as removing ambulatory noise from the EDA signal before compression, to improve the reconstruction performance (although this was not implemented here and would be a topic of future studies).
Using a microcontroller's internal memory to store physiological data can have useful benefits to power efficiency. A recent review [4] shows that power typically used to transmit (TX) and receive (RX) data in wireless sensor nodes is ∼60 mW (using the TI CC2420) and ∼75 mW when saving data to EEPROM (using the Amtel AT45DB321B flash memory, (Santa Clara, CA, United States)) and suggests that using on-board signal processing and on-board feature extraction could improve energy savings by >20×. Our technique supports this argument by combining on-board signal processing and data storage within a single MCU to achieve storage with an average power consumption of 655 µW for long-term monitoring ( Figure 11). Compared to saving data to EEPROM, our techniques requires 114× less power during continuous operation (75 mW vs. 655 µW).
Building wearable EDA sensors on ultra-low resource systems can improve power and size for wearable applications, but this approach also comes with limitations. The developed system uses only <64 kB for all program memory, RAM, and data storage which requires meticulous attention to detail when allocating memory for the program (e.g., volatile vs. non-volatile memory, stateful vs. stateless variables, etc.) across various modes of low-power operation on the MSP430. Even though we demonstrate that using a microcontroller's internal memory to save raw data is clearly more power efficient than transmitting it wirelessly to an external device, there are benefits to wireless systems capable of streaming data in real time for remote processing that should be considered. Another possible limitation of the developed system is that the AFE for the EDA sensor was designed using minimal resources to improve sensor size and power, which also has limitations in the range and linearity of conductivity measurement common to DC-based sensor topologies. This point is discussed in more detail in Appendix A.
We demonstrate the impact that compression has on specific EDA features and recognize that not all features are affected equally at increasing compression ratios. The tonic characteristics of the EDA signal (SCL, SC Min, SC Max, SC Std) tend to be preserved with minimal distortion at higher CRs (Figure 9), while the short term, phasic fluctuations of the EDA signal (SCR features: Sum_Amp, Sum_Duration, Sum_AUC) are lost at higher compression ratios ( Figure 10). This suggests that acceptable levels of EDA signal compression are dependent on the features of interest for a given application. This observation can be attributed to the low-pass and band-passing nature of the multi-resolution decomposition where the large-scale (low frequency) tonic signal information is compacted into the higher wavelet transformation levels (A 4 , D 4 , etc.) while small-scale (higher frequency) phasic EDA information is represented in the lower levels of the detail coefficients. Since >99.9% of signal energy is retained within the A 4 vector (Table 3), our compression technique favors retention of tonic EDA activity, which is evident in the low reconstruction errors in Figure 9.
Removing the external storage requirements of an EDA sensors has many system-level implications when designing wearable biosensors. Sensor size and costs are reduced by eliminating external memory chips, wireless communication ICs, and radio antennas. Reduced power requirements lead to smaller battery sizes. Smaller batteries improve wearability and comfort of a wearable biosensor. Therefore, clear improvements in size, comfort, and cost can be achieved with a well-matched system design for a given application. These low-resource design strategies could be useful in remote monitoring applications (in-home care, primary care, workplace mHealth, etc.) where long-term monitoring is desirable, but wireless connectivity is limited and/or unavailable. The improvements in sensor size presented could be useful in extreme mobile environments, such as military applications or competitive athletics, where sensor weight and form factor have high premiums. This sensor could additionally be integrated with a wireless transmitter to allow for low-power data storage within the MSP430 during periods without wireless connectivity and permit wireless data transmission only at the most opportune times.

Conclusions
We designed a system to record EDA signals for extended periods of time entirely within a single, low-resource microcontroller having 64 kB of available memory. A multi-resolution wavelet transformation was used to compress the electrodermal activity biosignal in real time to allow for multi-day storage within the microcontroller. We evaluate the effects that compression has on common EDA signal features and show improvements in power and size using these signal processing techniques. Our on-board implementation of data compression is efficient and competitive when compared to other compressive sensing methods for monitoring EDA. Applications of this technology could improve long-term monitoring capabilities of in-home care, primary care, or military applications in environments with infrequent wireless connectivity or sensing modalities where sensor size and weight have a high premium.

Patents
Halter, R.J., Pope, G.C., "A micro-recording device for physiological signals", Application Number: 62722520, August 2018. Acknowledgments: Special thanks to Sarah Lord from the Center for Technology and Behavioral Health for coordinating our pilot studies and to David Kotz, Jacob Sorber, and the Amulet Project team (https://amuletproject.org/) for their feedback and design considerations.

Conflicts of Interest:
The authors declare no conflict of interest and the funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

Appendix A. EDA Sensor Circuitry
In this topology ( Figure A1), the fixed voltage V b creates a 0.2 V voltage drop across resistor R b = 330 kΩ and establishes a quasi-constant current of 0.6 µA through resistor R skin , the lumped resistance of the skin and contact electrodes. This topology was specifically designed to measure a fixed range of skin conductivities from 0.25 µS-6.67 µS (although a wider range from 0.01 µS-25 µS may be more appropriate for large populations [51]).
A recent publication from Pabst et al. [52] examines the nonlinear behavior of human skin when measuring skin impedance with low-frequency excitation voltages (0.2 V-1.2 V) and suggests that the EDA measurement itself may be affecting the underlying electrical properties of the skin during measurement when DC excitation voltages are >0.5 V (the standard method). Low-current measurements of EDA have been shown by Yamamoto and Yamamoto [53] to reduce nonlinear affects and, more recently, Pabst et al. [54] mention that further research into the nonlinear behavior of the skin at low current densities is still required. With an electrode area of 0.785 cm 2 , the developed system has a density of 0.6 µA/0.785 cm 2 = 0.764 µA/cm 2 . The study from [52] observes nonlinear electrical properties of the skin at higher excitation voltages and current levels. While this quasi-constant current circuit topology in Figure A1 may benefit by maintaining low levels of current required for linear EDA measurement, we recognize that the results from [52] suggest AC topologies may provide additional benefits' linear operation at higher frequencies >0.1 Hz. Alternatively, this circuit topology could be modified to measure EDA using a constant-voltage model by exchanging the positions of R skin and R b and adjusting the reference voltage at V b such that the voltage drop across the skin is within the linear range of operation (0.2 V DC) suggested in [52]. As the skin resistance changes, due to activation of the sympathetic nervous system, the voltage output at node V aa f can be modeled as: