Closed-Loop Transcranial Electrical Neurostimulation for Sustained Attention Enhancement: A Pilot Study towards Personalized Intervention Strategies

Sustained attention is pivotal for tasks like studying and working for which focus and low distractions are necessary for peak productivity. This study explores the effectiveness of adaptive transcranial direct current stimulation (tDCS) in either the frontal or parietal region to enhance sustained attention. The research involved ten healthy university students performing the Continuous Performance Task-AX (AX-CPT) while receiving either frontal or parietal tDCS. The study comprised three phases. First, we acquired the electroencephalography (EEG) signal to identify the most suitable metrics related to attention states. Among different spectral and complexity metrics computed on 3 s epochs of EEG, the Fuzzy Entropy and Multiscale Sample Entropy Index of frontal channels were selected. Secondly, we assessed how tDCS at a fixed 1.0 mA current affects attentional performance. Finally, a real-time experiment involving continuous metric monitoring allowed personalized dynamic optimization of the current amplitude and stimulation site (frontal or parietal). The findings reveal statistically significant improvements in mean accuracy (94.04 vs. 90.82%) and reaction times (262.93 vs. 302.03 ms) with the adaptive tDCS compared to a non-stimulation condition. Average reaction times were statistically shorter during adaptive stimulation compared to a fixed current amplitude condition (262.93 vs. 283.56 ms), while mean accuracy stayed similar (94.04 vs. 93.36%, improvement not statistically significant). Despite the limited number of subjects, this work points out the promising potential of adaptive tDCS as a tailored treatment for enhancing sustained attention.


Introduction
Sustained attention refers to the ability of self-directed maintenance of cognitive focus for a continuous amount of time without being distracted, under non-arousing conditions [1].The ability to maintain attention is a crucial aspect of daily functioning, both in the private sphere (e.g., engaging in conversations [2] and driving a vehicle [3]) and in professional settings (e.g., working on a computer [4] and studying [5]).Furthermore, as a fundamental cognitive function, sustained attention serves as the foundation for other cognitive domains, including executive functions, memory, and learning [6].In addition, sustained attention performance is strictly linked to the activation of brain cortical networks, especially in the right hemispheric prefrontal and parietal regions [7,8].Therefore, enhancing sustained attention could potentially lead to overall improvements in various aspects of cognition.For this purpose, determining the underlying brain networks mediating it is crucial in understanding the mechanisms that govern this cognitive process [6].These aspects, with particular reference to the neural substrates and network dynamics underlying sustained attention, can be effectively investigated by exploring functional connectivity [9].This examines how different brain regions communicate and coordinate their activities to support sustained attention [9], providing insights into various neuropsychiatric disorders characterized by alterations in attentional functions [1,10].
Sustained attention is typically evaluated and studied during tasks involving subjects responding to specific stimuli over extended periods (i.e., more than 10 min) [11].Changes in sustained attention are measured both as fluctuations [12] and as decrement [13] in performance on these tasks over time.This decrement can be appreciated in different forms, such as a gradual decline in response accuracy, a higher percentage of errors, and a slowdown in reaction times.By quantifying the performance decrement, researchers can examine the endurance of sustained attention and identify factors that affect its maintenance or decline [6].
To enhance cognitive processes in both individuals with typical cognitive function and those with cognitive impairments, various methods have been explored.Recent studies highlighted the importance of the mental tasks used to elicit and modulate cerebral activity [14,15].Other studies have investigated the application of non-invasive brain stimulation methods, with a particular focus on transcranial direct current stimulation (tDCS) [16,17], which enables the controlled experimental manipulation and reversible modulation of neuronal activity.It achieves this by delivering low-intensity currents (0.1-2.0 mA) through one or more active electrodes, generating an electric field that can interact with neural processing, altering plasticity and ultimately influencing relevant behaviors, based on the specific brain region involved, and the electrical current intensity and polarity.This current propagates through the soft tissues and the scalp, returning via the reference electrode (cathode) to close the circuit [18][19][20][21].It is worth noting that the effect of the stimulation on neurons differs according to the type of polarity.Indeed, an anodal current increases cortical excitability, while a cathodal one produces hyperpolarization, decreasing cortical excitability.A positive anodal current is generally assumed to transiently enhance behaviors connected with the cortical region beneath the targeted electrode, while a negative cathodal current inhibits them [22].Moreover, as documented in different studies [23][24][25], volume conduction affects the actual distribution of the current, and most of the electrical field is found about midway and not directly under the electrodes.
To date, it is believed that tDCS could either enhance cognitive performance or alleviate symptoms across a spectrum of neurological conditions (e.g., epilepsy [26], stroke [27]) and neuropsychiatric disorders (e.g., neuropathic pain [28], depression [29]), depending on the specific cortical area being targeted.The influence of tDCS extends beyond the stimulation period, depending on the current intensity and duration.Short sessions induce transient excitability changes [30], while longer ones can have long-lasting effects [31].In general, five main parameters affect the outcomes: current polarity, current density, electrode size and position (affecting electric field orientation), stimulation duration, and the excitability of the stimulated area [32].However, discrepancies exist in the literature due to varying experimental protocols, targeted brain regions, and individual responses.Meta-analyses demonstrate contrasting results [33,34].Possibly, these disparities could be attributed to the limitations of conventional brain stimulation systems, which rely on static parameters and offer minimal adaptability to the specific subject and the changing brain activity.This approach could limit their effectiveness, as the same parameters may produce different results depending on the user and the current brain state.
In response to these limitations, closed-loop neurostimulation is emerging as an innovative solution.Closed-loop systems are designed to continuously monitor a patient's brain activity and adjust stimulation parameters accordingly, thus potentially providing personalized therapy that is both efficient and automatic [35].Compared to traditional openloop methods, closed-loop neurostimulation may significantly enhance clinical outcomes, reduce side effects, and boost overall efficacy [36,37].For example, the feasibility of a closedloop system was demonstrated in a proof-of-concept study involving six healthy subjects, considering the power distribution of the electroencephalogram (EEG) spectrum [38].Similarly, a device capable of automatically adapting the stimulation by analyzing only the beta range of the EEG signal is discussed in [39].However, by relying solely on the power distribution across different bandwidths, the informative content of the EEG signal is not fully utilized.For this reason, this paper also includes complexity metrics to explore brain activity and control an adaptive closed-loop tDCS to enhance sustained attention in healthy subjects.To the best of our knowledge, this is the first work that aims to develop a closed-loop system for this purpose, while most of the published studies analyze motor memory [40] and sleep [41].Specifically, the effectiveness of adaptive tDCS is investigated in enhancing the performances of the users during the Continuous Performance Task-AX (AX-CPT) [42].The hypotheses of our study are that the close-loop stimulation can increase accuracy in the task and reduce the reaction time (by counteracting mental fatigue), with respect to conditions in which the subjects are either not stimulated or tDCS is applied open-loop (i.e., with a fixed stimulation current intensity and location).
Our work is intended as a pilot study (applied on healthy subjects), but further deepening the investigation could also open interesting perspectives in the treatment of cognitive pathologies, e.g., Attention-Deficit/Hyperactivity Disorder (ADHD) [43] and autism [44].

