W11 assignments

Assignments

Assignment 1:

P5 Code snippet:

function readSerial(data) {
  ////////////////////////////////////
  //READ FROM ARDUINO HERE
  ////////////////////////////////////

  if (data != null) {
    // make sure there is actually a message
    // split the message
    let fromArduino = split(trim(data), ",");

    // if the right length, then proceed
    if (fromArduino.length == 1) {
      // only store values here
      // do everything with those values in the main draw loop
      
      // We take the string we get from Arduino and explicitly
      // convert it to a number by using int()
      // e.g. "103" becomes 103
      
      
      potentiometerInput = int(fromArduino[0]);
      
      //Maps the potentiometer input value to the width of the canvas.
      circleX = map(potentiometerInput,0,1023,0,width);


      
    }
    let sendToArduino = "\n";
    writeSerial(sendToArduino);
    
  }
}

Arduino code snippet:

void setup() {

  Serial.begin(9600);

  // start the handshake
  while (Serial.available() <= 0) {
    digitalWrite(LED_BUILTIN, HIGH); // on/blink while waiting for serial data
    Serial.println("0,0"); // send a starting message
    delay(300);            // wait 1/3 second
    digitalWrite(LED_BUILTIN, LOW);
    delay(50);
  }
}

void loop() {
  // wait for data from p5 before doing something
  while (Serial.available()) {
    digitalWrite(LED_BUILTIN, HIGH); // led on while receiving data
      
      delay(5);
       if (Serial.read() == '\n') {
      int potentiometer = analogRead(A1);
      delay(5);
      Serial.println(potentiometer);
      Serial.print(',');
      Serial.println(potentiometer);
       }
    }
      digitalWrite(LED_BUILTIN, LOW);
  }

 

Assignment 2: Video2

Code snippet Arduino:

while (Serial.available()) {
    Serial.println("0,0");
    digitalWrite(LED_BUILTIN, HIGH); // led on while receiving data

    int value = Serial.parseInt();
    int value2 = Serial.parseInt();

    if (Serial.read() == '\n') {
      analogWrite(ledPin, value);
      analogWrite(ledPin2, value2);
    }
  }

p5 snippet:

