Empowering Electrochemical Biosensors with AI: Overcoming Interference for Precise Dopamine Detection in Complex Samples

Two significant issues in biosensors that can't be solved by conventional analytical methods are selectivity among likely biological interfering molecules and background noise in clinical samples. The application of embedded machine learning in the removal of background interference, which is extremely common in complex matrix solutions such as cerebrospinal fluid, is still unexplored. The implementation of machine learning into devices and sensors can enhance their reliability to discriminate responses. In addition, implementing these models into portable devices can further improve the usage of point‐of‐care devices, continuous monitoring, and viral mutation assessments. Herein, the requirements to implement an embedded AI model (TinyML) into low‐power portable systems and its use in the electrochemical field are presented. The application of TinyML to discriminate between interference of uric acid and ascorbic acid, both well‐known abundant electrochemically active species, in neurotransmitter detection, is explored, reaching overall accuracy of 98.1% for 32‐bit float point unit and 96.01% after 8‐bit quantization, with the usage of 4.55% of the custom‐made potentiostat memory. The model can be improved simply by having the trade‐off between memory and accuracy. The research suggests that TinyML can be a key component in future medical devices, allowing data processing in real time and with increasing reliability.


Introduction
Dopamine is of great clinical importance, and the quantification of its levels is correlated with neurodegenerative diseases. [1]It is reported that dopamine (DA) in low levels may indicate Parkinson's disease, [2] schizophrenia, [3] Alzheimer's disease, [4] and depression, [5] while high levels may signal cardiovascular diseases. [6,7]onventional techniques, such as highperformance liquid chromatography (HPLC) and enzyme-linked immunosorbent assays (ELISAs), have been employed for dopamine detection.However, these methods are costly, time-consuming, and require sophisticated instruments, which limit their use in point-of-care and field applications.One promising alternative for real-time and in situ dopamine detection are electrochemical-based sensors.These types of sensors offer rapid response, low cost, and easy integration with portable instrumentation.Nevertheless, one significant challenge in the development of electrochemical sensors for dopamine detection in biological samples is the interference from other electroactive species, such as ascorbic acid (AA) and uric acid (UA).These substances coexist in the body fluids, as it is a cofactor in the synthesis of catecholamines (norepinephrine and dopamine). [8]Not only ascorbic acid has similar oxidation potential, but also as the majority of the electrochemical platforms use the oxidation of dopamine for its detection, the presence of ascorbic acid can induce regeneration of the products of dopamine oxidation and regenerate dopamine. [9]Furthermore, ascorbic acid is also present in much higher concentrations. [10]UA is also a molecule commonly found in biological fluids which is electrochemically active and in higher concentration than dopamine, with antioxidants properties. [11]Not only the electrochemical potential of UA and DA can overlap for higher concentrations of UA, but also the antioxidant properties of UA can hinder the electrochemical oxidation of DA, resulting in an unreliable DA quantification when UA is present.These factors make the detection of dopamine in the presence of ascorbic acid and uric acid unreliable and require surface modification strategies to be achieved, which are time-consuming and delay the production process.Typically, biological molecules such as enzymes, [12] antibodies, [6] or aptamers [13] are used to enhance the detection of dopamine. [6]OI: 10.1002/aisy.202300227Two significant issues in biosensors that can't be solved by conventional analytical methods are selectivity among likely biological interfering molecules and background noise in clinical samples.The application of embedded machine learning in the removal of background interference, which is extremely common in complex matrix solutions such as cerebrospinal fluid, is still unexplored.The implementation of machine learning into devices and sensors can enhance their reliability to discriminate responses.In addition, implementing these models into portable devices can further improve the usage of point-of-care devices, continuous monitoring, and viral mutation assessments.Herein, the requirements to implement an embedded AI model (TinyML) into low-power portable systems and its use in the electrochemical field are presented.The application of TinyML to discriminate between interference of uric acid and ascorbic acid, both wellknown abundant electrochemically active species, in neurotransmitter detection, is explored, reaching overall accuracy of 98.1% for 32-bit float point unit and 96.01%after 8-bit quantization, with the usage of 4.55% of the custom-made potentiostat memory.The model can be improved simply by having the trade-off between memory and accuracy.The research suggests that TinyML can be a key component in future medical devices, allowing data processing in real time and with increasing reliability.
In the field of biosensing, interference from structurally similar likely biological molecules is a major problem, making it difficult to distinguish signals among analytes belonging to the same family. [14,15]For the diagnosis of serious disorders, quantitative data on individual biomarkers is necessary.[17] Traditional techniques are unable to reach the high level of selectivity needed for precise diagnosis in any of these circumstances because the size, chemical structure, or electrochemical signals are all tightly related among family members.The main objective of our work is to develop an innovative platform that can provide solution to this fundamental biosensor problem.To this extent, our current research report suggests that this persistent issue can be solved by properly integrating embedded AI with biosensors.Our approach has been tested with the families of dopamine, ascorbic acid, and uric acid, but it can be expanded to include other families of probable compounds present in cerebrospinal fluid (CSF), blood, and saliva, among others.