Participants
This study involved ten healthy right-handed undergraduate students (3 females, 7 males; age 23.9 ± 0.6 years).All participants had either normal or corrected-to-normal vision and no history of any neurological or psychological disorder.The study was conducted in accordance with the Declaration of Helsinki and was approved by the Ethical Committee of the University of Turin (approval number 0125508).Both a written consent form and a "Transcranial electrical stimulation (tES) safety questionnaire" [45] (see Appendix A) were filled out before the beginning of the experiment.Subjects were asked not to consume caffeine, alcohol, drugs, supplements for memory/concentration, or medications inducing drowsiness (e.g., antihistamines, anxiolytics, etc.) within the 12 h preceding the experiment.
To verify the effective homogeneity among the candidates, a Go/No-go task [46] was performed.The test was structured into two parts: first, participants were instructed to respond to the "Go" stimulus when withholding their response to the "No-go" stimulus, while the second part exploits the reversal condition.Each stimulus lasted 500 ms, with an inter-stimulus interval (ISI) of 1500 ms.A total of 320 stimuli were presented, with 160 stimuli in each condition.Comparable results, in terms of the percentage of correct responses (>97%), were used as a selection test to ensure homogeneity in the participants.

Attention Demanding Task: AX-CPT
The Continuous Performance Task (CPT) is a neuropsychological test designed to measure complex attentional functions, including sustained attention and response inhibition, to assess various clinical conditions such as attention deficit disorder and schizophrenia [47].In this study, the AX-CPT variant [42] was used.During this test, randomly selected letters of the English alphabet are sequentially presented on a screen individually.Participants were instructed to respond as fast and accurately as they could when the letter X appeared immediately after the letter A while inhibiting the response for all the other cases.
The task parameters were configured as follows: a 70% probability for AX, 10% for non-A followed by X (e.g., BX), 10% for A followed by non-X (e.g., AY), and 10% for non-A followed by non-X (e.g., BY).A total of 1800 random stimuli were presented (i.e., 900 trials) with each letter shown for 500 ms.For this protocol we used the open source software PEBL (Psychology Experiment Building Language [48]) version 2.1, providing stimuli to the candidates in white color over a black background.Overall the task lasted 15 min.
The following attention indicators were estimated from the responses obtained from this task: total number of correct responses to each trial; accurate answer rate (AR); omission errors (i.e., number of errors resulting from the failure to respond to the target trial AX); commission errors (i.e., number of errors resulting from responding incorrectly to the non-target trials, e.g., AY, BX, BY); mean reaction time (RT), and RT variability.Moreover, we computed the Inverse Efficiency Score (IES), defined as the ratio between RT and AR [49].

