Final Project Presentation

Concept

Inspired by “GarageBand”, an application on Apple devices, I wanted to create an interface that allows the users to play musical instruments wherever they are at. As the title of the program suggests (“Corner of the Room Band”), the goal of this interaction was to provide access to instruments whether the users are in their room or anywhere else. When I was younger, I used to play with GarageBand. While it provided access to instruments such as piano and drum, I always hoped a different instrument to be added. However, my hope was not met through GarageBand and hence my project was made to satisfy my desire.

User Test

After I have built and created the project, I asked my friend to use the program. The video and image below illustrates my friend using the program:

User Testing

After the user testing, I made no big changes to p5 or Arduino because everything was pretty much set. My friend successfully navigated and used the program without difficulties.

Implementation

The overall interaction looks like this: p5 changes pages or the “gameState”, buttons on Arduino sends signal to p5 when pressed, sound files that correspond to each button is played through the laptop.

More precisely, the user navigates through different pages by clicking on the screen made through p5. When the user enters either the piano or flute page, sound files that are tied to each button on Arduino will be played when pressed. The potentiometer on Arduino is used to control the volume of the sound that is projected through the laptop.

  1. p5.js

For this project, p5 was heavily used. It was used to create the game interface and to call up the sounds files of each instrument. Although p5 was mainly used to code for the project, nothing too complex or complicated was performed.

function homePage () {
  imageMode(CORNER);
  image(homeImg, 0, 0, windowWidth, windowHeight);
  
  //start button
  fill('white');
  rectMode(CENTER);
  rect(windowWidth / 2, windowHeight * 0.8, windowWidth * 0.11, windowWidth * 0.05,30);
  
  //start button text
  fill('black');
  strokeWeight(3);
  textSize(windowWidth / 30);
  text("Start", windowWidth / 2.14, windowHeight * 0.812);
}

Like the code shown above, I created functions for the different pages of the project. Under each function, I made buttons that would help the users navigate through the interface.