Overview of the Approach
As a proof of concept, the interference of uric acid and ascorbic acid into dopamine detection is studied by the use of square-wave voltammetry (SWV), to assess the possibility of interference between those three electroactive compounds.Afterward, the embedded AI solution is demonstrated, playing a role of quality control of the sample under analysis.Therefore, the AI would be used to detect the presence of interference contaminants or unknown chemicals (UCs) in the sample, and in absence of these compounds, the sensor readings can be regarded as reliable.
The core focus of the problem in this work relies on the difficulty of obtaining accurate results using standard electrochemical techniques and sensors.As dopamine is a neurotransmitter, electrochemical detection from CSF would be the target for this application.However, due to complexity of the CSF, interference is likely to be present, as AA and UA have their own roles on the synapse and oxidation processes of the brain.The tremendous difference of concentration between biological DA and the interference molecules, of more than two orders of magnitude, is the main motivation for the use of artificial intelligence, which can help to determine if the verified peak is indeed due to dopamine presence using the raw current data of SWV.
The solution described in this work can be categorized as the next step in the field of Computational chemistry Machine learning assisted (CompChem þ ML), in which the ML would be directly installed into the electrochemical readout system itself. [18]Furthermore, ML-based methods have been demonstrated capable of quantitative detection of chemistry mixtures via a single nonselective sensor, [19] metabolites, [20] and other biomolecules. [21]

