1 Introduction

The main negative element of smartphones is dependence on electronic games and social networks among children, adolescents and adults [1]. Nomophobia (an illness characterized by the fear of being without access to a smartphone, video game, or other electronic device to communicate via the Internet) generates the need to maintain social networks as a persistent, parallel world that is always active and online for as long as possible [2]. The excessive use of smartphones causes psychological and behavioral damage in individuals comparable to that of drug addicts [3] as well as causing both stress and insomnia [4] and reduced school performance in children and adolescents [5].

In schools, the use of smartphones can have a distracting effect, leading to a loss of focus or a decrease in the degree of attention during classes depending on the age of the student [6]. Therefore, the research target of this work is a method that uses a wearable prototype (a Cap) with Internet of Things (IoT) technology, capable of indicating the degree of attention of students during their school activities by combining the behavior of their heart rate variability, HRV [7, 8] and the effects of mindfulness intervention [9], in particular, using the Toronto Mindfulness Scale [10]. A scale that quantifies the degree of attention in “Curiosity” and “Decentering”. Other scales were used simply as a comparison, such as Philadelphia Mindfulness Scale, PMS [11] and Mindful Attention Awareness Scale, MAAS [12].

Others researches of focus students attention have explored Machine Learning [13], Electroencephalogram (EEG) based Brain–Computer Interface to measure the attention level of users [14] and applications combined of gamification element and an interactive response system (IRS) in the development of a gamified IRS that examines its effects on the intrinsic and extrinsic motivation, engagement, and attention of junior high school students when learning English [15].

However, based on the central idea of the IoT to monitor individuals’ HRV, the physiological basis of the human body is the simultaneous actions of the sympathetic nervous system (SNS) and the parasympathetic nervous system (PNS) [16], given that both constitute the human nervous system [17, 18].

It is known that the SNS transmits messages in a bidirectional flow inside the spinal cord that can accelerate the heartbeat, dilate the bronchi of the lungs, decrease motility of the large intestine, constrict blood vessels, cause pupil dilation, initiate sweating, and increase blood pressure. The PNS, in contrast, transmits messages via the vagus nerve [19, 20], a shorter and therefore faster-acting pathway than the spinal cord [7] that seeks to balance the excesses of the SNS, i.e., by slowing the heart rate (HR) and decreasing blood pressure, adrenaline and sugar in the blood. With the actions of the SNS, especially the PNS, we can obtain HRV in milliseconds [8].

The period in milliseconds is calculated between two subsequent referential R peaks of the QRS complex wave [21] creating the \({RR_{n}}\) signal. The proposed affordable wearable device measures this time using blood oxygenation attached to the earlobe of the individual [22] and detects oxygen peaks by means of infrared reflection on the bloodstream with every pulse of the heart [23].

For a healthy individual, it is natural that the \(RR_{n}\) beat interval changes during daily life, either during physical activity or at rest. The lower the HR, the higher the HRV [24] and the greater the action of the PNS. For individuals with emotional or social disorders, such as attention deficit hyperactivity disorder (ADHD) and chronic stress, the HR is higher, and consequently, the HRV is lower [25, 26].

However, if an individual practices meditation of any type, the HR is lower and the HRV is higher [27, 28]. In this study, highlight the Western meditation practice known as mindfulness, adapted from the Vipassana practice outside of a religious context by the Zen Buddhist Kabat-Zinn [9]. Mindfulness is self-reflection with self-awareness that seeks to reduce levels of stress and anxiety by heightening conscious experience in a given moment, i.e., by intentional and effortless full attention [29, p. 1481] with the mind centered in the moment and, above all, with nonjudgmental acceptance (compassion) [30, 31].

To associate the mental health of a person with their HRV, there are previous statistical studies in the time and frequency domain [26]. With regard to time, the pRR50 counts the quantity of \(RR_{n}\) interval greater than 50 ms on the total of \(RR_{n}\) interval analyzed, and the root mean squared successive differences (rMSSD) is related to the mental workload or the degree of activity of the parasympathetic autonomic system [24, 32] and represented by Eq. 1.

In the frequency domain, the power spectral density of the QRS signal uses the fast Fourier transform in two groups: low frequency (LF) from 0.04 to 0.15 Hz and high frequency (HF) from 0.15 to 0.4 Hz [33]. HF corresponds to parasympathetic and vagal activity, while LF is sensitive to the two activities of the autonomic nervous system, SNS and PNS. Regardless of the domain of analysis, HRV should be observed between 0.5 and 30 min [34, 35].

Other psychological studies [27, 28] present results that demonstrate increases in HRV in participants undergoing medium- and long-term training in ancient and religious Vipassana meditation (the birthplace of mindfulness) in addition to reducing stress and increasing alertness through mindfulness meditation [27, 36,37,38].