EEG Acquisition and Processing
For this study, we used the Starstim 8 (Neuroelectrics ® , Barcelona, Spain), a wearable and wireless 8-channel system for both EEG acquisition and tDCS stimulation.Note that the channels used for the EEG recording could not be chosen for the tDCS stimulation.The EEG signals were sampled at 500 Hz with a resolution of 24 bit.During the whole experiment participants were seated and electrodes were secured with a neoprene cup based on the 10-10 standard.A reference electrode was situated near the right mastoid.Since one channel of the Starstim 8 was particularly noisy, the remaining ones were investigated: F7, FC5, FC1, Fz, AF4, F4, and FC6 (see Figure 1A).
EEG signals were segmented into 1-second sub-epochs and filtered with a two-stage Chebyshev IIR filter, including a low-pass type 1 (cutoff at 30 Hz with 20 dB attenuation at 35 Hz) to remove power-line and high-frequency noises and a high-pass type 2 (cutoff at 4 Hz with 20 dB attenuation at 2 Hz) to mitigate slow drifts.The EEG pre-processing is graphically reported in Figure 2B.It is worth noting that this strategy benefits from low computational cost and reduced complexity, making it also suitable for the closed-loop strategy, where very short latency is required.
Then, noisy sub-epochs (containing noise spikes, system glitches, or electromyography (EMG) bursts) with amplitude exceeding a threshold of ±85 µV were identified and removed.To detect and remove eye-blink corrupted epochs, a fast and automated eye-blink detection algorithm based on Median Absolute Deviation (MAD) was implemented in MATLAB ® .In particular, a noisy epoch was discarded if it contained at least one sample exceeding the threshold of 6 times its MAD (chosen by fine-tuning of few experimental data).Channel AF4 was specifically chosen as the reference for blink detection due to its frontal position, making it more susceptible to ocular artifacts.
To minimize EMG artifacts, a preventive approach was employed by instructing subjects to minimize movements, head shifts, talking, or position changes during the tests.
EEG signals were then segmented into non-overlapping 3-second epochs, from which different metrics were extracted, as detailed below.
Furthermore, given the inherent nonlinear properties of EEG data, analysis of complexity offers substantial potential in EEG research [52].These methods allow researchers to investigate self-organization and pattern formation in the brain's complex neural networks, offering deeper insights than traditional linear approaches.As a consequence, entropy metrics were included as well.
The best metrics for discriminating between concentration and relaxation states were selected through Fisher's Ratio (FR), which takes into account the means of the distributions considered (µ 1 and µ 2 ) and their variances (σ 1 2 and σ 2 2 ): (1)

Statistical Analysis
The following statistical tests were performed to check the significance of the variations in AX-CPT results when using different stimulation paradigms.The following performance indexes were considered: accuracy, RT, RT variability, and IES.AX-CPT results were explored with a Wilcoxon Sign Rank test; p-values below 0.01 and 0.001 were considered significant and strongly significant, respectively.