Electrochemical Interference of Dopamine in the Presence of Ascorbic Acid and Uric Acid
The coexistence of DA, AA, and UA in CSF samples is a limitation for the electrochemical detection of those important analytes.As depicted in Figure 1a, there is a small potential window for the detection of those analytes, and depending on the difference in concentrations between them the signal can completely vanish.24] The issue is evident in the overlapping spectra in Figure 1b acquired with our platform, which mainly consists of a nonmodified carbon electrode, and therefore as there is no chemical pretreatment, or selective molecule for dopamine, the voltammetric peak of dopamine clearly overlaps with the peaks of ascorbic acid and uric acid, which would greatly affect dopamine detection in a clinical sample.For dopamine electrochemical detection in the presence of AA (Figure 1c), the increasing AA concentration results in a peak potential shift to positive values (Figure 1f ), which can be of several millivolts, as the diffusion process from the bulk solution to the electrode surface is dependent on the concentration of the analyte.This also leads to a current drop around the dopamine oxidation potential.The interference of AA and UA in dopamine detection occurs as both have close and more positive oxidation potentials, which can respectively be verified for SWV example data of Figure S1, Supporting Information.As can be noted, the mixing of 100 μM of dopamine with varying concentrations of interference molecules results in the complete fading of the dopamine peak, making its detection in contaminated samples impossible (Figure 1i-k).
Due to the antioxidant properties of both ascorbic acid and uric acid, the peak current and voltage values depend on the interaction of those molecules with dopamine.Ascorbic acid has the capacity to regenerate dopamine after its oxidation, [25] and therefore a current increase is expected for dopamine detection in the presence of ascorbic acid, which is indeed the case when we compare the data obtained for 100 μM of DA alone (Figure S1c, Supporting Information) to the data of 100 μM DA with 100 μM AA.In fact, after the concentration of ascorbic acid becomes much higher than dopamine, the peak shifts to the oxidation peak of ascorbic acid and there is no information on dopamine oxidation that can be extracted from the SWV.
When analyzing uric acid interactions, for higher concentrations of UA, the peak current dropped significantly.Uric acid was already shown to be capable of minimizing the oxidation of dopamine, [26] and therefore it can cause a drop in oxidation current, which will shift to UA potential after the UA concentration becomes significantly higher than the dopamine.The obtained current peak values for DA can be utilized to produce a calibration curve (Figure S2, Supporting Information), which increases almost linearly and starts to stabilize, as it is expected for an electron transfer rate-dependent process. [27]The best-fitted curve that correlates the peak current ðI max Þ with dopamine concentration ðC dopamine Þ is We can use (1) to find the unknown concentration in a solution We use (2) to find the concentration of dopamine in contaminated solution yields wrong values.Thus, the use of AI to assure a clean dopamine solution is required.Table S3 in Supporting Information presents the error due to interference of other substances (AA and UA) in the solution.

