It’s getting cold: Measuring gas usage with S60 camera phone

The last two weeks I haven’t done anything on KDE/Nepomuk/Amarok (Does that statement qualify for posting this on planetkde? ;-) ), but for a good reason: It’s getting cold outside.
So time to get back to an old project of me: I wanted to measure the gas usage of my gas heating in real-time and come up with the idea to use a mobile phone with a camera for that. The plan was to have the camera of a mobile phone looking on the burner and recognize if the flame is there or not. That should work under the assumption, that the burning duration is directly related to the used gas volume.
So I picked my old Nokia 6680 (Symbian S60 2nd FP2) (oh I am glad that you can now program it in Python using PyS60) and started work on a proof of concept.
To make it short: After not working on it for about 10 month, I manged to get it to work.
A small Python program calculates the amount of blue in a section of the camera view once every second and if it gets above some threshold it assumes the flame to be on and writes a record to a SQL DB on the phone. It also calculates the current gas meter reading and makes all that data available over Bluetooth on request.
Now a picture of the setup:
The gas heating with the phone looking on it (door open)The gas heating with the phone looking on it (door open)
If the isn’t the coolest usage of a mobile phone ;-) And now a picture of what the phone is seeing when the flame is burning:

A am pretty satisfied with the accuracy of the measuring. The last day I had a measuring error of about 1,3%.
I also wrote a small Qt application to get the data from the phone (over a bluetooth spp connection) and visualize it. Also a screenshot:
Screenshot of gas monitor appScreenshot of gas monitor app
The next months it will be fun (OK, only energy saving addicts like me will consider this fun) to analyze the usage and see how it relates to the temperature. Hopefully it helps to save energy (and money ;-)). If someone is interested to build something similar, just ask me for the source. (But don’t expect it to be well written…)
Oh, and to somehow justify the syndication to the planet: I am back to work on the Nepomuk music service to hopefully get it into KDE 4.2 (the next post will be about that) so that it can get used in the first Amarok 2 feature release after KDE 4.2 (2.1 or 2.2)

Organization: KDE Original: Source