I have had a long life of few memorable dreams, and those I did have would fade rapidly after waking. Then "life-circumstances" changed and I found myself having vivid nightmares which were (and still are) memorable in every detail.

I would wake to find that my pillow was soaking wet from sweating during these episodes.

Talking to a friend about this, I found out that his spouse had recent cranial surgery that left her with the same experience.

There are several "scientific" methods for monitoring dreams and REM sleep: (Electrooculography (EOG/E.O.G.), EEG, EMG, and other means for detecting brain activity and eye-movement to detect REM sleep. Some are used to induce Lucid Dreaming where an individual can realize they are in REM-stage sleep, then semi-consciously control their dreams ("Hey, I can fly!"). These techniques require wiring a plurality of sensors to the head, face, and body; not so good for a restful sleep, especially for someone who naturally makes several side-to-side turns during sleep.

I did not seek to interrupt REM sleep because it is supposed to be "natural" and "a good / needed phenomena" - rather I wanted to detect that I was having a nightmare and trigger something to wake me up so I could stop the dream (and hopefully not fall back into it again).

I have never awakened from a 'good' dream to find my pillow soaked, but these nightmares always resulted in this (and daily washing of bed linens needed).

So my hypothesis was that these nightmares were obviously elevating my heart rate (and thus my body temperature).

The Goal was to find the least obtrusive way to monitor my heart rate (e.g.: No 'wires'), and use software monitoring and filtering algorithms to detect that my heart rate was rising above normal for more than a short duration. I would then be awakened by some means so I could "escape" the nightmare.

The first prototype utilizes a heart rate monitoring "strap" which I wear across my chest that wirelessly sends heartbeats to a companion receiver where it could be monitored by software to "catch" me in one of these restless and disturbing dreams, and wake me up.

The current version utilizes the well established chest-worn monitor by Polar which can transmit each heartbeat wirelessly to a receiver. They have two models: the older and long-selling Polar H1 Heart Rate Transmitter which uses the ISM-band to send the signal to wrist-worn devices, or matching proprietary Receiver Modules, and the Polar H7 Bluetooth Smart Chest Transmitter which can be monitored by any BLE/BT Smart receiver board, or BT 4.0 phones/PCs/Dongles.

For the first prototype, I wanted the simplest and lowest-cost way to get the raw data into a micro where it could be filtered, analyzed, and then trigger an external annunciator so I went with the Adafruit Heart Rate Educational Starter Pack with Polar Wireless Sensors ($65). The Polar chest bands are available for individual purchase, and the receiver is actually available from Parallax who provide support and example files for a variety of micros including Arduinos. There are also tiny "cubes" which can plug in to the Audio Jack of a Smartphone in lieu of using the (at the time) more expensive BT Smart version of the wearable chest band; these can be taken apart to extract the receiver PCB, or wired into a female 3.5mm TRRS connector which is interfaced to the micro-of-choice.

Any type of Micro can be used, but I chose the ATmega328-based Adafruit Pro Trinket (5V version) for ease of programming and a small footprint.

While there are many types of alerting methods which can be triggered to wake one up, I opted for something that would be as unobtrusive as possible as to not jolt me awake like a piezo buzzer or something loud enough to disturb others. My choice was to use one of the tiny vibrator motors used in phones for "Vibrate Mode" and used this little Vibe Motor also from Adafruit, but this is a personal preference. I found that sticking this to my wooden headboard made a resonating hum which was just what I was looking for to wake me up without the jolt of, say, an alarm clock.

To keep the entire setup as "wireless" as possible, I also used a pair of the very inexpensive Nordic Semiconductor nRF24L01 available in Breakout form from SparkFun or as individual "raw" transceivers as described in Hackaday and available on eBay in pairs for as little as $1.77 to send the signal to trigger the Vibe Motor from the Micro sitting on my nightstand. The only "wires" involved here is the USB Wall Wart to power the Trinket via its USB connector.

BLOCK DIAGRAM

Polar Chest Transmitter

Headboard Annunciator

Polar Receiver Board

Full Size Proto Dev (with LED Matrix to display real-time Heart Rate, Pro Trinket at bottom, nRF24L01 on left)

Improvements can certainly be made. The Polar Chest Band is intended for exercise and not sleeping, so while it is comfortable enough to sleep in, there are smaller, less obtrusive heart rate monitoring solutions available which will send the data wireless using BLE/BT Smart.

Why not use the FitBit Charge HR? I do have one of these, and they have opened their API to allow for monitoring heart beat information down to 1 second intervals. However, FitBit (as of this submission) refuses to open / publish the APIs and information to directly gather the information from the wrist band directly over Bluetooth. One must get a developer account, register as an experimenter, and then you can get this data making HTTP GET calls to the FitBit Web site. This means that there is much more involved since the FitBit will only communicate to their App on your phone, which then sends it to fitbit.com on the Internet. This means that to collect this data, there must be a phone in the loop to receive/retrieve the data from the wristband, send it via Internet to FitBit Servers, then make calls to their Service via Internet to get the data needed; to many 'moving' and dependant parts involved here compared to the simplicity of collecting the data in raw format directly from the body sensor.

As the Project matures, I will focus on replacing the Polar chest band with something much smaller and unobtrusive (and doesn't leave marks on your chest in the morning after use), and make the "tuning" of what constitutes normal heart rate activity whilst sleeping or REM dreaming vs. entering a nightmare more user-friendly and hopefully self-learning / calibrating; currently I hand-set these parameters on the Nightstand Processing station. Alternative waking mechanisms will be explored, but I still want to de-couple these from the unit using wireless (ala nRF24L01 or similar) technology.