Experimental Protocol
The primary objective was the development of a closed-loop tDCS-EEG system to enhance sustained attention during the cognitive AX-CPT test in healthy subjects.The experimental protocol was divided into three phases plus a final validation, each separated by a minimum period of one week and a maximum of one month.Considering the variability in research protocols, individual responses and potential residual stimulation effects, the selected interval aligns with the range reported in existing studies [32].
The first part (Phase 1) was focused on EEG recordings and served to detect the best couple of EEG metric and channel that manifested the most significant differences during sustained attention tasks, while the remaining ones (Phase 2 and Phase 3) exploited the tDCS-EEG combination during the tasks with an open-loop and closed-loop stimulation, respectively.A graphical representation of the experimental protocol is shown in Figure 2A.It is worth noting that, before the AX-CPT task, candidates observed 5 min of rest in a static posture with their eyes open.For the whole duration of this interval, referred to as "Baseline 1", the EEG signals were recorded as well.The EEGs during Baseline 1 were used as a reference for the subsequent tasks.Each phase lasted approximately 20 min: 5 min for the Baseline 1 condition and 15 min to complete the AX-CPT test.
As reported in Figure 2A, Phase 2 was performed twice.That is because we investigated first the frontal tDCS with a stimulation current of 1.0 mA (Session 1) and then different current intensities in the frontal (0.5 and 2.0 mA) and parietal (1.0 mA) regions (Session 2).
In the next subsections, a more detailed description of the three phases is provided.It is worth noting that the three phases were completed in order.

tDCS Setup and Stimulation
As introduced in Section 2.3, the Starstim 8 device was used for this study.Taking into account the information available in literature [18,34], two possible configurations (graphically shown in Figure 1B) were chosen to personalize the stimulation.
Given the fixed size of the neoprene cup, it has been possible to guarantee replicability among the different phases of the protocol (described below) for the same subject (at least as a first approximation, as small displacements when repeating a test are unavoidable).Regarding the stimulation time, we stimulated the subjects for the whole duration of the AX-CPT tests (15 min) with either a fixed or adapted stimulation (open-and closedloop, respectively).

Phase 1
This phase aims to identify the channels that are mostly associated with a sustained attention state.This was accomplished through the implementation of a MATLAB ® algorithm that estimated metrics associated with the attentional states of healthy subjects.The implemented algorithm is based on prior research findings [61].Note that in this phase all the available electrodes were exploited for EEG recording (as shown in Figure 1A).
EEG was processed and metrics were estimated, as detailed in Figure 2B and Section 2.3.Overall, a total of 13 metrics were investigated.The whole set of features was normalized by subtracting and then dividing by the median of the Baseline 1 values.
The metrics showing better discrimination between concentration and relaxation states in terms of FR were selected.

Phase 2
The goal of Phase 2 is the identification of a personalized modality of stimulation.As reported in Figure 2A, this phase is divided into two sessions.Both are characterized by a fixed current tDCS during the AX-CPT test.
In the first session, a frontal stimulation (Configuration 1) with a current of 1.0 mA was applied during the cognitive task.By doing so, we evaluated whether an enhancement of attentional states due to stimulation occurs by comparing the metrics described in Section 2.4 during the AX-CPT test and Baseline 1 condition.Subjects were then divided into two groups (Group 1 and Group 2), based on changes in EEG metrics.This division enabled a rough distinction between those who responded well or not to the frontal stimulation, respectively.In particular, subjects in Group 2 showed an anomalous increase in the power of the theta rhythm during frontal stimulation, possibly reflecting mental fatigue [13] and/or immersion [62].
The purpose of the second session was to evaluate three possible changes in the stimulation strategy based on the assigned group.For Group 1 subjects, we stimulated in Configuration 1, exploring two current intensities: 0.5 and 2.0 mA.For Group 2, we investigated two different stimulation conditions: a current of 0.5 mA in the frontal region (Configuration 1) and a stimulation at 1.0 mA in the parietal region (Configuration 2).For both Phase 2 and Phase 3, the following channels of the Starstim 8 were used to record the EEG: AF4, FC6, and Fz.
Since the aim of the study is to adapt the stimulation to each individual subject, we derived the channel-metric pair that yielded the most favorable outcomes in each specific case.A classifier was developed to discriminate baseline and test values for each metric, using a threshold.Values exceeding the threshold were classified as test (1-positive class) and those below as baseline (0-negative class).For each experimental session, we selected the threshold that maximized the Youden's index where TPR is the True Positive Rate and TNR is the True Negative Rate.The resulting accuracy values for each channel-metric pair were calculated using a confusion matrix.This process was repeated across experimental sessions, considering only the ones that showed an increasing trend of the metrics during the test step compared to the baseline one.Then, accuracy in the AX-CPT was measured in this condition.