function readSerial(data) {
  if (data != null) {
    //////////////////////////////////
  //SEND TO ARDUINO HERE (handshake)
  //////////////////////////////////
  value = int(map(mouseY,0, height, 0, 255));
  value2 = int(map(mouseX,0, width, 0, 255));
  let led1 = value + "\n";
  let led2 = value2 + "\n";
  writeSerial(led1);
  writeSerial(led22);
  print(value);
  print(value2)
    
    
  }

Assignment 3: video3

Arduino snippet:

void loop() {

  // wait for data from p5 before doing something
  while (Serial.available()) {

    // led on while receiving data
    digitalWrite(LED_BUILTIN, HIGH); 

    // gets value from p5
    int value = Serial.parseInt();

    // led switch from p5 value input
    if (Serial.read() == '\n') {
      if (value == 1) {
        digitalWrite(ledPin, HIGH);
      }
      else {
        digitalWrite(ledPin, LOW);
      }
      
      // gets sensor value
      int sensor = analogRead(A0);
      delay(5);

      // sends sensor value to p5
      Serial.println(sensor);
    }
  }

  digitalWrite(LED_BUILTIN, LOW);
  
}

 

Reading response

Response:

We don’t typically discuss how disability influences design, so this was a very intriguing topic. Indeed, it was fascinating to observe how he connected glasses to disabilities, which influenced the creation of what we now refer to as eyewear.  The author went on to discuss various disabilities and the medical equipment associated with them, as well as how fashion has improved their overall appearance and design. Graham Pullin talks about how important it is to make things like wheelchairs and hearing aids look good and easy to use for people with disabilities. He suggests calling them “chairwear” and “hearwear” to make them seem more like regular things you’d buy, not just medical stuff. But there’s a worry that making these things fashionable might make them more expensive, which could be a problem for people who don’t have a lot of money. Pullin doesn’t talk much about how to keep these cool designs affordable for everyone who needs them. He mentions how glasses used to be cheap for everyone, but now they can cost a lot because they’re seen as a fashion accessory. It’s important that making things look good doesn’t make them too pricey for people who really need them. There should be a balance between looking nice and being affordable for everyone who needs these tools.

Final project ideas

Ideas workspace:

For my final project, I’m considering several ideas but haven’t settled on one yet. One concept is to develop a memory pattern game, similar to the one where you observe a sequence of colors and replicate it in the same order, sometimes with timed intervals between each color—a classic memory challenge. Another option involves utilizing an ultrasonic sensor attached to a servo motor, scanning a 180-degree area to create a game where the player must accomplish a task without triggering detection on the “radar.” Another idea I’m really keen on exploring involves integrating Arduino and sensors to enhance my ongoing midterm project, which took weeks and weeks of work. These are just a few ideas I have for now that I need to look further into.

WEEK 10 – Piano / Synthesizer

 

Piano / Synthesizer

For this project, our goal was to craft a musical instrument within the constraints of limited resources. Despite the restricted options, we brainstormed various concepts and ultimately settled on developing a hybrid piano/synthesizer. To accomplish this, we repurposed buttons as keys by integrating two types of sensors, analog and digital. Using a breadboard, we configured the keys and delved into the coding phase. Each button was programmed to generate distinct notes, connected to a borrowed speaker from the IM lab for clearer and better sound quality.

As we progressed with the initial setup, the need for an analog sensor arose. We incorporated a potentiometer, not to alter the current, but as a knob to modulate the notes produced by the four buttons. The potentiometer’s range was segmented into three sections, and within the programming loop, an ‘if-else’ construct acted akin to cases, adjusting the notes played in response to the potentiometer’s adjustments.

THE VIDEO

The Code

#include "pitches.h"


const int speaker = 12;


const int tone_G = 2;
const int tone_A = 3;
const int tone_B = 4;
const int tone_C = 5;
const int tone_D = 9;
const int tone_E = 10;
const int tone_F = 11;




int buttonState_G = 0;
int buttonState_A = 0;
int buttonState_B = 0;
int buttonState_C = 0;
int buttonState_D = 0;
int buttonState_E = 0;
int buttonState_F = 0;


int potPin = A0;
int potVal = 0;




void setup() {
 // iterate over the notes of the melody:
 pinMode(tone_G, INPUT);
 pinMode(tone_A, INPUT);
 pinMode(tone_B, INPUT);
 pinMode(tone_C, INPUT);
 pinMode(tone_D, INPUT);
 pinMode(tone_E, INPUT);
 pinMode(tone_F, INPUT);
 
 }


void loop() {
 // no need to repeat the melody.


 potVal = analogRead(potPin);




 buttonState_G = digitalRead(tone_G);
 buttonState_A = digitalRead(tone_A);
 buttonState_B = digitalRead(tone_B);
 buttonState_C = digitalRead(tone_C);
 buttonState_D = digitalRead(tone_D);
 buttonState_E = digitalRead(tone_E);
 buttonState_F = digitalRead(tone_F);


if (potVal < 341)  // Lowest third of the potentiometer's range (0-340)
 {   
 if (buttonState_G == HIGH) {
   // play the sound
   tone(speaker,NOTE_G4);
 }
 else if (buttonState_A == HIGH) {
   // play the sound
   tone(speaker,NOTE_AS4);
 }
 else if (buttonState_B == HIGH) {
   // play the sound
   tone(speaker,NOTE_F4);
 }
 else if (buttonState_C == HIGH) {
   // play the sound
   tone(speaker,NOTE_C3);
 }


 else
  {
   noTone(speaker);
   }
 }


 else if (potVal < 682)  // Lowest third of the potentiometer's range (0-340)
 {
   if (buttonState_G == HIGH) {
   // play the sound
   tone(speaker,NOTE_A4); //random note not matching the name
 }
 else if (buttonState_A == HIGH) {
   // play the sound
   tone(speaker,NOTE_B4); //random note not matching the name
 }
 else if (buttonState_B == HIGH) {
   // play the sound
   tone(speaker,NOTE_C4); //random note not matching the name
 }
 else if (buttonState_C == HIGH) {
   // play the sound
   tone(speaker,NOTE_D4); //random note not matching the name
 }


 else
  {
   noTone(speaker);
   }


 }


 else
 {
   if (buttonState_G == HIGH) {
   // play the sound
   tone(speaker,NOTE_AS4);
 }
 else if (buttonState_A == HIGH) {
   // play the sound
   tone(speaker,NOTE_FS4);
 }
 else if (buttonState_B == HIGH) {
   // play the sound
   tone(speaker,NOTE_GS4);
 }
 else if (buttonState_C == HIGH) {
   // play the sound
   tone(speaker,NOTE_CS3);
 }


 else
  {
   noTone(speaker);
   }
 }
  
 }

 

Week 10 – response

Weekly Response

We’ve made significant strides in achieving much of what was demonstrated, but it hasn’t reached the level of convenience we hoped for. Take Siri on iPhones, for instance. Despite its heavy advertisements, it’s not as frequently used in reality and isn’t convenient enough to be  highlighted as an important feature. Its limited usability in public or noisy settings restricts its practicality. Similarly, the flashy concept of drawing in the air showcased in the video lacks real-world applicability. In professional settings, more practical, industrial-grade alternatives would likely be preferred.

However, considering the video was made nine years ago, it serves as a benchmark for our progress toward the creator’s vision. The idea of a singular device for all tasks is closer to reality today. Many functionalities showcased, like summoning a taxi, scheduling appointments, using voice commands for messages, and even unlocking a Tesla car, are now accessible through modern phones. While data isn’t projected on transparent glass yet and smart glasses aren’t widely available, we’re moving towards more advanced technologies where convenience triumphs over merely looking impressive. The focus is shifting to inventions that truly serve convenience rather than flashy devices with limited practicality.

Talk Reflection

 

Reflection

Prof Neil did an amazing job connecting the lines drawing the fuller picture of AI from his perspective. He started by giving a brief intro about AI and its emergence then started sharing some insights about how AI functions simplifying it with visual aid and explanation using examples making it easier to grasp the fuller picture.

The introduction, though aimed at introducing AI to those unfamiliar with it, felt overly lengthy and unengaging. Given that the audience consisted of university students well-versed in AI and its applications, spending more than half the lecture on this basic introduction seemed unnecessary and not relevant to their level of knowledge and daily use of AI.

Geoffrey Hinton’s video on the other hand was incredibly insightful, particularly regarding the concept of AI being smarter than humans because of its ability to share information. This idea resonated and truly made sense to me. It stands out as the most compelling argument I’ve encountered because it highlights how AI’s capacity to accumulate knowledge differs significantly from humans. Instead of the lengthy process of teaching each generation from scratch and hoping for marginal contributions over decades, AI’s continuous accumulation and building upon existing knowledge make it vastly smarter compared to humans.

Week 9: Parking sensor

THE Parking sensor

For this project, we had only two sensor options: the LDR or the ultrasonic sensor. Since we’d already used the LDR before, I wanted to try out something new. So, I looked into the ultrasonic sensor and started working with it. While brainstorming, I came up with various game ideas that used the sensor, but they needed a screen, which wasn’t allowed for this assignment. After more research on ultrasonic sensors, I found they could work well as a car parking alarm to help drivers avoid hitting obstacles. I started writing the code and set up a variable called “time_delay” to control how fast the LED blinks. To make it more like a real parking sensor, I decided to add a buzzing sound and found out how to connect a buzzer to the setup. With these changes, I made a working parking sensor. To meet the assignment’s requirements for a switch and a second LED, I made a switch that, when pressed, turns on a bulb that matches its color.

THE CODE:

const int trigPin = 9;
const int echoPin = 10;

int led = 5;

long duration;
int distance;

const int buzzer = 13;

const int buttonPin = 2;  // the number of the pushbutton pin
const int ledPin = 8; // the second light

int buttonState = 0; // button bool

void setup() {
  // put your setup code here, to run once:
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  
  pinMode(led, OUTPUT); //light
  pinMode(buzzer, OUTPUT); // buzzer

 
  pinMode(ledPin, OUTPUT); // initialize the LED pin as an output
  pinMode(buttonPin, INPUT);  // initialize the pushbutton pin as an input
  

  Serial.begin(9600);


}

void loop() {
  //sending the audio pulses
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
//calculating distance
  duration = pulseIn(echoPin, HIGH);
  distance= duration*0.034/2;

//the warning rate
  float time_delay= (distance *3) +30;

  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }

  if(distance < 50)
  {
    //the warning / buzzing rate
    digitalWrite(buzzer, HIGH);
    analogWrite(led,0);
    delay(time_delay);
    digitalWrite(buzzer,LOW);
    analogWrite(led,255);

  }
  
  else{
    digitalWrite(led, LOW);
    noTone(buzzer);
  }

  //for feedback
  Serial.print("Distance: ");
  Serial.println(distance);


}

 