On the technology side studies, highlights [39] that propose a multimodal system which integrates a head-motion module, a pen-motion module, and a visual-focus module to accurately analyze students’ attention levels in class and in [40] shows the NeuroSky’s MindWave Mobile, a commercial EEG device used for measuring brain waves to determine students’ attention level in real classroom with one hour class.

In view of this and additionally, to the measurement of HRV performed by the Cap, this study evaluates a methodology to measure the degree of attention of senior high students by collecting the surface temperature of the forehead and head/neck movements using sensors of the Arduino family. This is followed by the presentation of the methodology.

2 Methodology

The points of this research were a method and a prototype which evaluates the probability of ranking in “Curiosity” and “Decentering” [10] about degree of students’ concentration while they were engaged in their school activities using a wearable device with IoTs technology, specifically during a 100 min class, divided into two 50 min interval. The method consisted of the following steps:

  1. (1)

    Wear the Cap on your head.

  2. (2)

    Turn-on the Cap’s switch.

  3. (3)

    Check the infrared sensor position on the earlobe using a mirror. The green sensor LED must be in the center of earlobe.

  4. (4)

    Activate the Android developed application:

    1. (a)

      Type your name in empty field.

    2. (b)

      Take your Cap’s number (1 up to 13) in red button menu.

    3. (c)

      Press the yellow button to start Bluetooth communication with Cap.

    4. (d)

      View the heartbeat, temperature, and head/neck movements monitored by the app.

    5. (e)

      If the heartbeat is not arriving correctly, increase the earlobe sensor sensitivity using the app’s orange button until the heartbeat match the pulse in the neck using the index and middle fingers or listening to the heartbeat through the Cap’s beep (turned-off as default).

  5. (5)

    Leave the smartphone nearby, but without use it during the class.

  6. (6)

    Standing in front of the computer, following the remote class for 50 min.

  7. (7)

    After 50 min, answer the Toronto questionnaire [10] via Google forms.

  8. (8)

    Continue in front of the computer, following the remote class for more 50 min.

  9. (9)

    Answer again the Toronto questionnaire and two other questionnaires, PMS [41] and MAAS [42], all in separated Google Forms.

  10. (10)

    Press the app’s “send data” button, turn-off the Cap’s switch and exit from app.

Detailing the method, 155 invitations were sent to students’ parents with the informed consent terms attached (the invitations were sent by e-mail due to COVID-19 pandemic isolation rules). The students were regularly enrolled in senior high school at Internacional Radial IEB, located in São Paulo, SP. In parallel, informed consent was sent to the same 155 students, all of whom were under the age of 18. The project received approval from the Research Ethics Committee of the Mackenzie Presbyterian Institute under protocol number CAAE: 38711120.8.0000.0084.

The samples consisted of voluntary participation by the first 20 parents (due to underage children) and their children who met the inclusion criteria: any color/race or sexual orientation, between 15 and 17 years old, regularly enrolled in the 1st or 2nd year of senior high school and having a smartphone with the Android system. As exclusion criteria, the student could not be under treatment with medication for heart disease, stress, depression, ADHD, anxiety, or chemical dependency, could not have ear-hole spacers installed in the lobes, and could not have more than two holes in each lobule. The students could not have any diagnosis of heart problems. Subsequently, we conducted virtual and individual interviews confirming the inclusion and exclusion criteria until we obtained the first 13 students, 8 women and 5 men, with an average age of 16.1 years with SD \(\pm 0.58.\)

After the selection of the 13 eligible participants, a new collective and virtual meeting was held via Google Meet to clarify doubts and explain the objectives and benefits presented in the informed consent during the invitation. If there were any dropouts in this step, it would have been necessary to return to the previous step for replacement; however, there were no dropouts.

The next step was the personal and individual delivery of each IoT Cap prototype (composed of a Cap with an IoTs, rechargeable 9 V battery, battery recharger, USB cable and a single magnet to attach the sensor to the earlobe) in their respective homes. The kit was sanitized (using Lysoform Spray Johnson, with 99.9\(\%\) efficiency against germs) and kept inside the box for 60 days. In addition to this procedure, a sachet with alcohol gel was added to the external lid of the box so that the student could sanitize his/her hands before first contact with the Cap as a way to prevent the harmful effects of COVID-19.

On the day after the delivery of the kit, another general and virtual meeting was held for training on the use of the wearable device and proper positioning of the HR sensor on the earlobe. The app was installed on the participant’s own smartphone, and the Bluetooth connection between the smartphone and the Cap was tested to ensure its proper functioning and data storage in the researcher’s Google Drive. As a complement, an online manual was available for student consultation with images and videos that reinforced the virtual training conducted directly with the researcher.