function mousePressed () {
  //transitioning from home page to inst. page
  if (gameState == "home" && 
    mouseX > windowWidth / 2 - windowWidth * 0.2 &&
    mouseX < windowWidth / 2 + windowWidth * 0.2 &&
    mouseY > windowHeight * 0.8 - windowWidth * 0.05 &&
    mouseY < windowHeight * 0.8 + windowWidth * 0.05
    ) {
      gameState = "inst";
  }

Function mousePressed was written to actually allow the user to transition from one page to another by clicking on the buttons that were created previously.

function serialEvent() {
  //chords
  playC=int(fromArduino[0])
  playD=int(fromArduino[1])
  playE=int(fromArduino[2])
  playF=int(fromArduino[3])
  playG=int(fromArduino[4])
  volume=int(fromArduino[5])
  
  // Check if the message is "ButtonC"
  if (playC==0 && gameState == "piano") { 
    
    //controlling the volume 
    pianoC.setVolume (realVolume);
    
    // Play the pianoC sound file
    if (pianoC.isPlaying()) {
      // Stop the sound if it's already playing
      pianoC.stop();
    }
    pianoC.play();
  }
  

  // Check if the message is "ButtonD"
  if (playD==0 && gameState == "piano") { 
    
    //controlling the volume 
    pianoD.setVolume (realVolume);
    
    // Play the pianoD sound file
    if (pianoD.isPlaying()) {
      // Stop the sound if it's already playing
      pianoD.stop(); 
    }
    pianoD.play();
  }
  
  
  // Check if the message is "ButtonE"
  if (playE==0 && gameState == "piano") { 
    
    //controlling the volume 
    pianoE.setVolume (realVolume);
    
    // Play the pianoE sound file
    if (pianoE.isPlaying()) {
      // Stop the sound if it's already playing
      pianoE.stop(); 
    }
    pianoE.play();
  }
  
  
  // Check if the message is "ButtonF"
  if (playF==0 && gameState == "piano") { 
    
    //controlling the volume 
    pianoF.setVolume (realVolume);
    
    // Play the pianoF sound file
    if (pianoF.isPlaying()) {
      // Stop the sound if it's already playing
      pianoF.stop(); 
    }
    pianoF.play();
  }
  
  
  // Check if the message is "ButtonG"
  if (playG==0&& gameState == "piano") { 
    
    //controlling the volume 
    pianoG.setVolume (realVolume);
    
    // Play the pianoC sound file
    if (pianoG.isPlaying()) {
      // Stop the sound if it's already playing
      pianoG.stop(); 
    }
    pianoG.play();
  }

The code above is what is essential to the project and what I am proud of. Using the data received from Arduino (which tells p5 when a certain button is pressed and what the value of the potentiometer is), p5 plays the sound file and controls the volume of the sound being projected. For instance, when p5 understands that ButtonC on Arduino is pressed at the same time the gameState is “piano“, a sound file “pianoC” will be played.  The same thing was done for other notes and the flute.

//this is under function draw ()

//mapping the range of the volume
 realVolume = map(volume, 0, 1023, 0.0, 1.0);
 print(realVolume);

Furthermore, using the value collected by potentiometer in Arduino, the value was mapped to fit in the range of the volume on p5.

function readSerial(data) {
  ////////////////////////////////////
  //READ FROM ARDUINO HERE
  ////////////////////////////////////
  if (data != null) {
     fromArduino = split(trim(data), ",");
     message = fromArduino;
     //print(message);
     serialEvent ();      
    }

Lastly, using function readSerial, p5 read the data sent from Arduino and used the data to perform the tasks mentioned above.

Home page:

Inst page:

Piano page:

Flute page:

2. Arduino

With Arduino, buttons and potentiometer were used. Each button pin was given a const int name that corresponded to its pin number and each button an int name that digital reads the information from its pin. For example, the button for the note C was plugged into pin no. 2 (const int buttonCPin) and the data collected from pin no. 2 (int ButtonC) was used to send a string of information to p5.

Furthermore, const int potPin was used to collect data from A0, which is where potentiometer was connected. Then int volume was used to analog read the potentiometer value which was sent to p5 as a string.

//Define the button pins
const int buttonCPin = 2;
const int buttonDPin = 3;
const int buttonEPin = 4;
const int buttonFPin = 5;
const int buttonGPin = 6;
const int potPin = A0;
char button = 0;


void setup() {
  // Set the button pins as input with internal pull-up resistor
  pinMode(buttonCPin, INPUT_PULLUP); 
  pinMode(buttonDPin, INPUT_PULLUP);
  pinMode(buttonEPin, INPUT_PULLUP);
  pinMode(buttonFPin, INPUT_PULLUP);
  pinMode(buttonGPin, INPUT_PULLUP);
  // Initialize serial communication
  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() {
  while (Serial.available()) {
    digitalWrite(LED_BUILTIN, HIGH); // led on while receiving data
  int volume = analogRead(potPin); // Read the potentiometer value

//creating int and string to send to p5.js
int ButtonC = digitalRead(buttonCPin);
int ButtonD = digitalRead(buttonDPin);
int ButtonE = digitalRead(buttonEPin);
int ButtonF = digitalRead(buttonFPin);
int ButtonG = digitalRead(buttonGPin);

  Serial.println(String(ButtonC) + "," + String(ButtonD) + "," + String(ButtonE)+ "," +String(ButtonF) + "," + String(ButtonG)+ "," + String(volume)); 
  }

  }

As the code above shows, code for Arduino is comparatively short. It simply reads signal from the pins of the button and the potentiometer and creates a string to send to p5.

Aspects of the Project that I am Proud of

First, I am glad I changed from using the speaker on Arduino to the PC speaker. The sound quality was poor when projected through the small speaker on Arduino and to enhance the sound quality and user experience, I removed the Arduino speaker and used the PC speaker instead.

Second, using string to communicate data between p5 and Arduino was very convenient and helpful. If I were to use other methods, the code for both p5 and Arduino would have been longer. However, because I used strings, the data that is being sent from Arduino to p5 was concise and very organized. In this way, when I printed the data on p5, I received one array with all the information I need to run the interaction.

Also, I am proud of the console/button box that I created. While it is a very simple box with the buttons attached, the box is well designed to fit the theme of the project.

Below are pictures that show the process of building the box:

Challenged Faced and How I Overcame Them

Initially, I was going to use the potentiometer to control the frequency of the musical notes. However, I changed my plan and used it to control the volume instead because I could not find Arduino sound files that plays the flute sound. Therefore, I had to upload piano and flute sound files on p5, which prohibits the control of the frequency. Although I had to give up controlling the frequency of the sound, controlling of the volume seems like a good replacement of what the potentiometer could do.

Also, I struggled to write the code for controlling the volume on p5. Now that I have written all the code, the code for controlling the volume is actually very simple. The mistake I made was not mapping the range of the volume. From Arduino, values ranging from 0-1023 was being sent to p5 and in order for me to use this value to control the volume, I had to map it so that it fits under the range of 0-1. After I had this code written, I was able to control the volume.

Lastly, I encountered difficulties finding sound flies. At first, my plan was to have piano and guitar on the program. However, I was not able to find a good sound file for the guitar on the internet. Therefore, I changed the guitar to flute instead and successfully found sound files for the flute.

Areas for Future Improvement

For improvements, I would like to add more buttons so that the user can play more various musical notes. As of now, I only used 5 buttons for the first 5 musical notes (C, D, E, F, G). If I could add more buttons, more various sounds would be playable, enhancing user experience.

Also, I would like to add more instruments on the program. For now, there are only piano and flute but if I had more time and if more sound files were available, then I would like to add more instruments such as the drum, guitar, and trumpet.

Additionally, if I could remake the box, I would like to use laser cutting to create a more solid and neat box. Although the current box performs all the necessary tasks, it can fall apart in any moment because cardboard instead of plywood or acrylic was used. Therefore, I would like to improve the box by using laser cutting to create a more strong and durable box.

One thing that bothers me a little with my project is the delay or lag in the play of the sound files. When the user presses a button on Arduino, the corresponding sound file does not play immediately and hence creates a gap. I removed all delay functions on Arduino and checked individual sound files on p5, but for some reason, the delay between the button press and play of the file did not resolve.

Schematics

IM Showcase

IM Showcase

During the showcase, I was able to explain and display my final project to many people. Due to the loud noise in the arts center, I had to borrow a set of headphones so that the users can clearly hear the sounds. Many people liked the flute sound and were entertained by the interaction. I also had so much fun experiencing the works of peers. Everyone had such an interesting project and overall, the IM Showcase was a great opportunity to share our skills, talents, and projects.

Final Project – Draft 1

Idea Proposal & Inspiration

For the final project, my goal is to create digital musical instruments. My inspiration came from GarageBand which is an application found on Apple devices. For me, I used this app to play the piano. While this app met my desire to play the piano, I always wished the app provided more instruments. For instance, if I want to play the guitar online, I had to download a separate application. This created inconvenience and took up a lot of storage on my device. Therefore, the product of this project will allow the users to play the instrument of their choice on one interface.

Components

Main materials: p5, Arduino, potentiometer, buttons, and speaker.

I will be using potentiometer to allow the users to control the volume of the sound that is projected through the speaker and buttons to play the musical notes. These components will be connected to the Arduino.

I will be using p5 to display the interface. On the screen, options of instruments will be displayed and once the user chooses an instrument, a zoom-in shot of the instrument will be depicted.

Something like this:

For the interaction or the handshake between Arduino and p5, when the user selects an instrument by clicking on the screen, p5 will send this information to Arduino and call up the sound file that corresponds to the selection. Then when the user presses a button, the corresponding sound will be played through Arduino.

Other Thoughts

As of now, the instruments that I am thinking of include piano, drum, flute and guitar. However, this will depend on the availability of the sound files.

My concern for this project is that my project is heavy code based. I see myself spending a lot of time on coding and I hope I don’t encounter a lot of difficulties with the code.

Assignment 8: Handshake Exercises

Partner: Hyein Kim

EXERCISE 01: ARDUINO TO P5 COMMUNICATION: Make something that uses only one sensor on Arduino and makes the ellipse in p5 move on the horizontal axis, in the middle of the screen, and nothing on Arduino is controlled by p5.

To complete this exercise, we built a simple circuit as illustrated below. We used the photocell to control the horizontal movement of the ball in p5.

Exercise 1 Illustration

As it is shown in the code for Arduino, most of it is similar to that of the one provided to the class. The things we changed are mostly done inside the void loop(). Since the Arduino is sending information to p5, we readjusted the code so that data is sent unidirectionally to p5: the value collected in A0 from the photocell is sent to p5.

Arduino code:

int leftLedPin = 2;
int rightLedPin = 5;


void setup() {
 // Start serial communication so we can send data
 // over the USB connection to our p5js sketch
 Serial.begin(9600);


 // We'll use the builtin LED as a status output.
 // We can't use the serial monitor since the serial connection is
 // used to communicate to p5js and only one application on the computer
 // can use a serial port at once.
 pinMode(LED_BUILTIN, OUTPUT);


 // Outputs on these pins
 pinMode(leftLedPin, OUTPUT);
 pinMode(rightLedPin, OUTPUT);


 // Blink them so we can check the wiring
 digitalWrite(leftLedPin, HIGH);
 digitalWrite(rightLedPin, HIGH);
 delay(200);
 digitalWrite(leftLedPin, LOW);
 digitalWrite(rightLedPin, LOW);


 // 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
     int sensor = analogRead(A0);
     delay(5);
     Serial.println(sensor);
 }

On p5, we drew an ellipse and initialized a variable ‘xposition’ that is used to move the horizontal position of the ball. Then under ‘if (data != null) {}’, we set the xposition = data where data refers to the value that is collected and sent from Arduino. This data is used to change the xposition of the ball in p5. 

p5 code:

let rVal = 0;
let alpha = 255;
let xposition = 100;


function setup() {
  createCanvas(640, 480);
  textSize(18);
}


function draw() {
  // one value from Arduino controls the background's red color
  background(map(rVal, 0, 1023, 0, 255), 255, 200);


  ellipse(xposition, height/2, 50, 50);
  
  // the other value controls the text's transparency value
  fill(255, 0, 255, map(alpha, 0, 1023, 0, 255));


  if (!serialActive) {
    text("Press Space Bar to select Serial Port", 20, 30);
  } else {
    text("Connected", 20, 30);
    // Print the current values
    text('rVal = ' + str(rVal), 20, 50);
    text('alpha = ' + str(alpha), 20, 70);
  }


function keyPressed() {
  if (key == " ") {
    // important to have in order to start the serial connection!!
    setUpSerial();
  }
}


// This function will be called by the web-serial library
// with each new *line* of data. The serial library reads
// the data until the newline and then gives it to us through
// this callback function
function readSerial(data) {
  ////////////////////////////////////
  //READ FROM ARDUINO HERE
  ////////////////////////////////////


  if (data != null) {
    // make sure there is actually a message
    // split the message
    xposition = data;
    }


    //////////////////////////////////
    //SEND TO ARDUINO HERE (handshake)
    //////////////////////////////////
    let sendToArduino = left + "," + right + "\n";
    writeSerial(sendToArduino);
  }

EXERCISE 02: P5 TO ARDUINO COMMUNICATION: Make something that controls the LED brightness from p5.

For this exercise, we utilized the position of mouseX from p5 to control the brightness of the LED on Arduino. The circuit we made looks like this: 

circuit 2

Exercise 2 Illustration

Here, Arduino receives information from p5 and changes the brightness of the LED. Under void loop(), we used the map function to convert the values to PWM range and used analogWrite to set the LED brightness according to the value received from p5. 

Arduino Code:

int LEDpin = 3;  // Ensure this pin supports PWM
void setup() {
 Serial.begin(9600);
 pinMode(LED_BUILTIN, OUTPUT);
 pinMode(LEDpin, OUTPUT);


 // Initial blink to confirm working setup
 digitalWrite(LEDpin, HIGH);
 delay(200);
 digitalWrite(LEDpin, LOW);


 // Wait for initial data before proceeding
 while (Serial.available() <= 0) {
   digitalWrite(LED_BUILTIN, HIGH);  // Blink LED to indicate waiting for connection
   Serial.println("0,0");  // Send a starting message
   delay(300);
   digitalWrite(LED_BUILTIN, LOW);
   delay(50);
 }
}


void loop() {
 if (Serial.available() > 0) {
   digitalWrite(LED_BUILTIN, HIGH);  // LED on while receiving data
   int bright = Serial.parseInt();
   bright = map(bright, 0, 640, 0, 255);  // Adjust received value to PWM range


   if (Serial.read() == '\n') {
     analogWrite(LEDpin, bright);  // Set LED brightness
   }
   digitalWrite(LED_BUILTIN, LOW);  // Turn off status LED after handling data
   Serial.println(0);
 }
}

In p5, we used mouseX and its position on the canvas to control the brightness of the LED on Arduino. We initialized a variable LEDbright to 0 but then let it change according to the if statement. If mouseX <= width && mouseX >= 0 && mouseY <= height && mouseY >= 0 , then the variable LEDbright is mouseX and this data is then sent to Arduino which controls the brightness of the LED. However, if the condition is not satisfied, then the variable LEDbright remains 0. Simply put, the LED lights up brighter when the mouse is on the right side of the screen and dimmer when it is on the left side of the screen. 

p5 code:

let LEDbright = 0;

function setup() {
  createCanvas(640, 480);
  textSize(18);
}

function draw() {
  
  background(205);

  // the other value controls the text's transparency value
  fill(0)

  if (!serialActive) {
    text("Press Space Bar to select Serial Port", 20, 30);
  } else {
    text("Connected", 20, 30);

  }

  // when clicked, digital LED will turn on,
  // other analog write LED will have brightness corresponding to the height of the mouse when it is press. can be pressed and dragged for controlling brightness
  if (mouseX <= width && mouseX >= 0 && mouseY <= height && mouseY >= 0) {
      LEDbright = mouseX;
  } else {
    LEDbright = 0;
  }
}

function keyPressed() {
  if (key == " ") {
    // important to have in order to start the serial connection!!
    setUpSerial();
  }
}

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

    //////////////////////////////////
    //SEND TO ARDUINO HERE (handshake)
    //////////////////////////////////
    
    //send the posiiton of mouseY when clicked to control brightness
    let sendToArduino = LEDbright + "\n";
    writeSerial(sendToArduino);

}

EXERCISE 03: BI-DIRECTIONAL COMMUNICATION: Take the gravity wind example and make it so: every time the ball bounces one led lights up and then turns off, and you can control the wind from one analog sensor.

To complete this assignment, we used a potentiometer as an input to control wind and an LED as an output controlled by the bouncing ball in p5.js.

Exercise 3 Illustration

p5 code:

let velocity;
let gravity;
let position;
let acceleration;
let wind;
let drag = 0.99;
let mass = 50;
let light = 0;

function setup() {
  createCanvas(640, 360);
  noFill();
  position = createVector(width/2, 0);
  velocity = createVector(0,0);
  acceleration = createVector(0,0);
  gravity = createVector(0, 0.5*mass);
  wind = createVector(0,0);
}

function draw() {
  background(255);
  applyForce(wind);
  applyForce(gravity);
  velocity.add(acceleration);
  velocity.mult(drag);
  position.add(velocity);
  acceleration.mult(0);
  fill('black')
  
   if (!serialActive) {
    text("Press Space Bar to select Serial Port", 20, 30);
  } else {
    ellipse(position.x,position.y,mass,mass);
  if (position.y > height-mass/2) {
      velocity.y *= -0.9;  // A little dampening when hitting the bottom
      position.y = height-mass/2;
    light=1
    
    }
    else{
      light=0
    }
  }
}

function applyForce(force){
  // Newton's 2nd law: F = M * A
  // or A = F / M
  let f = p5.Vector.div(force, mass);
  acceleration.add(f);
}

function keyPressed() {
  if (key == " ") {
    // important to have in order to start the serial connection!!
    setUpSerial();
  }
}


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
      
      let sensorValue = int(fromArduino[0]);
      wind.x = map(sensorValue, 0, 1023, -1, 1);
    }
    }
    

    //////////////////////////////////
    //SEND TO ARDUINO HERE (handshake)
    //////////////////////////////////
    let sendToArduino = light + "\n";
    writeSerial(sendToArduino);
  }

Arduino code:

int LEDpin = 2;
int wind = A0;

void setup() {
  // Start serial communication so we can send data
  // over the USB connection to our p5js sketch
  Serial.begin(9600);

  // We'll use the builtin LED as a status output.
  // We can't use the serial monitor since the serial connection is
  // used to communicate to p5js and only one application on the computer
  // can use a serial port at once.
  pinMode(LED_BUILTIN, OUTPUT);

  // Outputs on these pins
  pinMode(LEDpin, OUTPUT);
  pinMode(wind, INPUT);


  // 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
  }
}