Dopamine Detection Assisted with Embedded Machine Learning
The dataset of 5492 SWV curves comprises four categories (Contaminated DA, Clean DA, PBS, and UC).To obtain the usual SWV data, multiple processes may be used to remove noise, outliers, smooth the curve, as well as to identify the differential current peak (Equation S( 1)-( 3), Supporting Information).In a usual SWV experiment, a train of pulses is applied with small increments of potential and defined frequency.At the end of the forward and the reverse pulse, current is sampled and the output signal is the difference between those currents.As in an electrochemical experiment two types of current are present (the Faradaic current, related to the electron transfer of the target analyte, and the non-Faradaic current related to the ionic charge movements in the solution), the SWV can increase the sensitivity by subtracting the currents and minimizing the non-Faradaic influence which is nearly identical for forward and reverse contributions. [28]However, for this work, the ML model was trained using the raw SWV current data without any posmeasurement treatment (Figure S3-S5, Supporting Information shows the applied voltage signal, schematics of a SWV experiment, and the measured raw and processed current respectively).The decision to use the raw current was done to increase the speed of the measurement and inference as well as decrease the processing penalty.The processing penalty is particularly important for low-power processors, as it can delay real-time classification.The raw current from SWV measurement is hardly used in electrochemistry, as most of the values are overlapping, it is visually chaotic, and it is not as intuitive as a processed current.Figure 2 shows the raw current and the processed current for comparison.
The step-by-step data acquisition process and the model created for the edge device are shown in Figure 3.The custom-made potentiostat developed in this work has the ESP32 microcontroller as the main component.This microcontroller applies the SWV voltage signal through the digital-to-analog converter (DAC) DAC-2, while DAC-1 maintains the reference voltage above the voltage ground level for the negative pulse generation.The SWV is generated by a look-up table (LUT) preprogrammed into the ESP32.The AI model is incorporated directly into the ESP32 firmware and runs in sequence with the SWV technique.This potentiostat device is the improved version of KAUSTat device. [29,30]The current device has improved memory size and core speed, allowing the deployment of more complex models than the ones previously reported. [31]The detailed information about the device is presented in the Experimental Section.The circuit layout and comparison table between the previous device are shown in Figure S6 and S7 of the Supporting Information, respectively.The model yields a maximum accuracy of 98.1% for 32-bit float point unit and 96.01%after 8-bit quantization.The unoptimized model (float point) has a total size of 321.1 kB with a peak RAM usage of 2.8 kB.In comparison, the quantized model (int8) has 93.3 kB in size and RAM usage of 1.9 kB.Using the ESP32 with the clock at 240 Mhz as the benchmark, the unoptimized model takes 62 ms for the inference and the quantized model takes 33 ms.Both models' size is insignificant for the custom potentiostat board used in this work, occupying only %15.67% and %4.55% respectively of the total memory.Though, for commercial potentiostat chips, ADuCM355, for example, only the quantized model would fit, occupying 72.89% of the flash memory, leaving around one-fourth of the memory for the program to control the electrochemical assay technique (34.7 kB free).For test comparison, a program for the SWV technique was compiled for ADuCM355, using for it the μVision IDE from Keil Embedded Development Tools for Arm core, resulting in a program size of 24.7 kB.This implies that the quantized model from this work could be implemented also in commercial potentiostat chips.Table S1, in the Supporting Information, shows the comparison of published potentiostat devices.In terms of RAM, both models could be implemented either in commercial potentiostat chips as well as the custom-made potentiostat.Figure 4 shows the comparison of both models regarding the prediction and resource usage.
Contaminated DA (Con DA) represents the detection of DA without the presence of any other chemical other than the buffer solution PBS.This indicates that the solution needs to be further cleaned, to remove the presence of contaminates, or different calibration curves should be used.Clean DA (Cle DA) represents the detection of a solution composed solely of DA and PBS; with this result, the user can rely on the calibration curve made only for DA.The PBS category represents that only the buffer solution is present in the sensor.This is particularly useful to check whether a sensor is contained or if any material got deposited on the surface of the sensor after primary measurements.An UC represents that no DA was detected and there is another chemical solution mixed in the PBS solution.The aforementioned accuracy and evaluation of possible contaminants therefore remove the necessity of surface modification of the electrodes to improve the peak separation of the interferences as exemplified in ref. [32].The embedded machine learning algorithm can distinguish the contaminants, improving reliability of the assay.
As a proof of concept, the model was further blind tested with unseen data samples from seven different concentrations of AA, UA, DA, AA þ DA, UA þ DA, and AA þ UA þ DA in human blood serum.The model successfully identified the presence of contaminants in human blood serum samples for DA detection.The model was then modified to discriminate the detection of AA, UA, AA þ DA, UA þ DA, and AA þ UA þ DA in the solution (Figure S10, Supporting Information).The modified model achieved an overall accuracy of 96.8% for 32-bit float point unit and 92.2% after 8-bit quantization, representing a drop of 1.3% and 3.81%, respectively.However, in blank blood serum, the model presented high uncertainty, switching between PBS (Blank) and UC.This is resultant of an increase in the background current generated by the blood serum media.The confusion matrix of the modified model and typical results of the detection in blood serum is presented in Figure S11 and S12, Supporting Information, respectively.

Conclusion
In conclusion, the application of machine learning algorithms to identify and distinguish between various molecules based on their electrochemical signatures significantly increases the precision and effectiveness of molecular identification, making it an important tool in a variety of disciplines including environmental monitoring, medical diagnostics, and analytical chemistry.The introduction of TinyML tools and frameworks leads to the creation of smart instrumentation tools, such as the electrochemical readout demonstrated in this work.We successfully demonstrated the capacity of TinyML to distinguish between contaminated and uncontaminated DA samples without the use of surface modification strategies for selectivity, which could have the potential to increase reliability in the quantification of these neurotransmitters for neurodegenerative diseases screening, and with a higher memory budget the accuracy of the system can be enhanced.Furthermore, with the ability of machine learning models to learn from new data, it's also possible to continuously improve the accuracy and identification of the model with new input data, making the equipment better with time and usage.Overall, the use of machine learning in electrochemical sensing has the potential to greatly enhance the capabilities of these sensors, making them more useful in a wide range of applications.

