Chapter A5 — Connecting This to Dreamento's Real-Time Features
SCIENCE
Dreamento's README lists real-time sensory stimulation (light, sound, tactile) and both manual and automatic markers among its real-time features — built specifically to trigger lucidity attempts during REM and record when they worked. This chapter opens the actual code behind that claim.
The Real Stimulation Code
Inside ZmaxHeadband.py there's a real stimulate() method, with parameters for light color (rgb1, rgb2), brightness (pwm1, pwm2), timing (t1, t2), repetitions (reps), and vibration (vib) — a genuine, callable function controlling a light-and-tactile cueing system on the headband itself. Same underlying logic as Chapter A3's tACS experiment, different modality: apply a signal from outside, timed to REM, aimed at nudging the sleeper toward noticing they're dreaming.
The same file defines a ZmaxDataID enum listing every real sensor channel the device streams: EEG from both electrodes, 3-axis accelerometer (movement), body temperature, battery, ambient noise and light, nasal airflow from both nostrils, and oximetry. That accelerometer data, worth noting, is a genuinely different channel from EOG eye movement — head movement, not eye movement — so it's not itself an LRLR detector, but it's one more real signal available to combine with EEG/EOG when deciding whether, and when, to fire a stimulation.
What To Actually Go Look At
Two things worth your own time in the repository, since this is exactly the kind of code-reading Chapter 8 already had you practicing:
- How stimulation timing relates to detected sleep stage — search the real-time scoring and stimulation code for where a REM detection would need to happen before a
stimulate()call makes sense to fire. - How LRLR markers actually get logged during a recording — both the manual markers a researcher can place by hand, and anything automatic. This is worth tracing yourself rather than taking a secondhand description of it; the honest answer is this course hasn't independently verified every detail of that logging path the way the stimulation code above was.
DONE WHEN
You can point to the real stimulate() function and explain, in your own words, how it connects to Chapter A3's tACS logic — and you've traced at least one real path yourself through the repository for how a detected REM stage could lead to a fired stimulation.
That closes Part 3, and the course. You've gone from raw EEG voltage to a trained CNN+LSTM, read three real architectures critically, mapped a concrete integration plan against Dreamento's actual code, and covered the real (and still-evolving) science of lucidity detection itself — honestly, without overclaiming anywhere a question is still genuinely open.