void loop() {
  // wait for data from p5 before doing something
  while (Serial.available()) {
    digitalWrite(LED_BUILTIN, HIGH); // led on while receiving data

    int light = Serial.parseInt();
    if (Serial.read() == '\n') {
      digitalWrite(LEDpin, light);
      int sensor = analogRead(A0);
      delay(5);
      Serial.println(sensor);
    }
  }
  digitalWrite(LED_BUILTIN, LOW);
}

To briefly explain this code, every time the ball hits the ground, the variable ‘light’ is set to 1. If this is not the case, ‘light’ is set to 0.

if (!serialActive) {
    text("Press Space Bar to select Serial Port", 20, 30);
  } else {
    ellipse(position.x,position.y,mass,mass);
  if (position.y > height-mass/2) {
      velocity.y *= -0.9;  // A little dampening when hitting the bottom
      position.y = height-mass/2;
    light=1
    
    }
    else{
      light=0
    }
  }
}

Then, p5.js sends the value of ‘light’ to the Arduino.

let sendToArduino = light + "\n";
    writeSerial(sendToArduino);

When the Arduino receives the light value from p5.js, it turns on if the value is 1 and turns off if the value equals 0.

int light = Serial.parseInt();
    if (Serial.read() == '\n') {
      digitalWrite(LEDpin, light);

To control the wind value, if the length of the data sensed by the Arduino is equal to 1, p5.js receives the data value of the potentiometer. We then use the map function to convert the analog input value from 0 to 1023 to a range of -1 to 1.

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
     
     let sensorValue = int(fromArduino[0]);
     wind.x = map(sensorValue, 0, 1023, -1, 1);
   }
   }

 

 