Phase 3
The purpose of this phase was to evaluate the effects of closed-loop EEG-tDCS on sustained attention state, by modulating stimulation parameters based on the subject's neural response.
Once the channel-metric pair was selected for each subject, the system initiated frontal stimulation at 1.0 mA and adapted the current intensity and stimulation site for each individual based on a personalized threshold system obtained in Phase 2 (see Figure 2C).The algorithm calculated the chosen metric every 3 s and assessed its deviation from the baseline after 20 epochs, allowing for minute-by-minute adjustments of stimulation parameters.This choice was made to balance neural response time with real-time system feasibility, considering the potential discomfort or disruption to the subject.If the mean of the estimated metric exceeded the threshold, we assessed whether this continued for three minutes.If so, then a current decrement occurred.When the estimated metric was below the personalized threshold, we compared the theta power of the signal (1-min length) with the theta threshold, fixed at 0.1 in this study.If the theta power of the signal exceeded the threshold, then the stimulation site was changed, otherwise a current decrement was applied.

Validation
To assess the possible effects of familiarity with the cognitive task, a final acquisition (referred to as "Validation") was recorded after the previous three phases.During this final step, we asked subjects to again perform the AX-CPT with the same conditions as Phase 1 (EEG acquisition only).Those last acquisitions, with a minimum delay of one week from Phase 3, were used to assess whether the volunteers improved their ability to perform the test (learning effect).

Results
We used Fisher's Ratio (FR) to identify metrics that exhibit the greatest differentiation between the concentration and rest states (Phase 1).The results are reported in Figure 3 where a heatmap shows the median Fisher's Ratio for each channel-metric pair across the whole set of subjects.The results show that entropy-based metrics exhibit high FR values for distinguishing relaxed and attentive states across all channels.
Therefore, we considered the FuEn and the MSEI, belonging to the single-and multiscale classes, respectively.Indeed, according to Figure 3, they guarantee the highest FR in the respective classes.As two pairs of electrodes were kept available for either frontal or parietal stimulation and AF4 was used for blink detection, only two channels could be used for the EEG acquisition during the following phases (see Section 2.7.2): we chose FC6 and Fz.
Note that we subtracted from each metric (estimated on 3 s of signal) its median value obtained during Baseline 1 (m d ) and we divided the resulting values by m d .Restricting the analysis to the FC6 and Fz channels only, we performed Session 1 of Phase 2 (stimulation with 1.0 mA in the frontal region) on all the subjects estimating the FuEn and MSEI during the EEG acquisition.Therefore, four different channel-metric pairs were considered: FuEn-FC6, FuEn-Fz, MSEI-FC6, and MSEI-Fz.The results are reported in Figure 4, where we compare the median values of the metrics.Channels are considered separately and each pair of bars is associated with a subject.The behavior of the subjects appears to be clustered into two groups.Specifically, not all the candidates enhanced the metrics due to the frontal stimulation at 1.0 mA (Configuration 1).Indeed, four subjects, classified in Group 2 (see Section 2.7.2), showed a variation of less than 10% on both channels.Among the subjects belonging to Group 1 (i.e., those who benefited from the frontal stimulation), channel FC6 was the most effective in discriminating attentional states, with FuEn showing the most substantial increase.To examine the relationship between stimulation current intensity and the selected metrics, we explored different stimulation conditions as described in Section 2.7.2.To do so, half of the subjects received the treatment with a current of 0.5 mA and the remaining ones with a current of 2.0 mA.
An in-depth analysis was also conducted within Group 2 to explore the factors contributing to the absence of attentional state enhancement during stimulation.A closer examination of the metrics, including previously excluded spectral features, revealed an atypical increase in theta band power during the test step with tDCS in all four subjects within this group.As reported in Section 2.7.2, we modified both the current intensity and the region of stimulation, exploring different modalities to try to help Group 2 subjects improve their attentional state.
In Phase 3, stimulation parameters were adapted to each participant based on their previously selected channel-metric pairs and responses, utilizing the closed-loop system described in Figure 2C.The temporal profiles of the stimulation current are presented in Figure 5, where the thicker lines represent the average trend in each group.Table 1 provides a comprehensive summary of the adapted stimulation protocols, detailing group, channel-metric pair, stimulation type, and maximum current intensity for each subject during the test.In addition to the analysis of the results derived from the metrics extracted from the EEG signal acquisitions, a comprehensive assessment was performed on the outcomes of the AX-CPT test administered to the subjects.
In Figure 6, it is possible to appreciate the performances of the AX-CPT test during different stimulation conditions.The average values of accuracy, RT, variability in RT, and IES are shown with their respective standard errors.The results show a significant improvement in the accuracy (Wilcoxon Signed Rank test) when using an adaptive closedloop stimulation instead of the no-stimulation conditions (p < 0.01 and p < 0.05 for the initial and the validation test, respectively).No significant differences were detected when comparing the accuracy of the adaptive and fixed stimulation.However, the adaptive closed-loop stimulation showed statistically significant reductions in the average RTs when compared to all the other conditions (p < 0.05 in all cases except p < 0.01 in the comparison with the first no-stimulation condition).Regarding RT variability, the closedloop stimulation showed a significant improvement only in the comparison with the no-stimulation condition (p < 0.05), still showing the smallest average value among the testing conditions.IES shows an improvement in performances during closed-loop stimulation with respect to all other conditions (with highly significant variation with respect to both conditions with no stimulation).Moreover, the overall trend of errors was assessed over time and the temporal variations in concentration stability across the different study phases are highlighted in Figure 7A, where the average number of errors made by the 10 subjects was calculated at 3-min intervals for each phase.Overall, an increase in errors in the final part of the protocol is observed.Figure 7B shows box-and-whiskers plots relative to the number of errors made by the candidates in different stimulation conditions considering the first and the last six minutes of the task.A Wilcoxon Signed Rank test showed a statistical decrease in performances, documenting the effect of fatigue on concentration during the task, with the exception of the case in which closed-loop stimulation was employed.With the same format as in Figure 7A,B, the variations in the average RT are shown over time in Figure 7C,D, respectively.Despite mental fatigue, RT is approximately constant (with the exception of the first test, for which an increase in the speed of reaction of the subjects is noticeable, as if they were becoming more familiar with it as time passed).We also notice that the participants were always faster (on average) when the adaptive stimulation was used.