Experimental Section
Materials and Methods: L-Ascorbic acid (AA), dopamine hydrochloride (DA), uric acid (UA), and human blood serum were purchased from Sigma-Aldrich.Phosphate-buffered saline, 10X Solution, was purchased from Fisher Scientific.The screen-printed carbon electrode (SPCE) was purchased from Zensor (TE 100), with a carbon counter and working electrode and Ag pseudoreference electrode, and no further modification was performed on the carbon working electrode.All analytes were dissolved in human blood serum and 1X Phosphate buffer, pH 7.40, and SWV was used for analysis, with potential ranging from À400 to 500 mV, with a 10 mV step.The training set of concentrations was mixtures of AA, UA, and DA ranging from 100 to 1000 μM and the blank PBS-only measurements, in triplicate.Seventeen ratios were chosen between AA and DA, and UA and DA, fixing DA concentration at 100 μM and varying the interference concentration from 100 to 1000 μM.For the mix of the three molecules, the DA value was fixed at 100 μM, with AA and UA concentrations varying from 100 to 500 μM.
Custom-Made Potentiostat: The potentiostat device used in this work combines a microcontroller (ESP32) with a three-electrode interface, power supply, and communication circuitry on the same board.The ESP32, the main component, is a dual-core system with a rich set of peripherals.It embeds a 12-bit resolution sample-and-hold analog-todigital converter (ADC), WiFi, and Bluetooth.As flash memory, an external 4 Mb flash memory was connected to the ESP32 through a serial peripheral interface (SPI) port.The clock of the device was set to a maximum of 270 Mhz for measurement and AI inference.The three-electrode circuitry was composed of a control amplifier (CA), a transimpedance amplifier (TIA), and a 12-bit quad output DAC buffered with two Op-amps (U1 and U2) in follower mode.The first output of the DAC set the working electrode potential (V WE-0 ), and the second output set the common mode reference electrode potential (V RE ) with the counter electrode potential (V CE ) closing the current loop.In this work, the third and fourth DAC outputs were set to ground.The TIA converts the current from the electrochemical cell (I ec ) to a voltage to be measured by the ESP32 internal ADC.A virtual ground was created by applying the same voltage at both DACs' outputs.An operational range of AE1.5 V was created by setting the virtual ground at 1.5 V, when ground (or 0 V) was applied at V RE and V CE , it represented À1.5 V to the electrochemical cell, and when 3 V was applied at V RE and V CE , it represented þ1.5 V to the electrochemical cell.
The conversion gain of the TIA was controlled by its feedback resistance (R F ), set to 110 kΩ.Table S1, Supporting Information shows the maximum and minimum ranges of the custom-made potentiostat.
Data Collection and Processing: To compose the dataset used in this work, we scanned the 55 different concentrations of DA, AA, and UA.For each concentration, we scanned three times (triplicate), cleaning the electrode after each measurement with PBS.The electrochemical technique used was SWV, producing 182 data points for each scan.The 182 data points composed a single SWV measurement, in which the graphic representation of SWV required the processing of the data points.However, in this work, we used the raw 182 points without processing.The practical samples measured resulted in 165 SWV curves.From each SWV curve, we used a custom code written in Python to augment the data using four different techniques: jittering, scaling, jittering with scaling, and random scaling at random points.The modified curves simulate the random instrumentation noise associated with the electronic measurement while scaling simulated the use of different concentrations besides the ones already used.Around 25 curves were generated from each concentration of DA, AA, UA, Embedded Machine Learning Model: The model was created using the Edge Impulse development platform, with the target set to ESP32 Tensilica Xtensa LX6 microprocessor at 240 Mhz and 2 MB RAM.The RAM was partitioned with SPIFFS (SPI Flash File Storage) at 1.9 MB with overthe-air (OTA) updates enabled and quad-SPI set to 80 Mhz.The data was uploaded using the CSV wizard configuration in which the dataset was split into training and testing sets in a proportion of 80/20 respectively.The data were processed as time-series with a window size of 182.The 182 curve points were used as the input and Keras was used to create the classifier.Keras is an open-source software library that is commonly used for the creation of AI models.Edge Impulse offers Keras API directly in its interface.Through this API, a sequential model was generated for the classification.The final model architecture was composed of four dense layers with two dropout layers between.For the training, 400 cycles with a learning rate of 0.00005 were set.
Mobile Application: The mobile application was developed using Thunkable.Thunkable is the no-code platform to build native mobile apps.In this work, we developed a Bluetooth interface that connects to our custom-made potentiostat sending commands and receiving the inference results.The ESP32 was configured as a BLE server using Generic Attribute Profile (GATT) protocol with a single service with two characteristics.These characteristics services were designated with their own universally unique identifier (UUID) and the mobile application uses the same UUID to receive and send data.The interface of the application shows the progress bar and the final outcome of the inference in percentage for each class.Figures S8 and S9, Supporting Information present the block diagram of the firmware and Bluetooth program used in this work.

