For the past six months, I’ve been working on measuring human physiology during meditation. Most notably, instead of focusing on measuring using an EEG (to record brainwaves), I’ve been focusing on measuring the changes in physiology caused by the autonomic nervous system.
And so, I started out building an Arduino based device to measure galvanic skin response, skin temperature, and heart rate. Within a few months, I found the most major physiological changes from meditation occur in the heart rate.
With this in mind, I built an iPhone app called buddha mind to measure and see the changes meditation makes on your heart rate.
This app was an amazing success, and within the first hour made the front page of Hacker News and brought over 4,000 people to the launch site.
Well, now we’ve reached another breakthrough. We’ve developed the very first version of an algorithm to measure and know when you entered a meditative state based upon heart rate variability.
We figured the best way to demo this new algorithm would be by controlling and manipulating a physical object with meditation. With that in mind, we built this light orb:
How it Works
This light orb is a DMX controlled strip of RGB LEDs house inside of a glass orb. It’s receiving DMX data from an Arduino triggered by an Electric Imp.
The Electric Imp is a really exciting project, and this build would have never been possible without it. An Electric Imp allows you to connect any device to the internet, and exposes and entire API for it. The code is fairly straightforward (written in Squirrel), and easy enough to debug based upon the insane complexity going on behind the scenes.
The buddha mind sends an API call to the Electric Imp as soon as the Bluetooth LE heart rate monitor is connected in app. This starts the pulsing white light of the orb.
Once the user starts meditating, our algorithm tracks the heart data, waiting for the heart rate variability to reach a threshold. Once reached, buddha mind makes API call to the Electric Imp to tell it to begin sending the Arduino the trigger for running the meditation lights.
Here’s what the Squirrel code for the Electric Imp looks like:
val <- 0.4; // Default value to send with PWM function blink() { hardware.pin1.write(val); // Update the value sent with PWM on pin 1 } } class input extends InputPort // This is how we create an API input { name = "LED control" type = "number" function set(value) { server.show(value); val = value; blink(); } } imp.configure("First Program", [input()], []); // Also need to register input for API here. hardware.pin1.configure(PWM_OUT, 1.0/500.0, 1.0); // Configure pin1 for PWM to send values to Arduino blink(); |
We send data to this Electric Imp with a post request. It looks like this example, only not with curl in app obviously:
curl --form "value=0.4" https://electricimpssecreturlgoeshere.com/12949332/ |
The Arduino then reads this PWM and creates and sends signals via the DMX output. This is also very straightforward (psuedocode ish stuff below):
// Before all of this is the awesome code setting up DMX from Triniculo's Attic. It allows us to use the DMXinit, etc. // functions. void setup() { DMXinit(1,512); // Initializes DMX output with all 512 slots and starting with 1 pinMode(4,INPUT); pinMode(13,OUTPUT); // LED for status } void loop() { float duration = pulseIn(4, HIGH); if (duration < 200) { // We've received a low signal (0.1 from the Imp) for(x = 0; x < 256; x++) { red = (int) (sin(frequency*x + 0) * 127 + 128); green = (int) (sin(frequency*x + 2) * 127 + 128); blue = (int) (sin(frequency*x + 4) * 127 + 128); DMXput(1,red); // Fade channel 1 from 0-255 DMXput(2,green); // DMXput takes the channel number and the value DMXput(3,blue); delay(20); // Take 2.55 seconds (2550 milliseconds) to execute fade } } // Fill in the rest of the code here for the triggers you'd like. Cut for brevity here. } |
The electronic layout is very simple, thanks to the DMX shield from Triniculo’s Attic. It consists of a single connection from the Electric Imp to the Arduino, using pulse width modulation to let the Arduino know what DMX states should be generated.
The DMX data from the Arduino is then sent to a DMX driver, which decodes and powers a strip of RGB LEDs.
The exciting thing about this build is that it’s 100% expandable. We only controlled a single orb, but with DMX we could control and light an entire room with multiple effects. DMX 512 allows up to 70 individually controlled lights! (!!!)
This project will be displayed and demoed in Jacksonville for the BeOneSpark event. You’ll be able to try meditating and changing the lights yourself.
We hope to see everyone there.
If you want to sign up to buy this Orb on indiegogo, to find out when the Android version of the app will be released, or to just hear more about what I’m working on, I’d appreciate it if you signed up for my mailing list.
I won’t spam ya, promise!