> For the complete documentation index, see [llms.txt](https://docs.anthriq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.anthriq.com/xbud/experiments/flicker-ssvep.md).

# Flicker SSVEP

A steady-state visually evoked potential (SSVEP) is the occipital response to a stimulus flickering at a fixed rate. Look at a square blinking at 12 Hz and the visual cortex produces a 12 Hz rhythm that appears as a sharp peak in the spectrum, often with a harmonic at 24 Hz.

SSVEP is the basis of many brain–computer interfaces, because the response identifies which of several flickering targets a subject is attending to. This guide records one frequency at a time, which is the version to run first.

Allow about 20 minutes, including building the experiment.

> **Note:** Complete [Get started with xBud](/xbud/technical-guide.md) and [Record eyes-closed alpha](/xbud/experiments/eyes-closed-alpha.md) first. Alpha teaches the occipital montage and the spectral reading that this experiment depends on.

> **Warning:** Flickering visual stimuli can trigger seizures in people with photosensitive epilepsy, most often between 15 and 25 Hz, a band this experiment uses. Screen every subject first: ask them to confirm they have no history of photosensitive epilepsy, seizures, or migraine with visual aura, and run the flicker only once they have. End the session if a subject reports discomfort, dizziness, nausea, or visual disturbance.
>
> Keep sessions short, keep the room lit, and tell each subject they can stop at any time. Carry this warning into any handout a class works from.

## Prepare the subject

Use the same occipital montage as the alpha experiment: `EEG 0` on O1, `EEG 1` on O2, `EEG 2` on Fpz as a control, `REF` at Cz, and `AGND` and `DRL` on the temples or mastoids. See [Set up and maintain xBud](/xbud/technical-guide.md#attach-electrodes).

Seat the subject about 60 cm from the screen, in a dimly lit room, facing the display. Fixed viewing distance matters more here than in the alpha experiment: the response scales with how much of the visual field the stimulus fills.

> **Tip:** Gel the AGND and DRL contacts. SSVEP peaks are narrow, and a clean common-mode path keeps mains interference from sitting on top of the frequency you are trying to measure.

## Choose the flicker frequencies

Work between **10 and 30 Hz**. The response is clearest there, and the range fits within what a standard monitor can display cleanly.

| Consideration     | Why it matters                                                                 |
| ----------------- | ------------------------------------------------------------------------------ |
| Near 10 Hz        | Collides with the alpha rhythm, which is strongest at the same occipital sites |
| 25 Hz and 16.7 Hz | Subharmonics of 50 Hz mains interference land on the response                  |
| Above 30 Hz       | The response weakens and muscle activity rises                                 |
| Harmonics         | Check the second harmonic too: 12 Hz gives 24 Hz, clear of 50 Hz               |

**12 Hz and 15 Hz** are good defaults. Both display exactly on a 60 Hz monitor, sit clear of alpha, and give harmonics that avoid mains interference.

> **Tip:** Monitor refresh rate quantises the flicker. A screen builds the stimulus from whole frames, so the only rates it displays exactly are the refresh rate divided by a whole number. On a 60 Hz monitor that gives 30, 20, 15, 12, 10, and 8.57 Hz; on a 120 Hz monitor also 24 Hz and 17.1 Hz. Ask for 13 Hz on a 60 Hz screen and the display alternates between nearby rates, which smears the peak and weakens the response. Check the refresh rate first, then pick a frequency that divides into it evenly.

## Build the experiment

Build this in the BXI Studio Experiment Builder rather than running it by hand, because the stimulus timing and the markers need to be tied together. See [Experiment Builder](/bxi-studio/experiments/experiment-builder.md).

1. Create an experiment and add a **Text** epoch as a welcome screen with the fixation instruction.
2. Add a **Trial**. Set the number of repeats to 10 and give it an inter-trial instruction such as "Rest, then look at the centre of the square again".
3. Inside the trial, add a **Stimulus Epoch** with a duration of 10 seconds. In the **Layouts** tab add a **Flicker** element and set its **Frequency** to your chosen rate and **Phase** to 0.
4. Set a **Marker** on the stimulus epoch so the onset is tagged in the recording.
5. Add a **Rest Epoch** of 8 seconds after the stimulus, with its own marker. A blank screen with a fixation cross works well.
6. **Preview** the experiment, then **Publish** it.

Ten trials of 10 seconds gives 100 seconds of stimulation, which is ample for a clear peak.

> **Tip:** Set the flicker frequency as a run parameter rather than hard-coding it. BXI Studio prompts for adjustable stimulus parameters when the run starts, so one published experiment can serve every frequency you want to test. See [Running an experiment](/bxi-studio/experiments/running-an-experiment.md).

## Run the experiment

Start a new experiment run, set the flicker frequency and the hardware source, and begin.

The subject fixates the centre of the flickering region and stays still. Blinking is fine between trials but should be avoided during stimulation, since blink artefacts are broadband and land on top of the response.

Run one frequency per recording and save each with the frequency in the file name, for example `sub01_ssvep_12hz`.

## Read the result

Open the **Fast Fourier Transform** for O1 and O2 and look for a sharp peak at the stimulus frequency, usually with a smaller peak at twice that frequency.

![Spectra from O1, O2 and Fpz between 1 and 45 Hz, comparing flicker epochs against rest. A narrow peak at 17 Hz appears during flicker on all three sites and is largest at O1.](https://2761951758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhtBZnSGOC4EMhU3nc5oM%2Fuploads%2Fgit-blob-a2d42dba7d3dde9dda3a6c7fc8200d9c4200d1fc%2Fssvep-flicker-vs-rest-17hz.svg?alt=media)

The figure above is a 17 Hz recording made with this montage on xBud, pooling three stimulus epochs against the rest epochs between them. The peak sits exactly on the stimulus frequency, is strongest occipitally, and is much reduced at the frontal control site.

| Compare                             | Expected                                    |
| ----------------------------------- | ------------------------------------------- |
| Stimulus epochs against rest epochs | The peak is present only during stimulation |
| O1 and O2 against Fpz               | The peak is far weaker frontally            |
| Two different flicker frequencies   | The peak moves to match the stimulus        |

The third comparison carries the most weight: a peak that follows the stimulus frequency cannot come from interference or from a resting rhythm. Recording two frequencies in one session demonstrates it directly.

![Spectra from O1 and O2 comparing a 13 Hz run against a 17 Hz run. Each trace peaks at its own stimulus frequency and not at the other.](https://2761951758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhtBZnSGOC4EMhU3nc5oM%2Fuploads%2Fgit-blob-8f360e55befa881ce0213a82447e25174f8e724e%2Fssvep-peak-follows-stimulus.svg?alt=media)

Each trace peaks at the frequency it was driven with and stays flat at the other. Nothing in the room changed between the two runs except the number on the screen.

### What to expect

The numbers below come from the two recordings plotted above. SSVEP amplitude varies widely between people, so treat the ratios rather than the absolute powers as the thing to compare against.

| Measure                      | O1         | O2         | Fpz        |
| ---------------------------- | ---------- | ---------- | ---------- |
| Peak power at 17 Hz, flicker | 52 µV²/Hz  | 25 µV²/Hz  | 15 µV²/Hz  |
| Peak power at 17 Hz, rest    | 8.6 µV²/Hz | 5.3 µV²/Hz | 7.0 µV²/Hz |
| Ratio, flicker to rest       | 6.1×       | 4.8×       | 2.1×       |
| Harmonic SNR during flicker  | 9.2 dB     | 8.6 dB     | 6.2 dB     |

Harmonic SNR compares power at the stimulus frequency and its second harmonic against the neighbouring bins. Above about 6 dB is a strong response, 3–6 dB is usable, and below 3 dB is unreliable. The frontal site reaching 6.2 dB is a reminder that a control channel reduces a response rather than abolishing it.

In the two-frequency recording, each run's peak exceeded the other frequency's by 3.1× to 6.1× across both channels - the selectivity that makes SSVEP usable for target selection.

Use a window long enough to resolve the peak: several seconds separates a 12 Hz response from its neighbours, while a short window spreads it into a broad bump.

The **Time Frequency Spectrogram** shows the same result against time: a horizontal band at the flicker frequency that switches on and off with the trials.

## Take it further

**Response strength against frequency.** Record several frequencies and plot peak amplitude against flicker rate. The response is usually strongest in the low teens and falls away above 30 Hz.

**Harmonics.** Measure the power at the first and second harmonic. The ratio differs between subjects and between stimulus waveforms.

**Phase locking.** Power at the stimulus frequency says the response is there. Phase locking says it is driven by the stimulus. Extract the phase of each channel at the flicker frequency, compare it against the marker line at every stimulus onset, and average across trials. The result, the phase-locking value, runs from 0 for no consistent relationship to 1 for a perfect one.

| Site | PLV at 17 Hz | PLV across 1–45 Hz |
| ---- | ------------ | ------------------ |
| O1   | 0.355        | 0.202              |
| O2   | 0.338        | 0.328              |
| Fpz  | 0.221        | 0.030              |

The values come from the 17 Hz recording plotted above. Both occipital sites lock to the stimulus more strongly than the frontal site does, and the broadband column separates them further: Fpz has almost no consistent phase relationship to the stimulus outside the driven frequency.

Phase locking is what SSVEP classifiers key on, so this measure is the step from a visible peak toward target selection.

> **Note:** This measure compares each electrode against the marker line, which is an external signal. Comparing two electrodes against each other instead, with coherence or a correlation, does not work on this montage: every channel is recorded against the same reference at Cz, so whatever Cz itself picks up appears in both channels of any pair and inflates the result. The reference was not recorded on its own channel, so that shared component cannot be subtracted afterwards. Locking to the stimulus avoids the problem because the marker line carries nothing from the subject.

**Two targets at once.** Display two squares flickering at different frequencies side by side and ask the subject to attend to one. The attended frequency dominates the spectrum. This is the mechanism behind SSVEP-based BCI target selection, and it is the natural next step toward a classifier.

## Next steps

* [Record surface EMG](/xbud/experiments/surface-emg.md): a signal visible directly in the time domain
* [Experiment Builder](/bxi-studio/experiments/experiment-builder.md): the Flicker element and marker configuration
