Week 12. Interface and application programming

Goal

This week our assignment is to write an application that interfaces with an input and/or output device.

Choosing a programming language

When I imagined this week long time ago I was 100% sure that I would choose Processing as the programming language for the assignment. But after taking the class I changed my mind and decided to use Python. There a lot of things you can do with Python that you cannot even dream with Processing. The first time I heard about Python is when I took a few CS50x lectures at edX. I encourage you to take at least the first lesson, even if you don't like coding, David J. Malan will catch your attention. So I choose Python, final answer.

Python

Inspiration

4 weeks after the assignment deadline I received inspiration for this assignment when John Rees shared a link in my Facebook wall for a DIY HAL 9000 computer. I love this movie. It is and will remain the best space movie ever. You watch modern space movies now and they look like crap compared to this one. This movie was shoot in 1968 (!) and the aesthetics is so awesome. I will try to recreate HAL 9000 computer console.

HAL9000 console

I did some research and found that the console typeface was Microgramma. I could not find the rest of the fonts so I used Museo Sans for the sensor readings. Finally I modified this sticker to become FAB 9000 instead of HAL 9000 (see the result at the end).

HAL9000

Choosing an Input Device

I am still debugging Keeter's multitouch sensor so I prefer not using it. This week I'm going to use a temperature and humidity sensor hooked to an Arduino Barduino. I just want to focus in coding this week. I have enough pending work to finish and making a new board just for this assignment is not an option.

OFFTOPIC:  I would strongly recommend for next year to start a week (or even two) earlier at the beginning and having a free week around the middle of the semester. That would help people catching up for their assignments and also thinking or working in their final projects. I am finding it too dense, I miss some time to keep experimenting on the topics. On the other hand I like the idea that there will be a whole universe to explore once Fab Academy ends.

Obtaining readings from the sensors

I wanted to make sure that the sensor was working properly before spending time later wondering whether the problem lays on the sensor or in the program. So I found a small example  in Arduino IDE sketchbook to obtain readings from the STH15 and made some modifications to send data in the desired format over serial port.

Hands on with Python

I decided to use Tkinter as the GUI interface library. I started with wxpython but then I noticed how hard was to set a custom font. Since my goal was to mach the look and feel of HAL, custom fonts were necessary so I switched to Tkinter, which is the library that Neil uses as well in his examples.

The result

The program has two modes: temperature and humidity. When you first execute the script there is a black screen waiting for you to select the mode. You can either select the mode from the top menu Mode/Temperature or Mode/Humidity or by using the h and t keys. The sensor readings are displayed in a weird look format in order to mach the movie style. As for the rest? It's just a temperature and humidity sensor interface!

Fab 9000

What I learned

I left this assignment unfinished in week 12 till week 16 because I did not know what to do. In your Fab Academy experience there will be moments that you will be stuck. That's fine, just practice with some examples and some day inspiration will come. Do not force it. At least it is happening to me like this.

Download files

You can download all the files related to this week here.