top of page

Inducing/Experimenting with Hypnagogia & trance states with the Bangle.js

“For often, when one is asleep, there is something in consciousness which declares that what then presents itself is but a dream”

Aristotle

In my last post, I discussed devices that have been developed to aid Lucid Dreaming and gave an overview of how to develop one using the Circuit Playground Express. In this post I’m going to give an overview of how we can explore the transitional state between wakefulness and sleep, which has associations with various phenomena including Out of body experiences/Astral Projection and hallucinations related to loss of sense of self and distortion in perception of space and time. This state has always been of interest in human history, it has been the inspiration of Salvador Dali's art, Aristotle's writings and Thomas Edison, who attributed a lot of his insights to lucid thoughts within Hypnagogia.

Salvador Dali, 'The persistence of Memory' aka melting clocks

Thomas Edison used a clever hack to access this middle-ground state by the use of steel balls held in each hand whilst taking naps. As he fell into sleep and his muscle tone reduced, the balls would drop and hit the floor, and the noise woke him up, interrupting his fall into sleep and thereby suspending his consciousness in a hypnogogic state.

All this might sound esoteric and pseudoscience but similar phenomena experienced in Hypnogogia can be induced within lab settings – there are now several approaches to inducing perceptual changes, links at the end of the article for example references.

A more recent study by a team lead by Oscar Rosello at MIT was conducted this year, with the development of a glove with various sensors to detect sleep stages of a wearer. The ‘Dormio’ system includes a feedback mechanism to cue a wearer during transitional sleep states to both awaken them slightly and also cue them with audio to see if certain words would be incorporated into dreams and hypnagogic content. The study is a great read – there’s some thought-provoking discussions about how these experiences may impact creativity but the interest for me was in the actual technical approach and how much of it can be leveraged using open source tools.

There are number of sensors in the glove, including: heart rate monitor, skin perspiration and muscle tone and these were fed into a custom Arduino microcontroller. The customisation was done to accommodate the various breakout components across a wearable form-factor which looks like something out Minority Report or CyberPunk 2077. The hardware could conceivably be made with off the shelf raspberry pi or Arduino components and there are relevant breakout sensors that can be connected. But a lot of the sensing capability was to cover quite a wide range of requirements for the MIT project and if you limit the requirement to detecting the initial onset of sleep just like with Edison’s steel ball method and a feedback mechanism to wake a wearer up, I think you can get by with just a heart rate sensor and either a speaker or vibration motor…


Bangle.js

The Bangle.js fills a gap in the market that has been a long time coming: a hackable smartwatch with open source firmware that includes health tracking capability and even AI-based app development. Sometimes Kickstarter projects do come through and this is one of the better products born from it. Gordon Williams, who developed the watch is also the creator of Espruino, which is a Javascript based interpreter for microcontrollers and part of an effort to flatten the learning curve to programming hardware. Espruino has actually been around for quite some time now so it’s well established – if you’re familiar with things like MicroPython it’s quite similar to that level of working but there’s actually even more flexibility with JavaScript because you can do things like have your whole IDE and connection to BLE devices in a web-browser. I’ve been using the Bangle.js for the past week, there are some improvements that could be made but on the whole it’s been awesome to work with, the reliability and ease of use is impressive. There are other open source smartwatch OS’s in development to keep an eye on e.g. WaspOS and PineTime but this really is in a different league right now and comes at an affordable price tag.


The Bangle has a heart-rate sensor that is easily accessible through the code, you can check example HR apps through the app launcher and leverage much of it to create a system that can detect the onset of sleep; all you really have to look out for is a sharp drop in average HR and then you can make the watch vibrate to alert the wearer.

This is a pretty niche requirement which is awkward and in fact mostly impossible to do with generic fitness trackers without hacking because of the lack of access to the sensors and control of the motors/speaker – you do really need open-source gear for this.


Steel Ball

The Steel Ball application essentially starts with a display that shows the current HR value that the watch alarm is set to and this can be adjusted with button 1 and button 3. This HR settng should be the approximate value you want the alarm to trigger and so you should ideally know both what your HR is currently and what your heartrate normally is during sleep. For your current HR according to the watch, you can simply use the HR monitor available in the Espruino app loader, and then from that you can choose a lower value as the target for the alarm. If you know how low your HR drops during sleep that can help but if not, again, there is a readily available HR recorder app, 'Heart Rate Recorder' you can use for analysis on this during an overnight period. You can also just try different HR levels to see what works best for you and that’s exactly how I’ve approached it for my own use.


When you press the middle button on the side, the HR monitor starts and you simply just need to relax, the alarm will trigger when your heart rate average drops to the limit you’ve set. The code also has a basic logging function which shows, in a CSV file, when you started the HR tracker and when the alarm was triggered; monitoring this over time could give you an indication of, from your intent, how long it takes for you to relax and fall asleep, which itself can be an indicator of stress levels.

left to right: a) target HR setting on launch of app, b) HR tracking begins after pressing middle button, c) display of both average HR and standard deviation based on sample over several seconds


Results

It's still early days but so far I can confirm some positive results with the app using it before sleeping and it does induce or alert me to varying levels of hypnagogia. It will take some more practice and tweaking the settings though because a lot of times I end up sleeping through the alarm. I can definitely see it being of benefit to people new to things like mediation and lucid dream induction as it offers a way of recording and providing feedback on positive results, for the more experienced this could aid training and practice.


In terms of improvements to the watch for this kind of thing, I wish the motor could be set to a stronger level, I find it to be on the weaker side – if not a louder speaker would be good. In terms of the app, I really don’t think it needs to be much more complicated than this, I may look at incorporating HRV (heart rate variability) measurements if the processing can handle it, as I think it's possible using the analogue readings from the HR sensor. There’s actually other uses for HRV which would be interesting so will definitely look into that separately at least. You could also look at using the accelerometer to check for body movement and do things like add a slight timer delay to the alarm to see what kind of effects that has. And of course you could chain other devices through bluetooth in several ways, perhaps control lights instead of audio/vibration cues.


Useful Links

GitHub Repo


Dormio Glove


Bangle.js


The experimental induction of out-of-body experiences, Henrik Ehrsson


Stimulating illusory own-body perceptions, Olaf Blanke

700 views0 comments

Recent Posts

See All

Comments


bottom of page