Initialize NeuroAnalyzer
using NeuroAnalyzer
import CairoMakie
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)using NeuroAnalyzer
import CairoMakie
# Quarto sets a default figure size (672 × 480 px), which overrides the sizes of
# NeuroAnalyzer figures: remove it
delete!(CairoMakie.Makie.CURRENT_DEFAULT_THEME, :resolution)Electrodermal activity (EDA), also known as galvanic skin response (GSR), is the variation of the electrical conductance of the skin, which depends on the activity of the sweat glands. Sweat glands are innervated by the sympathetic nervous system, so EDA is used as a measure of sympathetic arousal (e.g. in response to emotional stimuli, stress or pain). EDA has two components:
The two electrodes of the sensor are placed on the index and middle fingers, on the middle phalanx, with the electrode surface against the palmar side of the finger. The distal phalanx has a higher density of sweat glands, but the middle phalanx is also commonly used, as the electrodes are less likely to fall off (Boucsein et al. 2012). A small amount of isotonic saline (NaCl 0.9%) can be used to improve the contact between the skin and the electrodes.
The Arduino runs a program that reads the sensor 50 times per second (each sample is the average of 10 readings), converts the reading to skin conductance [μS] and sends it via the serial port (19200 baud), one line per sample:
gsr:<conductance>
Note: the conversion uses a calibration value (calibration = 270 in the program), which differs between sensors; see the sensor documentation for how to determine it.
There are two versions:
iedar(): GUI mode, the recording runs in a window,edar(): CLI mode, the recording runs in the terminal.Parameters:
duration: recording length in seconds (default: 20),port_name: serial port of the Arduino (default: "/dev/ttyUSB0").e = iedar(; duration = 60, port_name = "/dev/ttyUSB0")Press RECORD to start: after 2 seconds (data buffered in the serial port are discarded) and a beep, the recording starts and the signal is plotted as it is recorded. The window closes 2 seconds after the end of the recording. If the window is closed earlier, the samples recorded so far are returned.

e = edar(; duration = 60, port_name = "/dev/ttyUSB0")NeuroRecorder: EDA
==================
Duration: 60 [seconds]
Serial port: /dev/ttyUSB0
Ready to start, press SPACEBAR to begin recording
The recording will start after a beep
Recording ............................................................
Recording finished.
Both functions return a NEURO object of the eda data type with one channel (eda1, unit μS) sampled at 50 Hz. It can be saved, plotted and processed as any other NEURO object:
NeuroAnalyzer.plot(e; seg = (0, signal_duration(e)))Example (simulated recording, 60 s): the slow changes of the baseline (tonic component) and four skin conductance responses (phasic component):

Tip: EDA changes slowly: a low-pass filter (e.g. 1-5 Hz) removes the high-frequency noise without affecting the responses.