Reading Reflection: Week 12

The author gave the market of eyewear as an example in which fashion and disability overlap. As a user of glasses, I used to think that wearing glasses was unfashionable and hence, in a broader sense, thought that disability and fashion were two separate things. However, nowadays, with emphasis on fashion and appearances, disability goes well along with fashion. Therefore, people with bad eyesight look for glasses that not only provide vision but also style. In this way, customers in the eyewear market do not have to stress about giving up either vision or fashion. Furthermore, the eyewear market has expanded so much to the point where people without vision disability wear glasses for fashion. The term “fashion glasses” is used to identify products in the eyewear market that are intended to attract customers who wish to buy glasses for fashion. I think the eyewear market is a great example that shows how incorporating both fashion and disability not only benefits the producers by maximizing their profit but also the customers who obtain clear vision and style. 

Innovating designs for people with disability pushes people to develop various skills. Hearing aid devices, for instance, are being designed for disability where discretion is still a priority. Therefore, many designs try to conceal the devices or make them invisible when in use. Technological miniaturization is constantly used to make devices invisible for the user’s comfort. In this way, in an attempt to create designs for people with disability, technological advancements can be made and new skills can be obtained. One downside, however, of technological advancement is that it is often costly. Therefore, extra effort and time must be invested to bring out the best in the process.