This is how it looked like

Video:

 

Week 9: Reading Reflection

This might have been the first time I hear this opinion out loud, I always tried to create interactive art works independent and sufficient for the user to be immersed without any prior information or explanation. I totally agree on the idea that an artist need not explain their pov or their vision of the project as a primary part of the experience. “The thing you build, whether it’s a device or a whole environment, is just the beginning of a conversation with the people who experience your work.” Is a statement that caught my attention. In previous classes we discussed the definition of interaction and a definition that we came up with is “the exchanged interaction between two mediums” which is facilitated in conversations for example, hence it is well said that the interaction between the user and the project is like a conversation that one might say between the artist vision portrayed by the project and the user.

I agree with the second reading on “Physical Computing’s Greatest Hits and Misses.” The idea that the next big thing hasn’t come around yet is because people tend to give up on ideas they think have already been done and can’t be improved. The examples in the reading show that you can take something existing, use your creativity and imagination, and turn it into something new. It’s like how we use materials around us to create things – in the same way, we can use existing inventions as a starting point to build upon. The reading emphasizes the importance of not dismissing ideas too quickly and instead seeing them as opportunities to add something unique. By adopting this mindset, we can uncover new possibilities within familiar concepts, contributing to technological advancements and innovative solutions.

Week 8 – BubbleSweeper