Figure 1 .
Figure 1.a) Overview illustration of blood draw for neurotransmission detection with electrochemical potentials of dopamine, ascorbic acid, and uric acid.b) SWV curves of DA, AA, and UA measured separately in PBS solution with the superimposed curves of each triplicate.c) Current decrease around dopamine oxidation potential for mixture with different concentrations of ascorbic acid.d) Current decrease around dopamine oxidation potential for mixture with different concentrations of uric acid.e) Current response to interferences of both molecules in 100 μM of DA. f ) Potential shift of current peak for ascorbic acid interference in 100 μM of DA. g) Potential shift of current peak for uric acid interference in 100 μM of DA. h) Potential shift of current peak for both molecules interference in 100 μM of DA. i) SWV curves for the interference of AA in 100 μM of DA, with AA concentration ranging from 100 to 1000 μM.j) SWV curves for the interference of UA in 100 μM of DA, with UA concentration ranging from 100 to 1000 μM.k) SWV curves for the interference of UA and AA in 100 μM of DA, with AA concentration ranging from 100 to 500 μM.The dotted black lines represent the dopamine SWV response in absence of interferences.

Figure 2 .
Figure 2. Raw current from a fixed concentration of 500 μM of a) DA and AA and b) DA and UA.Processed SWV current curve from a fixed concentration of 500 μM of c) DA and AA and d) DA and UA.A nonexpert can visually identify key features of (c) and (d), such as in (c) the DA þ AA trends to the sum of both DA and AA, while in (d) the DA þ UA trends to the union of both DA and UA curves; however, this is not easily observed in the raw current curves.

Figure 3 .
Figure 3. a) Edge-AI device controlled by the mobile application used to measure 62 different concentrations of DA, AA, and UA.b) Circuit diagram block of the custom-made potentiostat device with the TinyML model developed for classification and identification of DA and contaminants.

Figure 4 .
Figure 4. Results of prediction of the five classes for both models.a) Confusion matrix of the quantized model.b) Confusion matrix of float32 model.The diagonal elements of this confusion matrix show the percentage of correctly classified solutions, while the off-diagonal elements indicate the percentage of misclassified ones.The uncertain column is the percentage of the elements that the model could not classify above the confidence level.c) Power consumption of both models.d) Total firmware memory usage.
and PBS blank was made to compose the dataset.As an additional step, a separate measurement of DA and PBS was done with different batches of sensors to increase the test set leading to a final sum of 5492 samples.The final dataset was composed of four categories: Contaminated DA, with 1620 training samples and 405 test samples; Clean DA, with 1314 training samples and 318 test samples; PBS, with 150 training samples and 38 test samples; and UC, with 1315 training samples and 332 test samples.Blood serum mixtures with different concentrations were used to created 21 SWV curves.These curves were used as unseen data for testing the ML model.