In short, the reading made me realize the embracement of fashion. Fashion designers collaborate with designers who create products for people with disability to allow customers to enjoy comfort and style. Through the exploration of developing designs, new skills and technological advancements can be obtained which is good for both the producers and consumers. The reading helped me appreciate the developments that does not force me to give up one over the other and helped me realize that we can get a hold on both. 

Final Project Ideas

Idea 1: Concert

For this project, the user can design a concert environment. I am thinking of designing the Arduino and the breadboard as the mixer for controlling light and sound.

  • The photocell will be used to control the brightness of the room.
  • The potentiometer will be used to control the volume of the music.
  • A button will be used to switch songs.
  • A button will be used to change the color of the lights.
  • A speaker will be used to project the sound.
  • p5 will illustrate the concert setting.

This is what inspired me:

Idea 2: Musical Instruments

For this project, I am thinking of creating musical instruments. Like “Garageband” on Apple devices, I am thinking of providing a space for the users to play various instruments.

  • The potentiometer will be used to control the volume of the sound.
  • Buttons will be used as note keys.
  • A speaker will be used to project the sound.
  • p5 will illustrate the instruments on the screen and allow the users to select instruments.

This is “Garageband” that inspired me:

 

Assignment 7: Musical Instrument

Partner: Hyein Kim