Discussion
Neurostimulation can be useful in enhancing the attentive state.In this work, we explored whether a subject-specific and real-time adapted closed-loop stimulation can bring advantages over either a no-stimulation or a fixed-stimulation paradigm.We started by acquiring EEGs through the Starstim 8, a low-density system that can also be used for providing the tDCS stimulation sacrificing some electrodes for the EEG recordings.The first phase of the protocol aimed to find the best channel-metric pair associated with sustained attention during the AX-CPT task.Overall, the complexity metrics FuEn and MSEI resulted as the best among those investigated.This outcome is in line with [61], indicating that the complexity metrics are the most suited for determining the attention state in protocols involving EEGs.
The EEG channels less affected by artifacts and showing best discrimination between relaxed and concentration conditions were used to monitor the subjects during the tests and to control the adapted stimulation.The selected channels were FC6 and Fz, which is in accordance with [63] indicating that the frontal region plays an important role during attention tasks.AF4 was the reference channel for blink detection, due to its frontal position and susceptibility to ocular artifacts; considering its proximity to AF4 and low discrimination value, F4 was excluded.Moreover, left-side electrodes (FC1, FC5, and F7) were susceptible to EMG artifacts, especially given the participants' right-handedness primarily engaging the contralateral hemisphere in motor activity; consider also that most of the informative content in EEG could be appreciated in the right hemisphere when dealing with sustained attention [7,8].Additionally, these electrodes are positioned close to F3, which is used as an active electrode in subsequent phases, making them prone to stimulation artifacts.
Subjects were split into two groups, depending on their response to frontal stimulation observed during the first step of Phase 2. Indeed, as observed in Figure 4, some subjects showed on FC6 and Fz channels an increase in the complexity metrics chosen (FunEn and MSEI) after the 1.0 mA frontal stimulation (Group 1), whereas others did not (Group 2).This result is in line with the outcomes of previous studies [64,65], where other brain regions were shown to be involved in attention modulation in addition to the well-known frontal region [63]: one of them is the parietal region.Our outcomes partially confirm the results of [66] which indicate that the frontal region is a crucial neural hub for attention-related neurofeedback.However, further studies are necessary to verify this statement since both studies enrolled a restricted number of volunteers.
Group 2 subjects showed an increase in P θ during frontal stimulation, suggesting that they manifested a specific state known as immersion, which is characterized by increased involvement [62].Parietal stimulation was used as an alternative to frontal tDCS when the power of theta rhythm increased.In this way, the position of the stimulation constituted a further degree of freedom (in addition to the intensity of the stimulation current, and the EEG channel and metric) to better suit the subjects, particularly those we classified as Group 2. By analyzing the results of the tests during closed-loop stimulation (Phase 3), while Group 1 always received frontal stimulation, subjects in Group 2 consistently received parietal stimulation (Table 1).Concerning the intensity of stimulation, we also observed some difference across groups, with candidates of Group 1 showing a smaller tDCS than those of Group 2, but still converging to about 1.5 mA at the end of the test (Figure 5).
However, the most striking results concern the final performances (Figure 6).By analyzing data from the AX-CPT test, it is noticeable that the majority of errors tend to occur toward the end of the test (see Figure 7A).This pattern suggests a potential decline in concentration or the onset of mental fatigue as subjects progress through the task.
Specifically, adaptive neurostimulation can help the subject sustain mental activity.Indeed, there is a tendency for the number of errors to increase over time, on average (see Figure 7A), showing a decrease in attention due to fatigue.The smallest reduction in average performance is found in the case of closed-loop stimulation.Furthermore, comparing the number of errors made by the candidates at the beginning of the experiment (i.e., the first 6 min) and at the end (i.e., the last 6 min), performance decreases statistically for all conditions except in the case of closed-loop stimulation (see Figure 7B).This suggests that our subject-adapted stimulation protocol provides an aid in sustaining the demanding attentional task, being particularly effective in counteracting fatigue.The reaction time was also smaller (averaging across subjects) when using the closed-loop stimulation, compared to the other conditions (no stimulation or open-loop) and during the entire experiment (see Figure 7C,D).
Moreover, taking the overall performances, the closed-loop stimulation allowed increasing the accuracy (94.04%), and reducing the reaction time (262.93ms) and its variability (49.04 ms), resulting in a smaller Inverse Efficiency Score (279.24ms; notice that, despite the small dataset, the IES is also statistically smaller from the condition with fixed stimulation).
It is worth noting that in this study we did not investigate the causation between the channel-metric pairs in Phase 2 with the accuracy in the AX-CPT.However, the adaptation to the subject in closed loop allowed significant improvements in the performances (see Figures 6 and 7).Thus, the hypotheses of our study stated at the end of the Introduction (i.e., improvements in accuracy and reaction time) have been partially confirmed: when using the proposed closed-loop stimulation, reaction times and IES decrease statistically and accuracy improves, but only on average when compared to open-loop stimulation.It is noteworthy that volunteers participating in this study were healthy university students.Therefore, future studies enrolling subjects with deficit disorders would be useful to define which channels to consider for applying our method.Indeed, it has been demonstrated that people suffering from attention disorders manifest hypoactivation in the frontal region [66], so it is possible to assume that different channels would be chosen from the ones we adopted for modulating the stimulation.
To the best of our knowledge, this is the first study focusing on the development of a closed-loop system for attention enhancement.Therefore, it is not possible to comprehensively compare our results with the literature.Overall, this study aims to demonstrate a possible application of this stimulation strategy as an effective tool to enhance the attention state.Our solution outperformed on average both the fixed-and no-stimulation conditions underscoring the potential benefits of adapted stimulation in providing a more stable and consistent performance over time.