With the Cap and app developed exclusively for this research working properly at each student’s residence, a common school class (like Mathematics, Biology, Chemistry, History, Physics, Philosophy or Brazilian–Portuguese Language) was randomly defined in which the Cap would be tested. This class was from 7:30 a.m. to 9:10 a.m., totaling 100 min of continuous monitoring during school activities. During this period, the researcher followed the procedure on-site inspection (respective homes of participants), one by one, validating the \(RR_{n}\) interval, the external temperature of the forehead surface, and head/neck movement data stored in Google Drive using student’s smartphone in a separated room and Bluetooth communication, in addition to monitoring the remote class on your own computer, to ensure a controlled environment.

According to the pedagogical scheme adopted in the school because of the COVID-19 pandemic, all 13 students entered the respective subject of their course via Google Meet (Google’s video calling platform), where the students were normally organized in virtual classrooms with their respective 1st or 2nd grade classes. The 13 selected kept their cameras and microphones on during the class, and the subject teacher of each class taught the class to all students normally.

After each 50 min lesson using the Cap, each participant completed the Toronto questionnaire [10], quantifying the degree of full attention referring to the last 50 min of activity. This questionnaire was completed twice via Google Forms. The researcher followed the completion by video call (following the same scheme of simultaneity of the 100 min class), where each student assigned a score for the questions that classified his or her own degree of attention. The Toronto questionnaire was translated by the researchers involved in this work due to its relevance in quantifying the degree of the students’ full attention in the last moments of the class.

About PMS [41] and The MAAS [42] questionnaires, their scales were validated in the Portuguese–Brazilian language, the purpose of their applications is to make performance comparisons with Toronto.

After data collection, the researcher made correlations and statistical analyses between the \(RR_{n}\) interval extracted during the 100 min class and the answers to the mindfulness scale questionnaires completed immediately after. It was expected that a relationship would be found between maximum HRV and the questionnaire scores, in specially, the Toronto Curiosity scale that measures the positive state of attention from the last moments.

At the end of each trial, the kit was collected by the researcher and isolated (each student used an exclusive kit because COVID-19 pandemic), and went to another student’s home address to start a new monitoring. Students live nearby to each other, were 3 tests a day, spending 5 days in total to complete the tests.

The participating students received their individual report with conclusions about their degree of attention. The grades are presented in the “Results” section.

2.1 Instruments

2.1.1 Prototype Cap

The technology employed in the prototype was the IoT, which allows mobility, connectivity, scalability, low power consumption, intelligence, miniaturization of electronic boards, and multifunctional sensors [43,44,45,46,47,48]. Other studies have shown the feasibility and accuracy of remotely monitoring vital signs [49,50,51]. With the versatility of the IoTs, a Cap-shaped prototype was designed, with circuits fixed (sewn) on its external side.

Figure 1 shows the Cap model, the environment test and the circuit. The main board comes from a worldwide open platform [52, 53], model Arduino Nano ATmega328 V3, 16 MHz clock, 31 KB flash and 1 KB EEPROM (no storage memory), powered by a 9 V rechargeable battery through the Vin pin (which in turn has an input voltage regulator that supports 7 to 20 V and provides 5 and 3.3). From the main board, the power supply is derived for the other peripheral boards, such as the sensors and the Bluetooth communication board and a EEPROM CJMCU-2516/16 MB Arduino memory module, with I2C interface.

Fig. 1
figure 1

Source designed by the author

Wearable Internet of Things device in the form of a data collector Cap. In a a student in home-controlled test, b Arduino circuit and the heartbeat sensor attached to wire and magnet, c 13 Caps and batteries group, one for each subject, and d the circuit.

The HR sensor (MAX30100 family) is a low-cost reflected infrared oximetry sensor [23, 54] composed mainly of an instrumentation amplifier with no need for a symmetrical power supply. To avoid ear vessel constriction and, consequently, the increase in infrared detection error, six subjects wore a coat during the tests.

The temperature sensor, of ranging from \(-40\) to \(+ 85\,^{\circ }\)C (clipped to the front of the Cap and inside, over the forehead of the skull) is integrated with the MPU6050 gyroscope motion sensor, which can determine simultaneous, movements in the x, y, z axes of the head and neck. Its communication with the Arduino main board is via the I2C bus.

The Bluetooth board is the HC05 model of the master-slave type, with the BC417 radio chip from the British company CSR and the American telecommunications group, Qualcomm. The baud rate between the Arduino Nano main board and the Bluetooth board is 115,200 bps via the serial 232 bus. Below the 115,200b rate, there may be overlapping samples for short RR interval that may generate data losses according to the tests performed.

2.1.2 App