Concept

When we were young, we were taught to sing and play instruments to a song called “떴다 떴다 비행기”. This song is about airplanes and with the introduction to airplanes through this song, we learn more about airplanes and dream of riding it one day. Furthermore, when we played as elementary students in the playground, we always sang this song and looked up to the sky to find some airplanes. Now, as older students, playing this song on our instrument reminds us of our childhood in South Korea.

Circuit

For digital, we used 3 buttons. Each button is connected to the Ground, a 330 ohm resistor and digital input (2, 3, 4). 

For analog, we used a potentiometer and a speaker. The speaker is connected to the Ground and analog input (~9). The potentiometer is connected to 5V, A0, and the Ground.

Playing the song

Changing the tone

Code

We have created a code so that when a button is pressed, the corresponding note is played with a frequency that can be altered up or down by the potentiometer. The constants BASE_NOTE_C4, BASE_NOTE_D4, and BASE_NOTE_E4 are defined at the top of the sketch. To simplify the code, we have used the INPUT_PULLUP function in the ‘setup’ function, which means that the button pin will read HIGH when unpressed and LOW when pressed. 

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP); // Setup as pull-up to simplify wiring
  }
  pinMode(buzzerPin, OUTPUT);
}

In the main program loop, the potentiometer’s value is read from ‘potPin’ and mapped from its reading rand (0 to 1023) to a frequency adjustment range of -100 to +100 Hz. The loop checks each button in the buttonPins array to see if it’s pressed (reads LOW due to the pull-up resistor). If a button is pressed, the function playAdjustedTone() is called.

void loop() {
  int frequencyAdjustment = analogRead(potPin); // Read the potentiometer value
  frequencyAdjustment = map(frequencyAdjustment, 0, 1023, -100, 100); // Map the pot value to a frequency range adjustment

  for (int i = 0; i < 3; i++) {
    if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed
      playAdjustedTone(i, frequencyAdjustment);
    }
  }
}

We wanted to use the potentiometer to adjust the tone. So we have written the playAdjustedTone() function. It calculates the adjusted frequency for the selected note by adding the frequency adjustment value from the potentiometer to the base frequency of the note. It then uses tone(buzzerPin, adjustedFrequency) to play the adjusted note for 100 milliseconds.