Limitations and Future Directions
This study shows an interesting potential application of tDCS in enhancing the performance of attention tasks.However, this work has different limitations.The study was conducted on a restricted sample and with a low-density system for EEG recordings only.When comparing the different stimulation modalities, the results do not look impressive.The stimulation improved the quality of the task by about 3% and reduced the reaction time by about 40 ms.The results of adaptive stimulation compared to a fixed current amplitude condition look even less significant.However, consider that we did not work on patients showing some cognitive impairments but on high-level university students in their final years of study, selected on the basis of good performances on a "Go/No-go" task.Their performances on the AX-CPT were very high (accuracy over 90% on average) and their reaction times were good even without any support from the stimulation.Thus, we could reasonably expect only marginal improvements.Future work is suggested including patients with cognitive deficits, where more room for improvement is expected.
Other future studies are suggested, involving a larger dataset (of either healthy subjects or patients) and high-density systems to investigate further the effects of our approach, test our hypotheses and analyze the brain activity with a higher resolution.
Subjects could be screened for cognitive status comprehensively before and after the tests.
Furthermore, it could be important to investigate the electric field distribution patterns in the brain and to study more deeply the effect of adaptive stimulation in different brain regions.Both the complex geometry and conductivity of the tissues (including the skull, the cerebrospinal fluid, etc.) affect the distribution of current induced by the stimulation and its effect on the brain.

