For the past few nights I’ve been sleeping with…
Okay, that came out wrong.
For the past few nights I’ve been heading off to bed with a Wiimote strapped to my wrist.
It all started with reading a patent explaining how wrist and hand movement could be correlated with entering a lighter phase of sleep – lighter sleep leads to moving around. The idea is, if you’re in a lighter phase of sleep, you wake up easier, feeling more refreshed. The goal for this is to build an alarm clock for myself that makes it easier to wake up in the morning, by waking me up up to a half hour earlier if that turns out to be easier. A team at the IEEE Canada Telus Innovation Award in 2006 had done precisely this, but they used an EEG for sensors, and needed paste and electrodes. Yuck.
This whole setup using an accelerometer is already patented and available from www.sleeptracker.com, but that costs “money”.
I wanted to gather some data of my own to try and devise an algorithm for translating data from a 3-axis accelerometer into an indication of being ready to wake up. This meant logging a night’s worth of accelerometer data, importing it into something like MATLAB, and playing with the numbers. My initial idea was to make a little board with an Arduino, an SD card, an accelerometer and a battery. This would take a lot of design, building and debugging on my part, and would take money.
I then remembered that my desktop machine has Bluetooth, and that I have Wiimotes.
The Wiimote is just about ideal for this: it has a 3-axis accelerometer, it can relay the data back over Bluetooth, and runs on batteries already. It’s a little large for this application, but it already exists, works and is in my hand right now, all of which are amazing benefits over basically anything I can or would build. Why do the work yourself, when someone else has already done the work for you?
I found a program called G-Force Logger that came with C# source. It logs values on each axis from the Wiimote’s accelerometer at a user-defined rate. I modified this code to write to a comma-separated file rather than a TextBox control, and let it run overnight. I’ll discuss the results later – but I can tell you it works nicely!