void playAdjustedTone(int noteIndex, int adjustment) {
  int baseFrequencies[] = {BASE_NOTE_C4, BASE_NOTE_D4, BASE_NOTE_E4}; // Base frequencies for C, D, E
  int adjustedFrequency = baseFrequencies[noteIndex] + adjustment; // Adjust the frequency based on potentiometer

  tone(buzzerPin, adjustedFrequency); // Play the adjusted note
  delay(100); // Duration of note
  noTone(buzzerPin); // Stop the tone
}

After playing the note, noTone(buzzerPin) stops the buzzer.

Here is the full version of our code:

// Define frequencies for musical notes C, D, E
#define BASE_NOTE_C4 261
#define BASE_NOTE_D4 294
#define BASE_NOTE_E4 329

// Define pin connections
const int buzzerPin = 9;
const int potPin = A0;
const int buttonPins[] = {2, 3, 4}; // Buttons for C, D, E notes

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP); // Setup as pull-up to simplify wiring
  }
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  int frequencyAdjustment = analogRead(potPin); // Read the potentiometer value
  frequencyAdjustment = map(frequencyAdjustment, 0, 1023, -100, 100); // Map the pot value to a frequency range adjustment

  for (int i = 0; i < 3; i++) {
    if (digitalRead(buttonPins[i]) == LOW) { // Check if button is pressed
      playAdjustedTone(i, frequencyAdjustment);
    }
  }
}

void playAdjustedTone(int noteIndex, int adjustment) {
  int baseFrequencies[] = {BASE_NOTE_C4, BASE_NOTE_D4, BASE_NOTE_E4}; // Base frequencies for C, D, E
  int adjustedFrequency = baseFrequencies[noteIndex] + adjustment; // Adjust the frequency based on potentiometer

  tone(buzzerPin, adjustedFrequency); // Play the adjusted note
  delay(100); // Duration of note
  noTone(buzzerPin); // Stop the tone
}

Reflection

For improvement, we would like to add more buttons so that we can play more musical notes. In this way, the range of songs we can play on the instrument would widen and it would be more entertaining to play along on the instrument. Also, we tried to change the volume of the sound through the potentiometer but was unsuccessful at it. Therefore, for this assignment, we utilized the potentiometer to control the tone instead. In the future, however, we would like to learn and utilize volume control using the potentiometer. 

 

Reading Reflection: Week 11

From time to time, I feel like I rely too much on tools. My phone is an electric device that fulfills my needs in various ways. While my phone supports me in numerous ways, I don’t necessarily need to use my phone all the time for all purposes. For example, instead of reading a book, I use the internet on my phone for summaries. This causes me to miss the experience of reading a book and coming up with my interpretations. Yes, summaries available online are very helpful; however, I don’t have to use my phone to understand the ideas presented in the book. Therefore, my tendency to heavily rely on tools forces me to lose on experiences I could have by doing it myself.

Furthermore, the author talked about our hands, and reading this article made me realize how powerful our hands are. The nerves on our fingertips, the senses, and the strength all made me realize how useful our hands are. Not only do our hands feel the surfaces of things, but they can also manipulate things. Just as our hands naturally tilt to prevent water from pouring out of the cup, our hands have very much power. The article amazed me and I found myself agreeing with the author’s statement “I believe that hands are our future”. Our hands and the human body have great capabilities that we don’t always recognize. Once we recognize how much we can do, we don’t have to rely on other things or limit ourselves in what we can do.

Reading these two articles made me reflect on the current world. Nowadays, humans heavily rely on technology and AI to fulfill our needs. No matter how hard or easy the task may be, I feel like humans prefer to use tools such as technology and AI to do the work. Therefore, human capabilities are not used to their full potential. Sometimes, we think that it is impossible to live without certain tools we have now. However, if we consider the past, life was possible and not all tools available to use are necessary. Then I questioned why humans tend to not do the work themselves and use tools instead. The solution I arrived at was that it was due to convenience. Tools provide great convenience and efficiency. Therefore, even when we know that we can do the work on our own, we choose not to and use the tools. While convenience and efficiency are great, I believe that humans need to find the right balance between the use of tools and our bodies. Our body is the most amazing tool and we don’t have to always rely on other tools to meet our needs. Finding ways to use ourselves would help us utilize our potential and at the same time meet our needs.

Assignment 6: Digital & Analog Sensor

Concept

The concept of this assignment is traffic light. In the circuit, I used red, yellow, and green LEDs to mimic the traffic light. The red and yellow LED turns on when the button is pressed and off when the button is not pressed. The green light changes its dimness according to the potentiometer. Many drivers often wish the green light to be on for a long time so that they can drive continuously through the traffic lights. So I used the potentiometer to let the green LED stay on with full dimness when all of 5V is supplied.

Code & Sketch

