This is an update of my Nautilus Pendant project, using the LightBlue Bean controller instead of a TinyLily. Both of them use timed vibrations to keep you in the hypnagogic mental state, on the edge of falling asleep. Artists and writers throughout history have employed techiques like this to stimulate a creative and problem-solving state of mind.
According to legend, some literary greats would hold a spoon or marble in their hand while dozing off in an armchair. When they began to fall asleep, the object would drop, clatter onto a plate below, and startle them awake. Being a more technologically gifted society, we can do a little better than that (at less risk to our fine china).
I started by taking apart the Dash Button. Its top and bottom are heat-bonded together, so you'll need a knife or Dremel to cut them apart. Be careful!
Once that's done, the button should still be lightly attached to the top, while the bottom holds the electronics. Remove these.
Next, solder the button and haptic motor to the LightBlue Bean:
- Button: Pins D0 & GND
- Motor: Pins D1 & GND
The code uses the Bean's built-in pullup resistor for the button, so you don't need one; pin D0 will always be held high, until you push the button and connect it to ground. Position the button so that, when you insert the Bean into the Dash button enclosure and seal it up, the switch will be directly underneath the big white button.
I used some spare foam bits to wedge the Bean in tightly, with support underneath the button where it would be pressed. Then, I simply taped it back together with Kapton tape, so I can re-open it anytime and change the coin cell battery. The Bean is programmed over Bluetooth from your phone, so you don't need space for wires or anything.
First, download the Bean Loader app for your mobile device and turn on Bluetooth.
Copy the Arduino code below and paste it into a new sketch. I called it "Amble" (the slow, thoughtful counterpart of Dash). You can name it whatever you want. When you're ready, hit the upload button and choose your Bean from the menu. You may need to update the firmware, which will take just a few minutes, and then you'll be ready to rock.
This code keeps the Bean asleep most of the time in a low-power mode. When the button is pressed, it sets the "hypno" flag to True (1); this tells the main loop to run through its timer code. It vibrates once, to confirm the button press, along with a brief LED flash. Then, it waits 10 minutes (600000 milliseconds), and repeats the vibration/flash combo. After that, it goes back to sleep until you push the button again. It's pretty power-efficient, so your battery should last quite a while.
Now, you're ready to explore the realms within! Hold the button in your hand, find a cozy spot to doze off for a brief spell, settle in, and push it. Then let your mind wander until you feel the vibration wake you again. You can repeat this as many times as you like! Keep a notebook close at hand, so you can jot down any ideas or solved problems and get back to dreamland.