BubbleSweeper

While exploring various methods for devising an inventive switch, I transitioned from the concept of utilizing a door to open and close a switch to envisioning a scenario where a frisbee, upon striking a target, completes the circuit and illuminates a bulb. My mind was brimming with numerous concepts, yet the one that particularly delighted me was the idea of crafting a game. After contemplating various potential game options, I settled on Minesweeper, a universally recognized game that can be enjoyed by individuals or groups. The optimal platform for realizing this game, in my view, is a bubble fidget toy, which features numerous bubbles resembling the grid of squares in a traditional Minesweeper game. One bubble is equipped with two wires, and when this bubble is pressed during the game, it connects both wires, thereby closing the circuit and activating the light resembling a bomb.


below is the image of the project (thought of making it look a bit commercial :p )


anyways, here’s the demo:

VIDEO

I wanted to feature two people play the game to show how it’s a blast for a pair of players, but you get the idea. It was a bit of a tough nut to crack at the beginning, Getting those wires in the right spots and dealing with that stubborn tape not sticking properly to the rubbery toy body made things way trickier than they should’ve been. But you know what? After a few trial-and-error sessions, I finally got those wires snug and secure.

Week 8 – Reflection

The human tendency to prioritize appearance when evaluating various aspects of life is undeniable. Whether it’s people, cars, clothing, destinations, smartphones, or even cuisine, visual appeal plays a prominent role in our judgments. Strikingly, aesthetics have overshadowed the intrinsic value of things in some cases, particularly in the world of business. For instance, a product, identical in functionality, can attract a different customer base based solely on how it is presented – be it in a practical or luxurious manner. This phenomenon has extended the age-old adage, “Don’t judge a book by its cover,” beyond books themselves. It now applies to both human beings and machines. Regardless of our reluctance to admit it, appearances wield immense influence, often shaping the initial and most crucial impression we form. This truth underscores the significance of visual aesthetics in our lives, as they continue to guide our choices and perceptions. The article “ Emotion & Design: Attractive Things Work Better” by Donald Arthur the American professor discuss this phenomenon and took the argument to a new level of analyzing why this is the case. He provides examples that highlight how our emotions influence decision-making, such as the contrast between happy and tense individuals when completing tasks. This analysis not only reveals the impact of emotions on decision-making but also emphasizes the importance of aesthetics and emotional appeal in the functionality of objects and systems.