When creating the circuit, I focused on building the digital circuit first and then the analog circuit. In this way, I did not confuse myself and was able to make sure each component worked.

I referenced the design of the circuit for the potentiometer that I learned in class (the sketch is displayed below). Along with the design of the circuit for the potentiometer or the analog sensor, I used a very simple design for the button or the digital sensor. For both designs, I used a 330 ohm resistor because using a 10K ohm resistor was unnecessary.

Below is the code for the entire circuit. I only coded for the potentiometer because Arduino code was not needed to activate the button. The code for running the potentiometer is very simple. I initially defined a variable ‘led’ and used sensorValue to determine the brightness of the LED. I used PWM pin 11 to activate the brightness effect and delay to make the dimness effect visible.

int led = 11;

void setup() {

  Serial.begin(9600);

  //pin 11 output
  pinMode(led, OUTPUT);

}

void loop() {

  int sensorValue = analogRead(A2);
  Serial.println(sensorValue);

  // set the brightness of pin 11 according to the sensorValue and divided by 4
  analogWrite(led, sensorValue/4);

  // delay effect for 30 milliseconds to see the change in dimness
  delay(30);

}

Reflection

Creating the circuit was not difficult because most of it was materials covered in class. However, if I had to mention one slightly challenging thing, I would say it is working with tiny materials. My hand was comparatively larger than all the elements and trying to place them on the breadboard, I had to be careful to not misplace or interrupt the other elements already positioned on the breadboard.

To add on, when I first thought of this assignment, I wanted to have separate buttons for the red and yellow LEDs. However, due to the limited space on the breadboard, I was not able to do so. Therefore, for improvement, I would like to readjust the position of the elements on the breadboard so that I can fit one more button for the LED and be able to control the red and yellow LED separately.

Outcome

How the circuit works

 

 

Reading Reflection: Week 10

I liked how Tigoe described interactive art as conversation. Before I took this class, I wasn’t familiar with artworks that require the audience to interact with. Therefore, when it comes to art, I thought of paintings that simply express a thought/idea; in other words, artworks that state what the artist thinks. However, now that I have taken this class, I learned that art isn’t just about expressing the artist’s thoughts. It could be a conversation that the audience shares with the art itself. For that reason, for some artworks, the audience may not understand what the artwork is trying to deliver at first glance. Through interaction and conversation, the audience will gain an understanding of the artwork’s meaning.

Tigoe spoke to artists and asked them to shut up once they had set the initial statement so that the audience could interact through their senses. A good thing about interactive art, I believe, is that it is open to interpretation and gives the audience the freedom to expand on the meaning of the artwork. In this way, the artwork could reach a wider range of audience and be more entertaining.

An example of interactive art that caught my attention was “Tilty Stands and Tables”. This artwork required the audience to physically tilt the flat surfaces and experience the artwork’s response to the changes. Other than this, many other interactive artworks appealed to our senses. By calling the audience to physically interact with the artwork, the audience can freely interpret the meaning behind the work and add to their experiences. Now, with an understanding of what interactive art is, I am looking forward to sharing conversations with artworks and coming up with my interpretations.

Assignment 5: iPad Switch

Concept

Considering myself, I realized that people spend too much time on their electrical devices such as phone, tablet, and laptop. To encourage people to stop using their devices for unnecessary time, I created a circuit that turns the LED on when the user closes the iPad case. I intentionally used green light because green symbolizes a sign of “good” and I wanted to make the user feel good about himself when he stops using his iPad.

Process

Figuring out the the path of the current was not difficult but constructing the circuit was. I had to attach the resistor to the iPad case and two jumper wires. Locating the position of the resistor and the jumper wires on the iPad was slightly challenging because I had to find the exact position where the jumper wires and the resistor would meet. But once this was established, everything else was easy to accomplish.

The flow of the circuit looks like this: 5V – jumper wire – resistor – jumper wire – LED – GND. I tried to minimize the number of jumper wires and make a very simply circuit. I am satisfied with the design of the circuit and although it is simple, the circuit maintains to turn the LED on when the resistor and jumper wires come in contact.

The video below shows how the iPad Switch works.

iPad Switch

The picture below shows the circuit in more detail.

Reflection

One thing I do want to point out is that due to the gap between the iPad case and the iPad itself, I have to initially press on the case cover to let the resistor and the jumper wires come in contact. I wanted the LED to turn on immediately when the case is closed but unfortunately taping the jumper wires created a gap between the case cover and the iPad. However, when the case cover is slightly pressed, the LED turns on and functions well.

Also, technically I am still using my hands to turn the LED on. So for future improvement, I would like to figure out ways I could eliminate the use of hands to turn the LED on.

The picture below shows the gap between the case cover and the iPad.