After the beats are detected by blood oximetry, the data are transmitted via Bluetooth radio in real time to the student’s smartphone, but handled by the researcher for a controlled environment, which is loaded with an app developed by the researcher. App usability can be observed in Fig. 2. This is designed to the student pairs the Cap with his/her smartphone via Bluetooth by entering the standard code 1234 when prompted. Next, the participant or researcher opens the application, types the student’s name in the “Enter your name” field, then expands a menu by clicking the “(1) Cap #” button and chooses the Cap he/she is wearing (ranging from 01 to 13).

Fig. 2
figure 2

Source developed by the author

Screenshot of the Android app, developed for the purpose of this thesis.

Finally, by means of a short click on the “(2) On–off” button, the app connects with the Cap. If this communication is successful, the same “(2) On–off” button turns green color. The following are the screen details of the Android app. Item “(3) Calibration” on the screen, serves to calibrate the oximetry sensor sensitivity reducing the threshold of the Q peak considered as the minimum to form the wave) and item “(4) Send data” serves to send the csv database file to the cloud storage (specifically Google Drive), which will be further processed via MATLAB. The “Exit” button kills the application. Below, there is a breakdown of the user interface:

  • Cap the Cap identification number (between 01 and 13) is loaded in front of this word when it successfully connects to the application.

  • Man Icon this icon varies between “sitting man” and “standing man”, indicating whether the Cap has detected the user’s head/neck movements by means of the gyroscope.

  • Speaker Icon the participant can turn the beep (which sounds synchronously with his/her heartbeat) on and off by making a quick, vertical upward movement with his/her head (i.e., turn on–off with vertical head movements).

  • Thermometer Icon indicates the external temperature of the forehead surface of the skull in degrees Celsius.

  • \(\left[ bmp\right]\) indicates the heartbeat value per minute.

  • \(\left[ avg\right]\) indicates the moving average of heartbeats per minute. This moving average (MA = 2) samples (a simple low-pass filter that avoids high-frequency noise at detection).

  • \(\left[ var\right]\) variability between the sample peak \(R_{n}\) e \(R_{n+1}\) in milliseconds.

2.1.3 Questionnaires

The participants completed three questionnaires, Toronto, PMS and MAAS after the 100-min period of HRV monitoring during school activities at home, but Toronto questionnaire was answered after the first 50 min too.

The first questionnaire, Toronto [10], has 13 questions divided into two subgroups: the “Curiosity” score with 6 originals questions (17, 32, 26, 06, 39 and 41) and the “Decentering” score with 7 questions (34, 33, 37, 42, 40, 35 and 36). Consequently, the Toronto generates two results, and both have five answer choices: “(0) not at all”, “(1) a little”, “(2) moderately”, “(3) quite a bit” and “(4) very much”. Each subgroup is added, and its average is obtained. A value closer to 4 indicates more curiosity or more decentering, respectively, the individual will be, in the last moments. A mathematical study considered just the Toronto Curiosity scale because the Cap’s purpose is to identify the state of positive attention.

