Cloudy (showers later)

Monday, April 4, 2011

Physical Gmail Notifier

So, looking for a job in France (which is a challenge) I needed a break and decided to look around in my 'box of electronic stuff' to see what I could build.

Found some arduino's and then, 6 red LED's. So, I figured I had to build something that counts using a six bit binary system.

Then I found This blog on how to make a physical gmail notifier, and really liked the idea, so I adapted the code, and fought with the plist file used (on macs, dunno how to do this on PC) to run the python script with a specified interval, and now it works!

So now, I have a little wooden block next to the mac, showing me how many unread e-mails I have.. which allows me to see if I have any, and if so, how many, from a distance. Can't do without that, obviously.

In case more people feel inspired, this is the code used on the arduino:
(mind you, I'm not a real good programmer, so it can probably be done easier, or better, but hey, this works for me)
int pinArray[] = {2, 3, 4, 5, 6, 7};
int nomailpin = 8;
int mail = LOW;
int val;
int outerloop;
int value;
int bit;
int innerloop;
int pinLoop;
int bitSetter;
int amount;
int mailcount;
int oldval;
int timer = 25;
int count = 0;

void setup()
{
Serial.begin(9600);
Serial.flush();
pinMode(nomailpin, OUTPUT);
for (pinLoop = 2; pinLoop < 7; pinLoop++)
{
pinMode(pinLoop, OUTPUT);
digitalWrite(pinLoop, LOW);
}
}

void loop()
{
if (Serial.available()) {
val = Serial.read();
Serial.println(val);
mailcount = val+1;
if (val != 0) {
if (val != oldval) {
change();
}
Serial.print("mail");
num_mails();
digitalWrite(nomailpin, LOW);
oldval = val;
}
else if (val == 0) {
for (pinLoop = 2; pinLoop < 7; pinLoop++) {
digitalWrite(pinLoop, LOW);
}
for (int j=0;j < 4;j++) {
digitalWrite(nomailpin, HIGH);
delay(100);
digitalWrite(nomailpin,LOW);
delay(100);
digitalWrite(nomailpin,HIGH);
delay(100);
digitalWrite(nomailpin,LOW);
delay(100);
}
digitalWrite(nomailpin, HIGH);
oldval = val;
}
}
}

void num_mails()
{
for (outerloop = 0; outerloop < mailcount; outerloop++){
bitSetter = outerloop;
for (innerloop = 2; innerloop < 10; innerloop++){
value = bitSetter / 2;
bit = bitSetter % 2;
if (bit == 1){ digitalWrite(innerloop, HIGH);}
if (bit == 0){ digitalWrite(innerloop, LOW);}
bitSetter = value;
}
}
}

void change()
{
for (int count=0;count<6;count++) {
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
for (count=5;count>=0;count--) {
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer);
}
}

This is the python code:

import serial, sys, feedparser

#Settings
USERNAME="YourEmail@gmail.com"
PASSWORD="YOURPASSWORD"
PROTO="https://"
SERVER="mail.google.com"
PATH="/mail/feed/atom"

SERIALPORT = "/dev/tty.usbserial-A7006vlT"

# Set up serial port
try:
ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
sys.exit()

newmails = int(feedparser.parse(PROTO + USERNAME + ":" + PASSWORD + "@" + SERVER + PATH)["feed"]["fullcount"])

# Output data to serial port
ser.write(chr(int(newmails)))

# Close serial port
ser.close()

Of course, you will have to put your username and password in the script, and change this : dev/tty.usbserial-A7006vlT for the address of your arduino (you can find that in the arduino software under Tools > Serial port).

Then, you need to put a .plist file in your Launchagents folder (in your Lib) containing this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.j4mie.check-gmail</string>
<key>OnDemand</key>

<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python</string>
<string>/Users/yourusername/path/to/check-gmail.py</string>
</array>

<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>

Make sure to enter the correct path to both your python file, and your pyton interpreter.. it's often not just /usr/bin/python as in this file.. make sure you have the one you get when running python in your terminal.. that's the one you want to use..

So, when all this is done, you should be able to see the LED's (or whatever you build) show you your amount of unread mail every minute.. I made a little movie showing my finished notifier block:





Enjoy!

Friday, February 27, 2009

Changes, for that never changes

After my breakup with Martijn I started talking With Danny Grob, another schoolmate and friend, and we decided to work together!

So a new cooperation, and some new plans.

In short, this is the plan:

Physical representation of the raw materials used to generate the power used by the internet using those materials themselves, and allowing the viewer to 'feel' their impact on their direct environment. The user can alter the variables, and thus see what impact a particular action has.

A bit longer:

we are going to build an interactive installation, in which the raw materials needed to account for the power consumption of the internet is displayed by use of water, soil, gas and electricity. These materials will be incorporated in the installation themselves, and will be shown in what might appear to be a small power plant.

Furthermore, the visitor will be able to interact with the installation (which will derive it's data live from the internet) by changing certain values. What if we would all shut off our computers during the night instead of leaving torrents open? These altered values will be directly shown by the installation.

Everything to scale of course.

Another thing! (jippy!)
Martijn and me have been asked to install some older macs on the polytechnic school in Accra, Ghana, and teach the people there how to use them and the software installed on them. Great opportunity of course to visit another country (really excited about that!) but also a great project organized from within the HKU. A lot of old computers are thrown away just like that, but there are many people in other countries that might have really good used for them. I'm glad to be made part of this!
We will go there around the second week of May, and stay for a month to teach and get everything up and running.
We will be at the Polytechnic school itself, and I will of course keep you posted from there about our adventures.

Thursday, February 12, 2009

Networks

Since I started thinking more in my own lines of interest an idea popped up; what if I would consider the internet as being a neural network and make design decisions based on that premise?

I could construct devices that depict a certain state of the internet (and hence the world using it) by monitoring the use of words in the blogosphere. I.e. an object that allows you to see the degree of happiness or lack thereof felt by the people writing the blogs. By, for instance, monitoring the frequency of use of the words 'love' and 'hate'.

Problem that arises here; the use of the word 'hate' does not necessarily occur in a post that would have to be considered as 'negative'. One could construct a sentence; 'I am infinitely glad for the disappearance of all the hate that surrounded me lately' Which would be looked upon as negative by the just introduced system, while it obviously is not.

But problems I like.
For now I'll pursue this line of thought and see where it brings me.

For the 'goede orde', as we Dutch say, a little quote:

"On ne me fait pas marcher moi" (Cravan, Arthur)

Which is absolutely not true.

Tuesday, February 10, 2009

Wieder zu hause.

Zurück von einem schönen Wochenende in Deutschland, und jetzt ist es zeit fur etwas arbeid!

As one could read in the previous post, we went to the ZKM in Karlsruhe, where we visited the exposition 'Medium religion' and had dinner with a student of architecture from France. The dinner was very good (accompanied by nice dunkel weizen (you gotta love the contradiction)), the museum was ok.

After spending quite some time there, I was notified of the fact that the museum also features a giant section of interactive installations.. which I was able to glimpse at for just 5 minutes before they closed. A lesson was learned; always check what's available.

The exposition on religion in the media was interesting, but, for me, not much more than that. Next to some good imagery (wooden crosses supporting spray-glue in cans with the text; 'NO MORE NAILS'. Simple but strong, for it demystifies but could also be looked at as rude and offensive, which makes you wonder what you actually believe) there where some nice installations.

A giant industrial robot arm in the process of writing down the bible on a scroll immediately called forth all sorts of feelings and made me wonder. The whole installation radiated serenity. The slow elegant movements with which the arm was inscribing the words on the scroll made it seem strangely organic and combined with the 'human' in the connotations of the biblical text made it a very appealing installation. brilliant how, although it was a machine, it gave the same feeling as when there would have been a monk writing those words. In the end we are just machines, but making that visible is quite neat.

The next day Martijn, Laura (the lady who joined us) and I went on a refreshing walk. Shortly before, resting my head on the shoulder of my lovely girl, I decided to not work together with them on the installation, for my interests lie elsewhere, and my preferences concerning style and content are in such a way different from theirs, that I feel I would only hold them back, so to speak.
They agreed on this, and it will mean that Martijn and I will not work towards the same end result, but nonetheless together. I will help (when asked) in matters technical and serve as sparring partner in discussions, and Martijn will also do the latter for me and help me code (if desired).

When we stopped in a street for a picture, I discovered an object that I like. I always feel strangely drawn toward mechanically produced mass products such as nuts and bolts. So finding something like that makes me happy and might even lead me in a direction concerning the design of my final product.

My final product by the way, will be in the field of robotics, and the connection of the physical world and internet/data.


Thursday, February 5, 2009

Research and Rain.

Today Martijn and I went to Amsterdam to visit some museums for ideas and general research, only to find that all of them where not open anymore or not open yet. While discovering this, it rained. So wet and slightly dissatisfied we ate some sandwiches and tarte au citron at de Gebroeders Niemeijer which we can highly recommend. Not only are the products massif, their literature rack featured a copy of an art magazine that contained info about religion in art, which we where also looking for. You find in weird places.

What, might you wonder, has that got to do with your project? Suddenly believing in a God above and a Devil below? Nope. still believing in nothing here, but yesterday we had an really interesting talk to a fellow student at the HKU, and found out that we might do a project with her, which will concern religion, meaning (in dutch 'zingeving') and a far more personal touch.

Obviously it is not yet clear what it will all embody, but keep on reading this blog and find out.

Furthermore, saturday we will drive to Germany for a short trip to the ZKM, the center for Art and Media in Karlsruhe. Right now the museum, which was recommended to us by a teacher, features an expo entitled 'medium religion'. Obviously not to be confused with rare religion.
Since we are students and creators of media.. results of the trip will follow.

Thursday, January 29, 2009

HKU

After a period of working in a group project on the HKU, it's time for a more personal project. I will be doing this with my schoolmate Martijn Bruckman, whose blog you can also read for more info.
I will be posting my research and progress here. So keep reading.

Friday, January 9, 2009

But needs time to..

Life, once again, did continue after my last post. Looking at the regularity of posts it might have rather slowly . Or, as it did, rather quick. I find myself suddenly incredibly in love, finishing my master of arts and technology (whatever that might mean(if anyone knows (seriously)let me know. Please.)) missing mountains, hiking, ice-climbing, skiing and generaly feeling lost. But I also find myself surrounded by wonderful people like my lovely girl Maud, and good friends. So time to stop wimpering and wondering, and start to get to work.

I decided to build a really cool instructable I found and you can check out here and i'm in the middle of a workshop in which second years are building robots under guidence of me and my dear Martijn. Amazing, but true. I'll post the results soon, for I think they will amaze me. Good to see that the people who are now second year are much more advanced than I was in my second year.

Next to that there is Work Being Done on my master project. It will be disclosed at a proper time. Hold on.

Also, when looking for usefull stuff for our new home (us being me and Maud) I stumbled upon (not using the cool online tool) a pinball machine. Which I am trying to fix as we speak. Or rather read. Or use a keyboard. Well, never mind. I'll post something about the cool new toy soon.