silence explorer

Finally I can pick up the research about the correlation between silence and stress. This was of course the main goal of the Collecting Silence project but I never got round to really dive into it. So I picked up where I left two years ago.

I’ve worked on a sketch in Processing:

Blue = silence data, green = stress. I want to create a sort of landscape where the gaps between the two create the relation. I want to integrate this graph in an application where people can explore the data from the perspective of the correlation:

Rolling over the data lines displays the values and moves the map. You can pick a date and explore the data attached to that date.

I’m going to build the app in Flash/AS3 (as the website of the project is for a large part in Flash) and I’m trying to do it the OOP way again which is still quite hard for me.

 

Live

Last week a major hurdle was taken for this project.
1) I held my presentation for a very interested audience of around 200 students from the Design Academy in Eindhoven, the Netherlands. I was very nervous but once I got started things went OK. I only had 10 minutes so I focussed on the design process. The audience was also design orientated so I didn’t want to bother them with too much technique.

Presentation at Design Academy

Presentation at Design Academy

Opcacity and outline change depending on data

Opcacity and outline change depending on data

2) I finished the website www.aqab.nl I’m still amazed by the swiftness with which I realised this project. I’m very happy with the Flash app. Even though the data is fake (for now) it does give a good insight into the power of the app. I think I’m most proud of the icon and the way in which the outline colour changes to indicate good, bad or neutral smell. It’s just so easy to work with the Google Maps for Flash API. Great job, good documentation too! You can just use all the build in functionality in a very simple way by using the classes. Also check out the check boxes with which you can select all the days of a month, not as simple as it looks to program…
3) I’ve edited the video and put it online as a Flash flv file and you can play in from the homepage using the simple player. There wasn’t very much useful material for the motorway scene, so I’ve had to improvise a little. I think the rest of the video runs smooth enough. It gives a good impression of how to use the wearable.

There are still some things to be done: the displays don’t light up more then four rings per gas at the same time, I’ll have to change that for more pollution.  Maybe just light up the smallest and the largest. The Nickle Cadmium don’t supply enough power either and I don’t want to use more batteries. I’ll have to work on the Bluetooth connection. And I’ll have to interpret the Arduino values and recalculate them to ppm for every gas.

So keep an eye on this blog. All announcements will go through the website, the five most recent entrees of this blog are listed there as well.

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.

Day by day

I’ve just finished the interface for browsing the work day by day. It took much more time then anticipated. This was because as soon as I jumped to another day the program started slowing down to an unacceptable level. I had to figure out why that happened before I could carry on. Finding that out and fixing it took me about five hours!

I finally discovered that a drawing new heart-beat graph slowed down the program because it got bigger with every new day you clicked. This graph is build up from thousands of dots and lines. To make the animation go faster I had to remove those first. But I put them in the wrong place so I couldn’t remove them. I had to rewrite the code for building the graph so I knew where all the lines and dots were and then I could remove them. Now with every day you pick the old graph is removed and a new one is drawn and the speed stays the same.

On the net I found this really nice code for adding listeners to the seven buttons in a dynamic way:

addEventListener(MouseEvent.CLICK, mouse_click);
function mouse_click(event:MouseEvent):void {
var object_name=String(event.target.name);
for (var i:int = 0; i < 7; i++){
if (object_name == day_btn_array[i])
{
get_day_data(event);
}
}
}

So instead of writing all the listeners by hand I now only have three eventlisteners (only one is shown here.) With every click the function finds out what button was clicked. It calls the appropriate function and passes the original click event. In the called function I again retrieve the name of the button from that event using event.target.name again.

Happy

prototype of the first heart-beat graph

prototype of the first heart-beat graph

I’ve managed to code my first heart-rate graphic. And it’s CUTE!
By looping through the big data file I can isolate the heart-beats, take the different values to draw lines and put in the dots at the right coordinates. The next step is to draw a big graph in Flash and move it to the right at certain intervals (500 milliseconds for example). Now it still is a drawing that is animated from left to right. It disappears from view after a while, as you can see in the picture.

Getting things on a map

Custom marker in Google maps for Flash

Custom marker in Google maps for Flash

Yesterday I continued with my Flash web app. I’d already done some tests with part of the application. For example displaying a map inside Flash. Only recently Google maps have released an API for working with Google maps inside Flash. This makes it very easy to include (interactive) maps inside your Flash app. Of course when you want different things it’s harder :)

I want to display two maps, one for Amsterdam and one for Breda. On the map you can follow me around for two weeks. I wanted to use a fitting icon to display where I have been. So I designed a heart to indicate where it was beating at a certain time. I thought it would be simple to display my custom marker. But I could only find difficult and not so logical examples explaining how this is done. So with a fresh mind in the morning I took a new look at the documentation and worked it out. As it took me quite some time to work this simple code out I’ll just repeat it here for those interested:

function onMapaReady(event:Event):void {
   map_a.setCenter(new LatLng(b_line_array[2],b_line_array[3]), 14, MapType.NORMAL_MAP_TYPE);
   var a_icon:Marker = new Marker(   new LatLng(b_line_array[2],b_line_array[3]),
   new MarkerOptions({
      icon: new my_icon()
   })
);
map_a.addOverlay(a_icon);
}

So in my library I have a movie clip called (linkage) my_icon. I use this for the Amsterdam and the Breda map, except that it’s called b_icon there, the rest of the code is the same. Make sure you import the marker classes:

import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;

And add the overlay, then you’re done.

I give up

Flash Lite app with Shuriken component

Flash Lite app with Shuriken component

Part of the data I want to log and show are my activities. I’ve wrecked my brain trying to think of an easy but digital way of keeping track of my activities during the day. That data should consist of a time stamp and of course my activity. I imagined an application which would run either on my PDA or on my mobile phone. I would have to be really easy to work with as I’ll be using it for two whole weeks on a constant basis. I was thinking of a drop-down menu or combo-box which would hold all my possible activities (hmm, is that possible). Once I’d have selected an activity it would be stored on the device together with a time stamp indicating the current time. The next morning I would download the data from the device and integrate it with other data collected the previous day. Sounds simple right?

My first thought was Excel, as this is an easy way to store structured data and output it in different formats. But the power of my pocket Excel is limited and after some time I realized that you can’t use VB Script so that solution went down the drain.

By chance I realized that Flash (dear Flash) can also store persistent data. This wasn’t something I had worked with before but it sounded promising and I could use it on my Nokia. At first I developed a desktop version. When I got that working (sorting the collected data proved to be the most difficult task) I discovered that I couldn’t use the combo-box component on my Nokia, it wasn’t supported. But thankfully there are geniuses out there who made custom components for handheld devices! After I’d finally set them up other parts of my AS3 code weren’t working on Flash Lite, which supports AS2. But after a about a days work I can’t get the application to really store all the data. The sorting again is a problem (1, 10, 11, 2) pfffff. So this afternoon I made the very uncharacteristic decision to give up this application. Time is pressing. I still have to build… everything really.

So now I feel quite relieved and have decided I’ll use pencil, paper and my watch to collect my activities.