When Kristin is about to get her period, everyone in the house knows it.
A light on her nightstand tells us so.
What we now call the "Mood Cube" tracks my wife's cycles and has helped foster household harmony. It also makes Kristin smile every day.
It was easy to build. You can make one, too.
The backstory
The Mood Cube story really starts with Louise Ma, a great interaction designer and my colleague on the WNYC Data News Team. She knows her mood tracks closely with her menstrual cycle, so she put up a chart of different faces and hangs a rubber band on the face that matches her feelings.
Stop by Louise's desk for a chat, and you immediately know where she's at. Talk about transparency!
Louise has made a hobby out of tracking her moods and cycles. Kristin had tried to track hers, too. She used several of the flowery iPhone apps designed to help, but didn't stick to them. She put the dates in Google calendar, but they never really lined up.
And each month she was surprised by bouts of intense stress, frustration and agita -- always followed by her period just a day or two later. After a recent episode she texted me: "I want Louise's chart!"
I had another idea.
I wanted to make an ambient indicator -- something in Kristin's life that was subtle but clear. I wanted it to be peaceful, friendly and needinig no attention. And it shouldn't be harsh or shaming.
The design
During a day of tinkering with some multicolored LEDs behind a sheet of paper, I decided on a light that glows a soft white for 18 days, and then slowly progresses for ten days into a hearty, deep red-orange. When her period begins, Kristin pushes a tiny button on the back of the lamp that resets the cube back to white and starts the day count anew.
There's no on-off switch; it senses when the room is dark and gently fades to black, glowing again when the room is light.
The hardware
The cube itself is an Ikea accent lamp I had in a closet forever. Instead of the original bulb, there's a circle of 16 LEDs called a NeoPixel Ring inside, which is controlled by an Arduino. There's also a light sensor and a tiny button, both mounted on a little breadboard and stuck to the side of the lamp.
NeoPixel LEDs are super cool. They're bright, they can change colors and they're all controlled by a single wire connected to the Arduino. There's all kinds of information about them on the Adafruit site.
Here's the full parts list:
- Old Ikea accent lamp (get creative!)
- Arduino
- NeoPixel Ring
- Tiny breadboard
- Photo resistor
- Button
- 2 10k-ohm resistors
- A/C Power supply (updated: 9v is better than the 5v I had suggested)
- Jumper wires
Or buy them all at once — except for the lamp — from Sparkfun.
I first snipped the ends off three of the wires, stripped them a little and soldered them onto the NeoPixel Ring: to the VCC (power), GND (ground) and IN (data in) points. Oops! Did I say solder? It's not hard! You will need a soldering iron, tho. Follow these great directions on how to do it. There's only three little spots you need to solder here.In my setup, the NeoPixel "IN" point connects to Arduino Pin 6, with the VCC (power) wire going to 5V and the GND ground going to the Arduino ground.
I then used the tiny breadboard to wire up the photo resistor to Arduino Pin A0 and the button to Arduino Pin A2. You have to use pull-up resistors in the circuit, as shown in the diagram below, to make it work.
I made sure the wires headed to the breadboard were long enough to run from inside the lamp to the breadboard stuck to the outside of the lamp, giving access to the light sensor and the button.
The code
Before putting all the parts into the lamp, I loaded the program onto the Arduino by connecting it to a computer (more about doing that is here).
The Arduino program keeps track of the days elapsed, changes the color of the LEDs and fades them to black when the light in the room drops. That program is below, and details about how it works are in the code's comments:
[Added 3/1/2013:] Forgot to metnion this before: You'll need to download three little Ardiuno libraries -- a NeoPixel library, a time library and an alarm library. More about installing Arduino libraries here.
Once the program and libraries were loaded onto the Arduino and tested, I disconnected the computer, attached the power supply to the Arduino and got the Arduino and the LED ring all cozy in the lamp.
Arranging the components inside was nothing special. I just tried to make sure none of the electronics were touching in a way that might cause a short and that the LED lighted the lamp nicely.
On the outside, I attached the breadboard to the lamp with a loop of tape. I also used a little piece of darker tape to make a tiny tube around the light sensor so it was more likely to respond to the light in the room instead of the glow from the lamp.
Power up
The I arranged the lamp on the nightstand and plugged it in. The Arduino starts from day one when powered up, so the tiny button has another purpose: to advance the day-counter to the correct day in Kristin's current cycle. Hold the button down for a few seconds and the cube turns blue and starts to flash, once for each day. Letting go at (or just before) the right number of flashes sets the cube to that day.
Hack it!
Is the lamp too bright? Too dim? You can adjust it on line 45 of the code. Cycles not at or near 28 days? Change line 37.
Some women have said their mood swings happen earlier in their cycle -- or that they reliably have super-happy days they'd like to see reflected. Can you make the adjustments?
With some more code, and a memory card, the cube could also "learn" from the button-pushes to adjust more accurately to a woman's average cycle.
And if someone is reliably fertile on a given day, maybe it could act as an ovulation indicator, too.
If you find new ways to hack or use this code, be sure to share you work in the comments below!