I started a new project some days ago. Some years ago i read about a sleep phase alarm clocks and thought: very nice idea. I wanted to have one but the price is way to high and also the software is closed source. I surely don’t buy a peace of hardware I can’t use the way I want to :-).
The only problem i had was detecting the sleep phase with some not bothering accelerometer…
Some weeks ago C’t reviewed the very nice EZ430-Chronos and i fall in love with this very neat watch clock. One of the nice features are accelerometer and a low power wireless chip. And the best thing, the firmware is open source and they ship with debugging hardware :-)
So, the first step was to write a firmware for clock. As they use a closed source compiler, some work had to be done for porting the firmware to msp430-gcc. Thank to Paul F Sehorne for the initial pieces. I forked the firmware and began cleaning up the code and modularizing it, so people can have a config file with the features they want. It is “only” 32 kb flash — 8kb for the boot loader (which contains the wifi flasher). As msp433-gcc does not optimize as good as IAR or CCS, useless code needs to be optional (like the 24/12 am and Fahrenheit code ;-)). I call the project OpenChronos.
The next step was to write some daemon that uses the clock and controls the alarm clock, has http xmlrpc/json apis, logs the measured data, etc. 32kb is way to less for storing them, and i really don’t want to loose functionality there.
I choose to use django with some apps like piston for writing the daemon. This has automatically the feature of having a featured website into the daemon. As i plan to use a Chumby as the alarm clock later on, having a full web-framework/server is ++. UberClock was born :-)
Logging for 2 days now, data is quite interesting:
The clock calculates a movement index and transmits to the clock. Low values mean low movement (maybe i will increase the high pass filter a little bit so it will be more like 0 on no movement). Higher values mean more movement. As you can see, there are typical spikes and longer phases of no movement.
I was already up at 11:06, thats the reason for the high values there.
Now i need to write some algorithms to find good spots when waking up would be best. I plan to have different sleep plans like:
- I have to stand up at n o’clock latest and he sets itself a window in which he would wake you up.
- N deep sleep phases, and start waking you up.
- powernap phases
And I there is also a third project. I started to design a 12 V pwm dimmer which the daemon will control. There are full spectrum halogen bulbs available. I want to mount some of them above my bed and the clock should start dimming them slowly brighter and brighter before starting the alarm, so my body can adjust even better…