Conclusions
This study describes an automatic closed-loop system for adaptive transcranial direct current stimulation (tDCS) to enhance sustained attention in an AX-CPT test.The main innovation is in the specific application associated with the adopted methodology for the closed-loop neurostimulation, involving complexity measurements as control parameters, and the possibility of changing both location and amplitude of the stimulation in real time.Despite a limited number of subjects, we obtained improvements over no-stimulation and fixed-tDCS conditions, both in terms of accuracy and reaction time.Moreover, the performances decrease over time, showing the effect of mental fatigue, when the subjects were either not stimulated or supported by a fixed tDCS.Closed-loop stimulation counteracted this effect by supporting the subjects in maintaining the focus on the task.
These preliminary results lay the basis for future analyses to explore the benefits of neurostimulation with tDCS.Specifically, to further improve the effectiveness of the closed-loop systems, future studies may consider the following directions: multi-sensor approaches (i.e., also considering heart rate or its variability) to find the optimal stimulation suited to the subject, the investigation of a large dataset (which could also be stratified with respect to participants' demographics), a solid comparison with other non-invasive brain stimulation, and the effect of long-term stimulation.Once this validation on healthy subjects is obtained, the protocol could be extended to patients (e.g., with attention deficits) or integrated into cognitive enhancement programs.

Figure 1 .
Figure 1.(A) Graphical representation of the electrodes used for recording the EEG signal.(B) Graphical representation of the two types of simulations used in this study: frontal (Configuration 1) and parietal (Configuration 2) stimulation, respectively.

Figure 2 .
Figure 2. Block diagram of (A) protocol phases (Phase 1, Phase 2, and Phase 3); (B) offline and online data analysis procedures; (C) closed-loop system used in Phase 3 for personalized stimulation adaptation.µ metric : average value of the interested EEG metric measured during the Baseline condition-th metric : personalized threshold estimated at the end of Phase 2-P θ : power of the EEG signal in the θ range (4-8) Hz-th θ : power in the θ range observed during the Baseline condition.

Figure 3 .
Figure 3. Results of Phase 1.The heatmap represents the median of the Fisher's Ratios for each channel-metric pair across all subjects.The channels and the metrics are reported vertically and horizontally, respectively.A detailed explanation of the metrics explored can be found in Section 2.4.

Figure 4 .
Figure 4. Results of Session 1 of Phase 2. Circle plots depict the impact of 1.0 mA frontal stimulation on channels FC6 and Fz.Each couple of bars is associated with a subject.Individuals belonging to Group 1 are colored light and dark green, while the ones belonging to Group 2 are identified with light and dark orange.Each bar represents the percentage increase (or decrease) in the metrics during the test with respect to the median value estimated in Baseline 1. Recall that FuEn and MSEI stand for Fuzzy Entropy and Multiscale Sample Entropy, respectively.

Figure 5 .
Figure 5. Results of the closed-loop simulation in Phase 3. Dynamic change in current intensity during the test phase for both Group 1 and Group 2. The thicker lines represent the average trend in each group, while the thinner ones are related to each subject.

Figure 6 .
Figure 6.Average accuracy, reaction time (RT), RT variability, and Inverse Efficiency Score (IES) for the different conditions: initial test with no stimulation (yellow), fixed stimulation at 1 mA (blue), closed-loop (green), and final validation (orange).On each bar, the mean and standard error are shown.The significant results of the Wilcoxon Signed Rank test are reported for each pair (p < 0.05 *, p < 0.01 **).

Figure 7 .
Figure 7. (A) Average error over time across subjects during the AX-CPT test, considering different phases of the experiment and stimulation conditions.The dashed line divides data into two parts relative to the first and last six minutes of the task.(B) Boxplots relative to the number of errors made by subjects in the different stimulation conditions during the first and the last six minutes of the experiment.The significant differences in the performances in the initial and final parts of the experiment are tested with the Wilcoxon Signed Rank method (p < 0.05 *, p < 0.01 **).(C) Same as (A), but considering the reaction time (RT).(D) Same as (B), but considering the RT.

Table 1 .
Adapted stimulation: group, channel-metric pair, stimulation type, and maximum current intensity for each subject during the test.