A Minute in Sound: Larissa, James, Ellie, and Michael

For our sound project, we present to you a blood chilling, gritty, and nightmarish classroom experience just in time for Halloween! Our story takes place on an average day in the IMA classroom… Where Professor Petit summons a hellish and malicious being to impale and slice her students into a bloody mush!

The most fun aspect of this project was gathering the various sound clips we would use. As soon as we made our decision to create something spooky, our minds all went to the eerie noises the trash cans on the 8th floor make when you use them. The metallic squeaking noise served us well in creating a frightening atmosphere in our sound clip. Along with that, we recorded (but not everything was used!) our own footsteps, maniacal laughs, and more.

However, not all of the sound effects we utilized came from on-field recordings. We also found sound clips on “freesound.org” to finalize the brutal scenario we were creating. The website itself has an extremely wide variety in sound clips. Knife slashes, ominous footsteps, and all sorts of unnerving noises can be picked up there.

Once we had all of our sounds, all that was left was to mold them into our story. In order to help facilitate the plot of our little audio funhouse, we drew out a kind of a simple sound storyboard. We organized which sounds would work well in combination together, and also carefully timed key audio clips to deliver the maximum effect we were aiming for.

Completing this project made us realize how complex storytelling through audio was. In many ways, composing an audio story is just as demanding as telling a tale through video, even more so because we had control over every sound clip at our disposal.

Francis’s Lab 11

For this lab, we did the first step of our final essay. Thanks to Matt’s help, we are able to pixelize the video the camera catches and turn each pixel into black or white.



Here is the code.

import processing.video.*;

int numPixelsWide, numPixelsHigh;
int blockSize = 5;
Movie mov;
IntList pix;
color movColors[];
boolean yes=true;

Capture video;

