Archive for October, 2010

Posted by Mikko at 26 October 2010

Category: Android, Mobile, Programming

Tags:

Hello guys. I’m finally in General Santos City (GenSan) now for semestral break. Since it’s one of the few moments of the year when I can do pretty much anything I want to do, I did not waste this opportunity to bring back the geek in me.


Sleep Cycle iPhone app. I also have my own sleep graph, as seen way below this one

Before I left Manila for GenSan, I read this article from Lifehacker about the Five Best Mobile Alarm Apps. One alarm caught my attention, the Sleep Cycle. Sadly, there wasn’t an Sleep Cycle for Android; only for iPhone. Being obsessed with data, the only thing I wanted was the raw data in order to make a graph. And so I decided to make a prototype application for it.

Developing it was pretty easy. I just googled for a sample code in detecting movements using an Android phone’s accelerometer. The one I found was pretty much straightforward but I had to modify some equations most especially the ones described as the speed.

I had to experiment with different movement threshold values for the sensitivity until I found the one I think would suit my needs. I also had to experiment on the time intervals between recording of raw data. In storing the raw data, I had to decide whether to store only the timestamp of the start time then the raw values after each interval OR store the timestamp and the raw value in each time interval. I decided to implement the first one for my first dry-run.

Once I thought everything was alright (I started at 2am and ended by around 7am leaving me with no night sleep), I decided to give it a shot by actually sleeping with the app. When I woke up, I excitedly tried to analyze the data but sadly the phone measured way more data than expected. I decided to just discard the data and debug the app. This was the time I decided to use the latter in storing the data. Store the timestamp plus raw data for each time interval.

So that night (actually last night), I decided to sleep with the app again. Upon waking up earlier today, I tried to check the data and it seemed that it recorded the data the way I expected it to. I immediately tried to learn how to use the RRDtool (Round Robin Database tool) so that I can feed it with the data and finally come up with a graph. In no time, I got a visualization of my sleep, as seen above.

You can see from the graph that I entered sleep at around 12:20am and woke up at 4:50am. Also evident are the parts where my movements were higher than usual, probably the times I was dreaming. For the next few sleeps, I’m planning to feed them the data directly on my laptop instead of having it stored on the phone then later transferred to my laptop. I will make a portal where my sleeping activity is readily available on the Internet in realtime using PHP, a cron job and Dynamic DNS for domain resolution to my network.

I haven’t felt this geek for a while and I’m happy to be one again even just for this project. I am looking forward to making more geek stuff, preferably with Android.

Posted by Mikko at 3 October 2010

Category: Events, Linux, Personal, Wordpress Stuff

Tags: , , , ,

Three days ago, I turned a year older. I don’t have much to say about my birthday except for the early birthday gift I got, a system-canceled passport application appointment from the Department of Foreign Affairs. There’s a high probability that my trip to Hong Kong won’t push through. Aside from that, there’s really nothing so special about my birthday.

Yesterday, I attended my first WordCamp ever. I registered for WordCamp for the past two years but due to unseen circumstances I wasn’t able to make it. I arrived there very late, 4pm (it started at 8am). It was fun to see bloggers I last saw a year or two ago. After the event, I went out with some bloggers to socialize.

In a week, Canonical will be releasing yet another version of Ubuntu. It will be Ubuntu 10.10. Just a trivia, Ubuntu does have a unique convention for their version numbers. Ubuntu 10.10 means it will be released on October 2010. They use the YY.MM format instead of the usual version numbers.

I think that would be all for now. Bye.