Win some, lose some

I’ve been working really hard the last weeks. I’ve started to develop the Flash web application. I started with the calendar part which gets all the different days from the database and presents a nice, scrollable and selectable list of days. The user can choose from which days she wants to see data. They are grouped by month and presented in a visual hierarchy. As you can hear I’m pretty happy with it and especially happy with how smooth the coding is going.
I must confess I’m very happy with ActionScript 3. What a robust language! Once you get the hang of it (and it is quite a difference from the first handful of methods and from AS1 too) it’s great to work with. So now I’m ready to start with Google maps and the projection of the data.

Design for the web application

Design for the web application

Onto the part where I lost some… I’d already done quite some work on the communication between the Arduino and the Nokia. Except for the formatting I could receive data from the Arduino on my phone. As I needed to  fill the database for my web app I tried running the old (working) scripts on my phone. I could make a Bluetooth connection but the communication didn’t work and I often got the message error(13, ‘Permission Denied’), a dreaded message which I thought I’d solved. So I tried installing a new version etc. No luck. As I’m running out of time for the presentation on the 19th I decided to fake the data so I could at least continue with my development.
So now I’ve manipulated the data from my collecting silence database. I wrote a Processing script which loops through all the lines of my database dump and creates new SQL queries from the existing data and writes them to a file. I could then import the queries and now I have a nice database on AQAb filled with almost 1000 rows of data. I do feel a little naughty but it’s the only way I can continue with my work at the moment. My knowledge of Python on mobile devices is too limited. And now I can’t even run the Scriptshell without errors, *sigh*

Oh yes, I’ve also done a video and photo shoot with Hans, my model. Pfff, filming is a true profession. I hope I’ll be able to make something presentable of the shots when editing. It’s a challenge to keep track of everything when you have to be director, producer and cameraperson at the same time.

I heart Python

I’m continuing my quest for my mobile app. It’s at the heart of sharing the data I capture with my sensors. After I’ve started the program it should:
Connect to the Arduino board very n minutes (2 for example)
 Arduino should start the sensors
 wait for a few seconds (they need heating up)
 loop through pins a, b, c, d (NO2, CO, O3, temperature)
 check smell flag
 turn of the sensors
Loop through the Arduino values
Store them as a Python dictionary
Get the latitude and longitude from the internal GPS
Store them in the same dictionary
Connect to the internet
Post the dictionary content to a PHP script (which writes them into a database)

Data returned after inserted into database

Data returned after inserted into database

I’m relieved that I’ve made some progress. Yesterday I made a connection to internet and posted variables to a (very basic) PHP script. Today figured out the elegant data type called dictionary. It’s a kind of array but you can store key:value pairs. So they’re ideal for creating POST variables to send to a PHP script and very easy and flexible to build. I build a little air quality table that stores all the sensor data, date and time and whether or not the smell was nice at the time of the measurement (more about that some other time). Once I’d manage to store all the values in the database it was time to look for code to read out the GPS values. I came across this great tutorial with a tiny bit of code. Enough for what I need.
Of course the code will have to include error handling. The next step is connecting to the Arduino.

Update 9-9-2009
After working with the program for a bit it’s clear that it sometimes takes quite some time for the GPS values to be found. Earlier I had a field in my database table which would insert the data and time at the moment the data was posted. This may very well not be the time the air quality is measured so now I use the phone time which I can also read and format easily with two lines of Python code. Love that language!


During the I-machine festival in Oldenburg, Germany I met Laura Beloff, who has lots of experience in working with wearables. As it happens she is heading a research and art project on climate change, in Lapland, Finland. At a later stage they’ll also be developing wearables for measuring pollution. She’s interested in collaborating with me. I’ll be keeping her up to date of my progress and findings and she’ll see if she can provide help if needed later on. She’ll also be informing me of requirements they will be formulating together with the scientists. I can see if I can integrate them in my wearable.

With the wearable they also want to promote Citizen Science which is letting the general public collect data for scientific purposes using for example their mobile phones. So I suppose I could fit in there nicely. She already had some tips for me. I should use a Symbian phone with integrated GPS. For her projects she used a Python script to communicate with a server. She said that Processing wasn’t very good yet in the mobile department. So I have good reason to speed up my purchase of a new phone/PDA :)