void setup() {
size(640, 480);

video = new Capture(this, width, height);
// Start capturing the images from the camera

numPixelsWide = width / blockSize;
numPixelsHigh = height / blockSize;
movColors = new color[numPixelsWide * numPixelsHigh];

// Display values from movie
void draw() {
if (yes==true){
if (video.available() == true) {
int count = 0;
for (int j = 0; j < numPixelsHigh; j++) {
for (int i = 0; i < numPixelsWide; i++) {
movColors[count] = video.get(i*blockSize, j*blockSize);

pix=new IntList();
int k=0;
for (int j = 0; j < numPixelsHigh; j++) {
for (int i = 0; i < numPixelsWide; i++) {
if (brightness(movColors[j*numPixelsWide + i]) < 127) {
} else {
rect(i*blockSize, j*blockSize, blockSize, blockSize);
for (int j = 0; j < numPixelsHigh; j++) {
for (int i = 0; i < numPixelsWide; i++) {
if (pix.get(j*numPixelsWide+i)< 127) {
} else {
rect(i*blockSize, j*blockSize, blockSize, blockSize);

void keyPressed(){
if (key == ENTER){



Sita Sings the Blues Reflection

Sita Sings the Blues resonates strongly in the hearts of many individuals for many reasons. However, one aspect that especially strikes the chords of its audience is its use of multimedia assets in its creation. By mixing and combining various art visuals and styles, Sita Sings the Blues clashes worlds together in a way that is unique amongst other types of media. While cartoon animation would require multiple artists that are each adept at a certain art style, the usage of Adobe Aftereffects allows individuals to simply manipulate different styled assets to create a multimedia collage of Indian shadow puppets, cartoon characters, and more.

I’d also like to touch upon the extremely high resolution of the assets used in this film. Many scenes in Sita Sings the Blues utilize shots that begin on a close up of a character, and slowly zoom out. Despite how close the camera begins, the character’s images show no sign of grain or any quality loss! It was quite impressive.

Ma Teng( Martin Ma ) and Lin Junchao(David Lin ) Final Project: Super Music Box















import processing.serial.*;
import cc.arduino.*;

import ddf.minim.*;

// sound
Minim minim;
AudioPlayer song1;
AudioPlayer song2;
AudioPlayer song3;
AudioPlayer song4;
AudioPlayer song5;
AudioPlayer song6;
AudioPlayer song7;
AudioPlayer song8;
AudioPlayer song9;

Arduino arduino;
int XPin = 0;
int YPin = 1;
int ZPin = 3;

int XVal;
int YVal;
int ZVal; // if ZVal = 1, button off, else ZVal = 0, button on

int value=0;

int a = 66;
int sideL;

int y = 150;

int[] posX = new int[9];

int num1;
int num2;
int num3;
int num4;
int num5;
int num6;
int num7;
int num8;
int num9;

int xLeft;
int xRight;

int x2Left;
int x2Right;

int x3Left;
int x3Right;

int x4Left;
int x4Right;

int x5Left;
int x5Right;

int x6Left;
int x6Right;

int x7Left;
int x7Right;

int x8Left;
int x8Right;

int x9Left;
int x9Right;

PImage img1;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
PImage img7;
PImage img8;
PImage img9;
PImage img11;
PImage img22;
PImage img33;
PImage img44;
PImage img55;
PImage img66;
PImage img77;
PImage img88;
PImage img99;
PImage imgSelect;

int whichNum;

void setup() {
size (800, 500);

arduino = new Arduino(this, “/dev/cu.usbmodem1421”, 57600);
arduino.pinMode(ZPin, Arduino.INPUT);

// images
PImage imgBackground;
imgBackground = loadImage(“00.jpg”);

img1 = loadImage(“snow.jpg”);
img2 = loadImage(“halo.jpg”);
img3 = loadImage(“secret.jpg”);
img4 = loadImage(“Gravity.jpg”);
img5 = loadImage(“sjzy.jpg”);
img6 = loadImage(“Tom.jpg”);
img7 = loadImage(“All of me.jpg”);
img8 = loadImage(“whatMakesYouBeautiful.jpg”);
img9 = loadImage(“whereIsTheTime.jpg”);


num1 = 0;
num2 = 1;
num3 = 2;
num4 = 3;
num5 = 4;
num6 = 5;
num7 = 6;
num8 = 7;
num9 = 8;

posX[0] = -108;
posX[1] = 0;
posX[2] = 85;
posX[3] = 200;
posX[4] = 393;
posX[5] = 586;
posX[6] = 710;
posX[7] = 800;
posX[8] = 908;

minim = new Minim(this);
song1 = minim.loadFile(“1.mp3”);
song2 = minim.loadFile(“halo.mp3”);
song3 = minim.loadFile(“secret.mp3”);
song4 = minim.loadFile(“Gravity.mp3”);
song5 = minim.loadFile(“sjzy.mp3”);
song6 = minim.loadFile(“Tom.mp3”);
song7 = minim.loadFile(“All of me.mp3”);
song8 = minim.loadFile(“8.mp3”);
song9 = minim.loadFile(“9.mp3”);

void draw() {

XVal = arduino.analogRead(XPin);
YVal = arduino.analogRead(YPin);
ZVal = arduino.digitalRead(ZPin);


if (XVal 600) { // Right

// Album 1 + Predict & Display
if (num1 0 && num1 = 9) {
num1 = 0;

// Album 2

if (num2 0 && num2 = 9) {
num2 = 0;

//Album 3
if (num3 0 && num3 = 9) {
num3 = 0;

//Album 4
if (num4 0 && num4 = 9) {
num4 = 0;

//Album 5
if (num5 0 && num5 = 9) {
num5 = 0;

//Album 6
if (num6 0 && num6 = 9) {
num6 = 0;

//Album 7
if (num7 0 && num7 = 9) {
num7 = 0;

//Album 8
if (num8 0 && num8 = 9) {
num8 = 0;

//Album 9
if (num9 0 && num9 = 9) {
num9 = 0;

text(“ENJOY&RELAX”, 200, 360);
fill(0, 100, 0, 180);
text(“ENJOY&RELAX”, 203, 363);

void stop() {

Our mid-term project is a simple music-box which can only play music by using PC’s keyboard. It can play six songs and the design is not very attractive. In order to improve our project by involving in Arduino’s function, we plan to make a more convenient and interesting music box. Our intention is to make a music box which can easily control the music you want to listen to. More importantly, it can delight the user. So we decide to create a scroll effect which is controlled by a Joystick.

We begin our project by dividing our projects into two parts-the codes part and the function part. (David)Lin Junchao was in charge of processing the codes and using Laser Cut. Martin(Teng Ma) was in charge of using 3D printer to print a delicate container for Joystick and adjusting the design of the interface (the background can become the album cover when you choose the song, but the cover is like Boris Scatterize, very beautiful.

The processing process is enormously harder than our mid-term project. We need to make nine different squares for the cover of the album. And we process the program in order to let each cover replace the former cover’s place. Then we try to attach the music to the square. However, the process is extremely hard since it is easy to make some faults when we are processing nine squares’ codes. It takes us two days to improve the codes by using various methods including simplifying the codes, changing the expression way and using the force stop etc. Finally we successfully finish the processing part but connecting Arduino with Processing also requires patience. We double-check the wires to ensure that the whole project will work well. Admittedly, the whole project still have a bug that sometimes some songs will mix together which is really weird. The Laser Cut part is really interesting, we try to cut a big container for our project in order to make a better presentation in IMA final show. It is really interesting when you see the cutter effortlessly cut the model out.

Martin’s job is not as easy as it seems to be. Printing out a fit container for our final project requires precise calculations and measurements. The first model turns out to be a failure because it cannot match with the size of the Joystick and since the density of the first product is so high that it nearly cannot be derived from the 3-D printer. To solve this problem, Martin makes another try and carefully measures the size of Joystick. He turns down the density of the product and eventually, the final model is printed so well that it precisely match the size of Joystick.

Before we choose this class, we think it is very interesting because we can create something freely. At present, we think it means more than just creating something new, it is also a nice chance to learn how to communicate and cooperate with each other in a team. When we are overwhelmed by code problems (processing bug which none of our staff can fix), we tried our best to find a way to fix it or change our original design. The experience is so amazing that when you finally get the final version stuff, we cannot help screaming.

Finally, we would like to say “thank you”to all the people who have helped us a lot.We learn something necessary that never will we have the chance to gain from the text book.We are glad to be in this awesome IMA community. Thanks you so much!

Mario’s 25 Years

As a child, I first saw a commercial celebrating the 25th anniversary of one of my favorite video game characters, Mario.

To create the looping background featured in the first few seconds of the animation, I used an expression that would loop the same five seconds of a separate composition over and over again. However, during encoding the expression I used seems to be a little faulty. There is a split second of stop time inbetween each loop.

A common issue I had during this animation project be the drafting of many outlines. I would often fall into a mental trap of spreading my ideas over to wide of a scope. This would result in me eventually starting my entire animation over. The final draft of the animation I submitted was very distant from the first ideas I considered upon starting my time with Adobe After Effects.

copy Austin and Allen’s Final Project

Our Final Project is a shooting game where you a banana gun to shoot the banana in the processing and shoot the grape that is supported by arduino. The processing part is created by the 3D model and the main character is a lovely monkey.


And Big thanks to the all-powerful geek,Matt, and Vivian! Without Matt and Vivian(and the sensor borrowed by them) we can’t make out such a wonderful project! Also thanks to the whole IMA instructor by bringing out such an excellent course; I can’t love it more!!!!! I think we’ve tried the most kinds of sensors in this class……

Arduino part:

Infrared Emitter:

  • Grove – Infrared Emitter
  • http://www.seeedstudio.com/wiki/Grove_-_Infrared_Emitter
  • Just use its example program as a part of our program

Grove – Infrared Receiver

  • Actually I think it’s the same as the sensor in the arduino kit but it’s receiving scope is too wide so that it doesn’t fit our purpose

Grove – Infrared Reflective Sensor

  • http://www.seeedstudio.com/wiki/Grove_-_Infrared_Reflective_Sensor
  • To be honest, it’s not a infrared receiver but we take it as so. There’s a contradiction between it’s interruption code in example and the servo code. if you need to use both of them, don’t use the example code directly. (You can follow my code but I even don’t know how it works(A geek man helped me but I don’t know who he is…… ))

Grove – 3-Axis Digital Accelerometer(±16g)

  • http://www.seeedstudio.com/wiki/Grove_-_3-Axis_Digital_Accelerometer(%C2%B116g)
  • I only found it can give out the accelerated velocity; it may can give out the certain angle but I didn’t find it anywhere……

Grove – 3-Axis Digital Compass

  • The same problem….I know it’s a 3-Axis compass but I don’t know how to get the z-axis……Sometimes the wiki pages doesn’t contain enough information, you may go to the bazaar page to find more detail. (As this one I find another library on github in the bazaar page but I still don’t know how to get the z-axis)
  • http://www.seeedstudio.com/wiki/Grove_-_3-Axis_Digital_Compass



#include <IRSendRev.h>
#include <IRSendRevInt.h>
#include <Wire.h>
#include <TimerOne.h>
#include <HMC5883L.h>
#include <Servo.h>

Servo myservo;
int pos = 0;
HMC5883L compass;
int error = 0;
volatile int counter=0;
int val;
int ledpin=13;
int iopin=4;
int tf;

unsigned char d[] = {
15, 70, 70, 20, 60, 1, 1};

void blink()

void setup()
pinMode(iopin, INPUT);

attachInterrupt(0, blink, RISING); //INT0

error = compass.setScale(1.3); // Set the scale of the compass.
error = compass.setMeasurementMode(MEASUREMENT_CONTINUOUS);
void loop()
MagnetometerRaw raw = compass.readRawAxis();
MagnetometerScaled scaled = compass.readScaledAxis();
int MilliGauss_OnThe_XAxis = scaled.XAxis;
float heading = atan2(scaled.YAxis, scaled.XAxis);
float declinationAngle = -0.0457;
heading += declinationAngle;
if(heading < 0)
heading += 2*PI;

if(heading > 2*PI)
heading -= 2*PI;

float headingDegrees = heading * 180/M_PI;
Output(raw, scaled, heading, headingDegrees);

if (digitalRead(iopin)==HIGH) {
while (digitalRead(iopin)==HIGH) {

if (counter>1) {
for(pos = 0; pos < 180; pos += 1){ // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position

for(pos = 180; pos>=1; pos-=1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
void Output(MagnetometerRaw raw, MagnetometerScaled scaled, float heading, float headingDegrees)
void mov(){
for(pos = 0; pos < 180; pos += 1){ // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position

for(pos = 180; pos>=1; pos-=1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position

2014-12-11 2159352014-12-11 2159382014-12-11 2159412014-12-12 1320032014-12-12 1320062014-12-12 1320112014-12-12 1320152014-12-12 132019

Processing part:


It is created by P3D, consisting the audio and the serial communication part with the arduino.

As use the banana gun, you can control the gun in processing easily(but only in the x-y plane)

As the keyboard, you can use “Z” and “C” to control the angle horizontally and “X” and “S” to control the angle vertically, use “A” and “D” to move the gun

When the banana is hit there will be a firework (actually a lot of red balls will come out from right lower corner)

If you hit the grape there will be extra bonus.

The code:


The main code:

import processing.serial.*;
Serial myPort;
ArrayList<Ball> ballList;
int m =0;
int gt = 0;
int counter=0;
color c1, c2;

//String temp,tmp1;
//String message,result;
//int val;
//int i;

int totalBullet=20;
int currentBullet;
boolean score_switch = false;
boolean shot_swh = false;
boolean[] swh = new boolean[5];
int[] t= new int[5]; // Timer for corresponding switch

int hormove=80;
int vermove=-30;
float xpos=-130;
float ypos= 850;
float zpos=-800;

ArrayList<Banana> bananas;
PImage Banana_Tree, myMonkey, myMonkey2;
PImage Banana, Banana2;
void setup() {
size(800, 600, P3D);
frameRate(10) ;
// String portName = Serial.list()[0];
// myPort = new Serial(this, “/dev/tty.usbmodem1411″, 9600);

swh[4] = true;
for (int i=0; i<4; i++) {
swh[i] = false;

Banana_Tree = loadImage(“Banana_Tree.jpg”);
myMonkey = loadImage(“mymonkey.png”);
myMonkey2 = loadImage(“mymonkey2.png”);
Banana = loadImage(“Banana.png”);
Banana2 = loadImage(“banana_2.png”);

currentBullet =totalBullet;
bananas = new ArrayList<Banana>();
for (int i = 0; i < 7; i++) {
Banana b = new Banana(i, width/2 +(i-3)*200+random(-500, 500), height/2+random(-200, 200), -1000);

ballList = new ArrayList(); //——-prepare new balls—–
for ( int i=0; i<100; i++) {
ballList.add(new Ball());
void draw() {
m = m+1; //————–m is timer for the whole——–
println(“m”, m);

if (swh[4]) { //—————–Switch to control gameover——–
for (int i=0; i< 7; i++) {
Banana p = bananas.get(i);


gt = gt+1; //—————gt is game timer—————
if (gt>650 || currentBullet <= 0) { //———————–Timer——————

translate(xpos, 850, zpos);
hormove = constrain(hormove % 360, 20, 170);
vermove = constrain(vermove % 360, -70, 10);

print(“t”, t[0]);
if (score_switch) {
if (swh[0]) {
for (int i=0; i< ballList.size (); i++) {
Ball b=ballList.get(i);
b.follow(width, height);
if (m-t[0] > 50) { // 5 seconds for balls on right lower corner
swh[0] = false;
ballList = new ArrayList();
for ( int i=0; i<100; i++) {
ballList.add(new Ball());
} else {
score_switch = false;
} else { // else for score_switch, t[0] is beginning time
t[0] = m;
} else { // else for switch[4]

3D and laser cutter part:

We download some 3D bananas models from the net, and find a suitable one with a proper size after trying several simples. It took me 7 hours to print out our final banana( two halves ).


Kevin’s final project: still prototype clock

I have to admit that it’s a bit disappointing seeing that my final project still being a prototype. But denying truth seems to be even more ridiculous 😀
Information provided in this documentation is subject to change until it is considered done. Detail instructions are expected to be added later.

This is still a prototype clock. However, compared to its previous instance, this one has successfully realised following functions.

  • Giving a simple result in numbers telling whether it is time to wake up
  • Filtering sudden or temporary change of brightness or vibration
  • Emulating a real phone interface
  • Using fonts
  • Using timer
  • Cross processed communication

Following hardware has been used in the project and their source has been indicated.

  • Arduino Uno with breadboard and prototype shield, 1pcs, from Arduino beginner’s kit
  • Light sensor , 2 pcs, from Arduino beginner’s kit
  • Vibration sensor ,3 pcs, from Piezo disk vibration detector

Software [1]
Following software and libraries has been used for programming for this project and their version has been indicated.

  • Arduino, 1.6
  • Processing, 2.0
  • FIRMATA library for Arduino, November 17 2013
  • Python, 3.4

Constructing sensors and chips
Light sensors
Light sensors use a standard 5V input, a ground line and an analogue output. It requires a 220 ohm or a 10K ohm resistor.

Vibration detector
Vibration detectors have three pins, which are standard 5V, ground line and analogue output. However it is much more sensitive to direct pressure on its surface than vibrations around it. To solve this problem, either turn to 3-aixs accelerometer or use a proper algorithm to format the raw reading. In this prototype I used the later solution but I think the former one would be better when using mobile phones as sensors.

Other Arduino components
A prototype shield and a breadboard are also used in this prototype. The breadboard provides a flexible base for sensors to be implemented and tested. The prototype shield provides a series of extra 5V output and ground line pins for multiple sensors. An additional external power source may be involved if a motor or other power consuming mechanics are used.

Realising functions
Create a timer
Processing has a function millis() which allows you to get the current UNIX time stamp [2] in millisecond. Therefore following code can act as a 0.5 second (500 millisecond) timer.

void setup() {
base_time = millis(); //setup initial base time

void draw() {
current_time = millis();
if (current_time – base_time > 500) {

base_time = millis(); //reset base time for next loop

Read and write data into files using Processing
Processing provides several methods to read/write strings directly into files. However there doesn’t seem to be any encoding settings of these methods. Therefore characters outside the ASCII set should be avoided for fear that program may crash. Also Processing doesn’t seem to be using standard end-of-line mark, hence reformatting is required while sharing files across programs. Due to the same reason, string operations may not work as expected sometimes and bytes operations are recommended for substitution when strange problems occur.

To save string list to a file, use String var[] method to create a string list and then save it using saveStrings() method which accepts two arguments, one is file name, the second is the string list to be saved. Following is the sample code of writing data to file ‘Data.dat’ [3].

void draw() {
String to_be_saved[] = {
“first element”, “second element”, “and the third element”
saveStrings(“Data.dat”, to_be_saved);

To read strings from a file, use loadStrings() method which accepts only one argument which is the file name. Following is the sample code of reading data from file ‘Data.dat’.

void draw() {
String read_data = loadStrings(“Data.dat”);

However sometimes string operations may not work as expected due to encoding and other reasons, bytes operations are thus called for as a reliable substitution. Bytes operations have almost the same syntax as string operations. One thing should be mentioned is that byte operations use hex-base data. For example, 30 in Dec would be 0x1e in Hex in which the ‘0x’ is the hex base indicator [4].

Sharing data across programs
I used python as a part of the program so as to simplify some unnecessary logic operations and to catch exceptions. Therefore it is inevitable to share data across different programs. I tried two solutions, one of which is through file operations and another is through cross process communication. They both work fine but I chose the former one and I shall explain this later.

File operation is a comparatively easier and more stable solution. Processing, as mentioned above provides several methods to operate file while Python does as well. Both internal method open() and os.file() method can be used to manipulate files. I used open() method simply because it is shorter. Following is a sample code of python opening file ‘Data.dat’ [5], reading its content, reformatting raw data and save it into a list for later use. The ‘/TAB/’ part in the sample code represents a standard tab since block quote automatically ignores spaces.

# -*- encoding: utf-8 -*-
data_file = open(‘E:\Data.dat’, ‘r’, encoding=’utf-8′)
data_raw = data_file.readlines()
data = []
for item in data_raw:
/TAB/item_temp = item.split(‘\n’)[0] //split is an attribute of string used to cut string by a piece of given character
/ TAB/data.append(item_temp) //append is an attribute of list used to attach an item to the end of a given list

Cross processes communication uses several Win32 APIs to synchronise and send message across processes. In Python, ctypes (2.5 or later) or pywin32 (3.0 or later) both provide a simple way of using native Win32 APIs. In Processing, several Java ways of using Win32 APIs are able to run with slight modifications. However this solution is not recommended because it requires you to deal with clock synchronisation and message processing which are quite unnecessary and may cause the user environment to crash. Also this is not a cross platform solution and Python works much better on Linux and OS X.

Using fonts
Processing supports most fonts packed in Truetype and Opentype. However these fonts cannot be used directly in Processing as a conversion operation is required. The method createFont() converts a standard font to Processing format for later use. It has two arguments of which the first one is the family name of the font and the second one is the size of font to be created. This argument may suggest that Processing is actually converting vectorial outline to bitmap and it is recommended that a proper size is chosen here according to later use. After the font creation, use textFont() to assign the font to be used for afterwards text operation. Following is the sample code of using ‘Robot Light’ [6] font.

PFont roboto_light;
void setup() {
roboto_light = createFont(“Robot Lt”, 25);
void draw() {
textFont(roboto_light, 25);
textAlign(CENTER, CENTER);
text(“Hello world!”, width/2, height/2);

Source code
Processing part

//Importing Arduino library
import processing.serial.*;
import cc.arduino.*;
//Initialise Arduino library
Arduino accio;

PFont roboto_light;
PFont roboto;
PFont roboto_clock;
PImage bg;
PImage bg_day;

//===Declare and initialise variables===
float lux_1 = 0;
float lux_2 = 0;
float vibration;
int count = 0;
boolean is_error = false;
long last_time;
int hr = 0;
int min = 0;
String minout;
String hrout;
String time_com;

void setup() {
size(540, 960);
//Initialise Arduino

accio = new Arduino(this, “COM3”, 57600);
for (int i=0; i<=2; i++) {
accio.pinMode(i, Arduino.INPUT);
last_time = millis();
bg = loadImage(“1.png”);
bg_day = loadImage(“2.png”);
roboto_light = createFont(“Roboto Th”, 30);
roboto = createFont(“Roboto Th”, 60);
roboto_clock = createFont(“Roboto”, 22);

void draw() {
try {
if ( 7 <= int(hrout) && int(hrout) <= 18) {
image(bg_day, 0, 0);
textAlign(CENTER, CENTER);
time_com = hrout + “:” + minout;
text(time_com, width/2, 350);
text(time_com, 502, 15);
if (is_error == false) {
if (millis() – last_time > 50) {
String[] luxdata = {
str(lux_1), str(lux_2), str(vibration)
saveStrings(“E:\\Data.dat”, luxdata);
byte result[] = loadBytes(“E:\\Result.dat”);
//        for (int j=0; j<result.length; j++) {
//          println(result[j]);
//        }
//    if (result[0] == ) {
//      println(“Return data type error”);
//      textFont(roboto_light);
//      textAlign(CENTER, CENTER);
//      text(“Return data type error”, width/2, 2.65*height/4);
//    } else
if (result[0] == 0x30) {
textAlign(CENTER, CENTER);
text(“Status normal”, width/2, 2.65*height/4);
} else if (result[0] == 0x31) {
textAlign(CENTER, CENTER);
text(“It’s time to wake up”, width/2, 2.65*height/4);
} else {
image(bg, 0, 0);
textAlign(CENTER, CENTER);
time_com = hrout + “:” + minout;
text(time_com, width/2, 300);
text(time_com, 505, 15);
if (is_error == false) {
if (millis() – last_time > 50) {
String[] luxdata = {
str(lux_1), str(lux_2), str(vibration)
saveStrings(“E:\\Data.dat”, luxdata);
byte result[] = loadBytes(“E:\\Result.dat”);
for (int j=0; j<result.length; j++) {
//    if (result[0] == ) {
//      println(“Return data type error”);
//      textFont(roboto_light);
//      textAlign(CENTER, CENTER);
//      text(“Return data type error”, width/2, 2.65*height/4);
//    } else
if (result[0] == 0x30) {
textAlign(CENTER, CENTER);
text(“Status normal”, width/2, 2.65*height/4);
} else if (result[0] == 0x31) {
textAlign(CENTER, CENTER);
text(“It’s time to wake up”, width/2, 2.65*height/4);
catch (Exception e) {

void initialise() {
lux_1 = accio.analogRead(0);
lux_2 = accio.analogRead(1);
vibration = accio.analogRead(2);

//Extend time format to HH:MM
void extTime() {
if (min<=9) {
if (min==0) {
minout = “00”;
minout = “0” + min;
} else {
minout = str(min);
if (hr<=9) {
hrout = “0” + hr;
} else {
hrout = str(hr);

//Get current time
void getTime() {
min = minute();
hr = hour();

Python part

# -*- coding: utf-8 -*-

import os
import sys
import time
import math

is_error = False

def getData():
global is_error, lux
lux_file = open(‘E:\Data.dat’, ‘r’, encoding=’utf-8′)
lux_raw = lux_file.readlines()
lux = []
if len(lux_raw) != 0:
for item in lux_raw:
item = int(float(item.split(‘\n’)[0]))
except Exception as error:
print(‘ERROR occurs as such: ‘ +  str(error))
is_error = True

def formatLux(data):
if data == 0:
data = 999
data = math.log(data, 1.01)
data = data * 25 – 15500
data = 2000 – data
return data

base_time = time.time()

while is_error ==  False:
result=[‘0’, ‘0’]
sum = 0
valid_count = 0
vibration_count = 0
vibration_confirm = 0
lux_confirm = 0
for count in range (0,30):
if len(lux) == 0:
sum = sum + 0
valid_count = valid_count + 1
sum = sum + formatLux(lux[0]) + formatLux(lux[1])
if lux[2] > 10:
vibration_count = vibration_count + 1
print(‘检测到震动 / Vibration detected’)
if valid_count == 0:
lux_avg = ‘不好意思 3 秒里面一次都没中’
result[0] = ‘255’
lux_avg = int(sum / (valid_count*2))
result[1] = str(lux_avg)
if lux_avg > 140:
lux_confirm = 1
lux_confirm = 0
now_time = time.time()
delta_time = now_time – base_time
if lux_confirm * 0.4 + vibration_count * 0.3 > 0.8:
result[0] = ‘1’
result[0] = ‘0’
print(‘3 秒内光照强度 / brightness level in 3 second:’ + str(lux_avg))
print(‘3 秒内震动次数 / vibrations detected in 3 seconds:’ + str(vibration_count) + ‘ ‘)
print(‘结果 / Result:’ + result[0] + ‘\n’)
result_file = open(‘E:\Result.dat’, ‘w’, encoding=’utf-8′)
result_file.write(result[0] + ‘\n’ + result[1])
if delta_time > 10:
vibration_count = 0

[1] All software used in this prototype runs on Windows 7 with Service Pack 1, x64. Source and sample codes should be able to run on other platform but I cannot guarantee that.
[2] An UNIX time stamp is a number, usually an integer indicating the seconds past since GMT 0:00, January 1, 1970.
[3] If an absolute path is not given like in the sample code, Processing would search for the given file in the ‘data’ folder in the directory where the source code is saved in.
[4] To find the hex code of a character, try using WinHex or other hex-based editor. Always remember that your use of these software should abide by their EULA.
[5] Python does not have a default path to search for the given file and an absolute path is thus necessary.
[6] The use of Roboto Light font in this prototype abides by the Apache Licence 2.0. Anyone else who uses this piece of sample code should either accept the licence of Roboto font or use another licensed font.


What is interactivity? The way people interact with each other, the way people interact with machines and even the way machines interact with machines, in my point of view.
Compared with primitive times, nowadays technology equipped us with tools to make life more convenient, connected and therefore make interactivity more complicated and sophisticated than what is used to be. At the beginning, there is no currency at all, and people interact with each other by trading there own goods. Later in times, there appears a common good for trading, gold or coins, which due to its inconvenience gives rise to paper currency and we used nowadays. Even today, one doesn’t need to carry a lot of cash around but usually a visa and union pay card. What’s more absurd is 12/12 when Ali pay announced its discount by using phone with scanning a code, one can clearly see people in family mart all holding a cell phone trying to scan it. This is how people interact with purchasing good, and this is how interactivity matters closely to all daily life. The same is true of communication which a long time ago people would travel 2 days to visit another person or to send an important message whereas in nowadays a merely phone call would solve all the problems. This is also achieved by the design of interactivity. Your finger gesture to trigger a program on a computer, your swipe the screen to open an iPhone, even your clicking a button to go to a certain floor on an elevator. This is an ever changing, exciting and challenging industry which closely impact on the way people react and live. This interaction is mutual, when we are communicating with a device or a person they are communicating back with us and this interaction is itself very interesting to look at and needs taken both parties into consideration.
I believe the purpose of interaction lab is not only just taught the tools to design an interaction but more of the creative and innovative ideology behind. To think about interactivity all the time, to break the cliches, to be interesting. The tools themselves are limited but the thoughts and combination are totally limitless. For my final project I started by considering all the facilities I saw in a big game centre, dancing machine, driving car machine, or riding horses and I found all these games have something in common, their interactions are limited to only hands and legs and I begin to wonder if there are physical games designed that can involve something with head or mouth, by blowing a fire? There are even times when the consideration of interactivity goes crazy: Our interaction with our teeth is that we brush them, what if someday we don’t and what would that interaction be? There thoughts seemingly ridiculous and doesn’t sound much of an importance, however, are the first step of interactivity. Being a good interaction designer requires this constant nonstop consciousness with these stupid questions and it is by one thousand stupid assumptions and interactivity designs that one good powerful are born and change the whole world.