The second questionnaire is the PMS, which also assesses the quantification of the subject’s full attention state [41]. The result of the PMS is also obtained by simple average of the score of the 20 questions, which can be between 1 and 5. However, the PMS has two facets of mindfulness: acceptance and awareness (equivalent to “self-awareness” or “acting with awareness” [41]. Again, the PMS generates two results. The closer to the value is to 5 in each of the subgroups of 10 questions, the higher the degree for each facet in last days.

The third and last, MAAS, objectively stratifies the state of full attention of the lifestyle [42], unlike the last days (PMS) and last hour (Toronto) degrees. The MAAS result is obtained by adding the score attributed to each of the 15 questions, which can be between 1 and 6, and then dividing this sum by 15 to obtain the final average. The closer this average is to the value of 6, the higher the degree of full attention of the participant.

2.1.4 Variables Analysis

In the area of neuroscience, four signals are observed here: BPM, RR interval, temperature, and head/neck movements. Additionally, the pRR50 was also analyzed. In the engineering area, the transmission error was analyzed using the CheckSum8 Modulo 256 (before and after the transmission) and the earlobe sensor error (that collects BPM and \(RR_{n}\)) was observed by samples replacement percentage. Beyond, standard deviations SD1 and SD2 of \(RR_{n}\) samples [55, 56] were considered too.

In the area of psychology, are used the averages of the three questionnaires: Toronto, PMS and MAAS. An association was defined between the rMSSD (monitored on students) and their questionnaires, in which results supported the hypothesis of measuring the degree of full attention using the IoTs, in particular with the Toronto’s Curiosity questionnaire. Considering this, the p-value hypothesis test was used between rMSSD and Toronto’s Curiosity questionnaire averages.

The Poincaré plot (a quantitative visual tool used to evaluate HRV plotting) together rMSSD value were used to highlight the possibility of Cap performing measurements as expected. There is a mathematical relationship between rMSSD and Poincaré plot [55,56,57], as shown (Eqs. 1 and  2). The rMSSD (root mean-squared successive difference between \(RR_{n}\) and \(RR_{n+1}\) of N packets) index is equivalent to the standard deviation in the geometric analysis of the Poincaré map, and the map is the crosses the \(R_{n}\) (x axis) with \(R_{n+1}\) (y axis) samples in time domain, creating a dispersal graph following a diagonal identity of 45\(^{\circ }\) and a Distribution Normal and \(\mu =0,\) as shown in Fig. 3.

$$\begin{aligned} rMSSD= & {} \sqrt{\dfrac{\sum _{i=0}^{N-1}({RR_{n}-RR_{n+1}})^{2}}{N-1}} \, ({\text {ms}}), \end{aligned}$$
(1)
$$\begin{aligned} rMSSD\equiv & {} SD1\cdot \sqrt{2} \, ({\text {ms}}). \end{aligned}$$
(2)

In [55] shows SD1 is equivalent to the width of the scatter of points perpendicular to the identity line and behaves as an instantaneous recording index of the beat-to-beat variability , while SD2 appears to represent the scatter of points along the identity line and the HRV in long duration recordings [55, 56].

Fig. 3
figure 3

Source elaborated by the author

SD1 and SD2 dispersion on the Poincaré map of \(RR_{n}\) and \(RR_{n+1}\) samples.

The HRV analysis for the 100 min class was segmented into interval 50 min, based on [34, 39, 40, 58]. Thus, the data were organized as follows:

  • 1st interval from the 1st to the 50th minute.

  • 2nd interval from the 51st to the 100th minute.

Three signal enhancement techniques were adopted for mitigate the discarded packages post-broadcast Bluetooth, because the observation windows depend directly on the number of packets processed to obtain the 50 min interval. The techniques were: (1) replacement, (2) truncation and (3) filtering:

  1. 1.

    Truncation noisy samples x whose \(RR_{n}\) interval became larger than 1550 ms were truncated to this value. The same occurred for \(RR_{n}\) samples smaller than 250 ms forming the \(RR_{Tn}\) time-series signal. These limits were adopted because they correspond, respectively, to the largest and the smallest \(RR_{n}\) interval among the thirteen participants in the observed scenario in the 100 min lesson. It was necessary due casual bad sensor contact in the earlobe in some moments. See the Arduino algorithm (place where it occurs):

    $$\begin{aligned}&\hbox {if }(RR_{n} > 1550)\hbox { then }RR_{Tn} = 1550\\&\hbox {else-if }(RR_{n} < 250)\hbox { then }RR_{Tn} = 250\\&\hbox {else }RR_{Tn} = RR_{n} \end{aligned}$$
  2. 2.

    Replacement corrupted samples y received from Arduino that were identified in the interpretation of CheckSum8 Modulo 256 between Cap and smartphone, had yours noisy \(RR_{Tn}\) and \(BPM_{n}\) recovered (or substituted) with the average of four subsequent previous samples forming \(\overline{RR_{Tn}}\) and \(\overline{BPM_{n}}\) time-series signal, i.e., just corrupted samples had:

    $$\begin{aligned} \overline{RR_{Tn}}= & {} \dfrac{1}{4}\sum _{j=1}^{4}RR_{T_{n-j}}, \end{aligned}$$
    (3)
    $$\begin{aligned} \overline{BPM_{n}}= & {} \dfrac{1}{4}\sum _{j=1}^{4}BPM_{n-j}. \end{aligned}$$
    (4)

    Over these two techniques accumulated (truncation and replacement), in which some sample \(RR_{n}\), \(\overline{RR_{Tn}}\) and/or \(\overline{BPM_{n}}\) was/were processed by one or both techniques, the Arduino do \(x=x+1\) for truncation and MATLAB algorithm do \(y=y+1\) for replacement, and an overall error rate was calculated:

    $$\%Error = \dfrac{x+y}{N},$$
    (5)

    where N is the number samples from Arduino stored in memory shield without any signal processing (original signal from infrared sensor). The results are shown in Table 3. Now, the final packet has \(RR_{n}\) and/or \(\overline{RR_{Tn}}\) and/or \(\overline{BPM_{n}}\) forming the \(RR_{Fn}\) final.

  3. 3.

    Filtering all \(RR_{Fn}\) was submitted to a moving average of 2 samples (MA = 2), creating \(\overline{RR_{Fn}}\).

    $$\overline{RR_{Fn}} = \dfrac{1}{2}\sum _{j=0}^{1}RR_{Fn+j} \, ({\text {ms}}).$$
    (6)

    This value was adopted minimally to reduce the spuriousness that borders the limits of the Poincaré maps without changing their shape (in particular, their width). It is essential to maintain “perpendicular width” of the Poincaré because it represents the individual’s HRV [56]. The geometric maintenance of the Poincaré map is important to prove the hypothesis of the degree of full attention measured through the IoTs.

The temperature, given in \(^{\circ }\)C, was extracted from the frontal bone surface (or forehead). There was no intervention to bring the sensor into direct contact with the skin, such as shaving the hair. The sensor remained inside the Cap, and the temperature was recorded with each heartbeat within the two-observation window of 50 min, and the mean and standard deviation were calculated.

Regarding the head/neck movement, the physical behavior of the student was rated on a binary basis of whether the student was moving at each heartbeat. For each subject, the minutes in movement were added within each interval of 50 min, and again, the mean and standard deviation were calculated.

3 Results

Results are summarized in Table 3, but before, the following Table 1 serves as key-meanings.

Table 1 Indexes evaluated in the time domain during 100 min of class and divided into 1st interval and 2nd interval

3.1 Treatment of Noisy Samples

Table 3 (6th row) shows the average transmission Bluetooth error rate (Eq. 5) for each Cap (max value was \(5.3\%\) for Cap 01 in 2nd interval of 50 min and min was \(0\%\) for Cap 05).

The overall average coefficient \(\overline{RR_{Fn}}/RR_{Fn}\) between 13 participants was \(0.974 \pm 0.02,\) which corresponds to the maintenance of the original Normal Distribution \(RR_{n}\).

In Fig. 4a, it’s an example (Subject 05) that shows the blue \(RR_{Fn}\) samples are noisy and spread (without MA = 2), and yellow points, show \(\overline{RR_{Fn}}\) signal more concentrated (with MA = 2) around the diagonal identity of Poincaré [56].

Fig. 4
figure 4

Source elaborated by the author

Example of MA = 2. Item a overlapping \(\overline{RR_{Fn}}\) interval of subject 05 (female, 16 years old) at 50 min with the effect of the MA = 2 filter (yellow color) and \(RR_{Fn}\) without the effect (blue). Item a a subject female, 16 years old. b it’s histogram.

Figure 4b, the original histogram \(RR_{Fn}\) is shown in red, while in violet color, had flattening of the noise peaks of \(\overline{RR_{Fn}}\) with MA = 2, but mean and deviation remain the same with filtering.

3.2 Subjects’ Data

The information consolidated in Fig. 5 are the degree of attention of the subject 01 (male, 15 years old), 02 (female, 16 years old), 03 (male, 16), 04 (female, 15), 05 (female, 16), 06 (male, 16), 07 (male, 16), 08 (female, 17), 09 (female, 16), 10 (female, 16), 11 (female, 17), 12 (male, 16) and 13 (female, 16 years old). The green curve represents the Curiosity attention, while the red curve represents the Decentering attention, although the goal is Curiosity. Note the radar central scale from 0 to 4 corresponds the Toronto scale range and the rMSSD values are shown on the radar’s margin. In Fig. 5a shows the highest Curiosity attention degree for subjects 01, 06, 07 and 10 based on Toronto questionnaire. For subjects 02, 03 and 05 were balanced between Curiosity and Decentering, and for 04, 08, 09, 11, 12 and 13 had the predominance Decentering attention based on Toronto questionnaire [10]. In Fig. 5b the highest values of the degree of Decentering for the participants 01, 03, 06, 07, 08, 09, 10, 11, 12 and 13, while the 02 and 05 were balanced between Decentering and Curiosity, and finally, just subject 04 had highest value in degree of Curiosity.

Fig. 5
figure 5

Source elaborated by the author

Curiosity and Decentering Map. In a, shows the first 50 min of monitoring, the subjects 01, 06, 07 and 10 predominated Curiosity attention, while 04, 08, 09, 11, 12 and 13 predominated Decentering attention, 02, 03 and 05 were balanced. In b, shows the last 50 min, where just the subjects 04 kept up the predominate Curiosity attention, while the others predominated Decentering attention.

To prove this statement, was adopted the Z-test (Eq. 7) at 5\(\%\) significance (\(p{\text {-}}value \le 1.9599\)) for the variances of the rMSSD and the degree Toronto Curiosity questionnaire values presented in Table 3.

For example, consider the values of subject 01 of rMSSD = 133.5 ms in the first 50 min interval of the class and in the second interval of 50 min, his rMSSD fell to 44.8 ms. Take the median between the two Curiosity Toronto values (3.83 and 3.49, respectively, 1st and 2nd interval) to represent a unique Curiosity degree value. The example calculation resulted in the following:

\(n_{1} = 2\), \(n_{2} = 2\) (number of tests or interval)

$$\begin{aligned}&\overline{X_{1}}=(133.5 + 44.8)/2 = 89.15\\&\overline{X_{2}}=[(3.83 + 3.49)/2 = 3.66\\&\sigma _{1}^{2} = \dfrac{(133.5 - 44.8)^{2}}{2} = 3933.85\\&\sigma _{2}^{2} = \dfrac{(3.83 - 3.49)^{2}}{2} = 0.0578\\ \end{aligned}$$

Substituting in Eq. 7, the following result is obtained:

$$\begin{aligned}&Z = \dfrac{(\overline{X_{1}} - \overline{X_{2}})}{\sqrt{\dfrac{\sigma _{1}^{2}}{n_{1}}+\dfrac{\sigma _{2}^{2}}{n_{2}}}} = \dfrac{(89.15-3.66)}{\sqrt{\dfrac{3,933.85}{2}+\dfrac{0.0578}{2}}} = 1.926 \\&\quad 1.926< 1.9599\,(P<0.05) \\&\quad H0\hbox { accepted} \end{aligned}$$
(7)

where:

  • H0: \(\mu _{rMSSD} = \mu _{Curiosity Toronto}\)

  • H1: \(\mu _{rMSSD} \ne \mu _{Curiosity Toronto}\)

H0 is the accepted hypothesis where the highest Toronto Curiosity degree values are related to the highest values of rMSSD between two observed interval with difference greater than or equal to 88 ms. Therefore, all participants who presented rMSSD greater than 88 ms from 1st to 2nd interval or vice versa, had a Curiosity degree attention measured (subjects 01, 06, 07 and 10 at 1st interval and 04 at 2nd in Fig. 5). Table 2 shows all results Z-test within the \(p{\text {-}}value\) criterion.

Table 2 Z-test values for each subject S

The averages temperature between 1st and 2nd interval for each participant were: \(T_{S01} = 35.6 \pm 0.2\); \(T_{S02} = 36.1 \pm 0.1\); \(T_{S03} = 35.8 \pm 0.2\); \(T_{S04} = 35.7 \pm 0.2\); \(T_{S05} = 36.1 \pm 0.2\); \(T_{S06} = 35.9 \pm 0.1\); \(T_{S07} = 35.8 \pm 0.2\); \(T_{S08} = 35.5 \pm 0.1\); \(T_{S09} = 36.1 \pm 0.2\); \(T_{S10} = 36 \pm 0.3\); \(T_{S11} = 35.9 \pm 0.1\); \(T_{S12} = 35.6 \pm 0.4\) and \(T_{S13} = 35.3 \pm 0.3\) while the averages head/neck movements in minutes were \(M_{S01} = 15 \pm 5.2\); \(M_{S02} = 18 \pm 6.6\); \(M_{S03} = 13 \pm 7.1\); \(M_{S04} = 11 \pm 7.8\); \(M_{S05} = 19 \pm 2.1\); \(M_{S06} = 13 \pm 4.2\); \(M_{S07} = 15 \pm 3.6\); \(M_{S08} = 25 \pm 3.1\); \(M_{S09} = 18 \pm 2.5\); \(M_{S10} = 15 \pm 1.5\); \(M_{S11} = 19 \pm 1.3\); \(M_{S12} = 13 \pm 8.8\) and \(M_{S13} = 16 \pm 5.6\).

4 Discussion

The results were favorable due to the controlled environment, stability of Arduino circuits and algorithms, especially, beware of the earlobe infrared sensor in keeping it in a well-watered region of vessels and the body warm to avoid vessel constriction. Six students wear coats during the tests.

The crossing between Toronto Curiosity questionnaire and rMSSD, which defines the degree of attention in the last moments (\(p{\text {-}}value < 0.05\)) showed the minimum average value of the rMSSD interval to obtain the acceptance of the hypothesis using a Z-test. That is, for H0 (the device—Cap—is able to measure the degree of attention) to classify a student as “concentrating on school activities” in an observation window of up to 50 min, the minimum average interval should be 88 ms from the first to second test window. The Toronto Curiosity scale means be self-focused, openness to experience with curiosity.

The subjects on Fig. 5 are not practitioners of any meditation technique. Thus, care should be taken in affirming that higher degrees of full attention come only from groups with experience in mindfulness, which is not entirely true [59].

About PMS and MAAS, any statistical relationship was found between with rMSSD, because as known, are medium and long-term assessments of the individual’s degree of attention, respectively.

For the filtering technique by means of the moving average (MA = 2), care was taken not to mischaracterize the geometry (average dispersion of points around the 45\(^{\circ }\) diagonal identity) of the Poincaré plot over original signal \(RR_{n}\) from Arduino, and, at the same time, to remove the marginal spuriousness of the graph. Therefore, was applied the smallest possible MA (only 1 sample delay or MA = 2) where each output sample depends on the average between two adjacent input samples n, that resulted in \(.974 \pm 0.02\) of similarity between \(\overline{RR_{Fn}}\) and original \(RR_{Fn}\).

Thus, the advantage of this low-pass filtering is the elimination of the spuriousness caused by the eventual movement of the oximetry sensor attached to the earlobe of the participant. This technique seems to scientifically support the affordable oximetry sensor of the Arduino family.

The histograms had the least aggressive peaks due to the frequency damping of each sample but kept the width of their bases. This is equivalent to preserving the elliptical shape of the respective Poincaré map with Normal Distribution.

In Table 3, the 1st row shows the most commonly used index to measure the Poincaré map dispersion, the rMSSD, in milliseconds [56]. The 2nd and 3rd rows show the Toronto scale for Curiosity and Decentering values used to quantify the degree of the subject’s attention in the last class. Among the three scales adopted, Curiosity was the goal and showed the best relationship with rMSSD, i.e., the highest values of the Toronto scale for Curiosity accompanied the highest values of rMSSD for the same subject from the 1st to 2nd interval of 50 min.

Table 3 Participant data collected by Cap within two 50 min interval, 1st and 2nd I

The 4th row, has the N number of samples analyzed in the respective window of the lesson (1st or 2nd interval). Dividing this global N number of samples (or packets) by the global average \(\upmu\)BPM (from the 5th line), it is possible to find the lesson window observed in minutes, i.e., 4349 (samples)/87.29 (beats) \(\simeq\) 50 min (49.82). The same can be done for any subject in that line.

The 6th row, has the error rate accumulated that represents the percentage of \(RR_{n}\) samples that were lost in Bluetooth transmission and after recovery them by replacement and truncation. The max value was \(5.3\%\) what means \(94.7\%\) of minimum accuracy in system Arduino Cap. In Cap. 05 had \(100\%\).

The 7th and 8th lines show SD1 and SD2, respectively. These indices represent a qualitative analysis of the Poincaré map in geometric ellipse form [56]. These values are within expectations, but they corroborate with final accuracy, i.e., as mentioned, SD1 equivalent to the width of Poincaré map behaves as an instantaneous recording index of the beat-to-beat variability [55], in other words, the rMSSD index.

The 10th row, pRR50 indicates the percentage of adjacent RR samples with interval greater than 50 ms over the total number of RR samples of the subject. Both rMSSD and pRR50 indicate the presence of parasympathetic activity in the individual organism by evaluating adjacent interval [24, 32].

Finally, the 11th and 12th rows have the PMS and MAAS scale, that represent respectively, medium and long-term degrees of attention and, therefore, it wasn’t possible to mathematically prove a correction with the rMSSD values.

For the average temperature of the forehead surface, no direct relationship with the degree of attention was found. The tests showed that the behavior of the surface temperature of the forehead during the test lesson, did not vary significantly among the participants.

The monitoring of head/shoulder movements did not provide evidence that relates rMSSD to the quantification of full attention by the questionnaires. However, it did produce suspicions of excessive leg movement presence while the subject was sitting focused on his/her school activity, as were the cases for subject 02 and 08, who self-reported in the experimental feedback keep shaking your legs. Another important point observed, is that the subject remains seated during the tests to not change the rhythm of the heartbeat and, consequently, the RR interval.

5 Conclusion and Further Works

Undoubtedly, there are benefits to search how measure student’s degree attention while they are practicing their academic activities, in particular, by an accessible, less complex and accurate method.

Measuring HRV by analyzing the RR time interval of the heartbeat QRS wave complex was a challenging and functional goal. The results in Table 3 show that the rMSSD and the Toronto Curiosity Questionnaire can be employed to define the focus degree attention of subjects if measured in controlled environment.

About prototype accuracy, based in Arduino family, the Poincaré plot visual tool reproduction was an important key to claim that oximetry sensor and your algorithm implemented result in a Normal Distribution, allowing those two different variables (rMSSD and Toronto Curiosity scale) were correlated with each other. However, as a suggestion for future work (and post-pandemic COVID-19) that this method be applied to a greater number of students in the real classroom, in particular, during the most preferred and least preferred classes of students and make a new comparison of the state of mindfulness.

As demonstrated by [60] among other authors cited in this paper, experience in meditation practice brings more attention and longer time interval between \(RR_{n}\) samples.

This study suggests that the hypothesis tests be employ on a group with experience in meditation practice and a group without experience and compare the results. Subjects with experience in meditation are able to keep \(RR_{n} \ge 88\) ms for a longer time, even throughout the day. The focus of attention is trainable.

All data packages collected by the thirteen Caps were mathematically analyzed initially in Octave and subsequently in MATLAB. The hypothesis tests were performed in Excel, but IBM SPSS was also used for comparison purposes.