All Posts

Musical Instrument

Me and Nisala started very ambitiously in our brainstorming session, but learned really fast that executing the theoretical ideas is a completely different thing. Instead of having a clear vision and linearly making it happen step by step, we experimented a lot with different sensors, materials and code. The process was very enjoyable, playful and although we ended up not using many of the elements we tried, we learned a bunch of new things (and how not to use them).

One of the major problems that got us stuck in the beginning was that the Tone and Servo library did not work together in one code – we solved it by creating a little bit more of tedious work for us and declared the notes and frequencies manually.

The beauty that was born eventually is a rotating music instrument that has a lot of paper clips inside. The main part of the instrument is a cardboard box, which is rotated by a servo, consequently making a lot of … music? (who said the music needs to be beautiful, right). Then we have a set of 8 buttons that together with a buzzer serve as a C major scale and that also control the servo. The degree to which the servo turn is determined by which button is pressed (the higher the note, the smaller the angle).

Here is a demonstration:

The breadboard: 

And lastly the code:

#include <Servo.h>


#define NOTE_C4 261
#define NOTE_D4 294
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_G4 392
#define NOTE_A4 440
#define NOTE_B4 494
#define NOTE_C5 523

int duration = 500;

const int button1 = 4;
const int button2 = 5;
const int button3 = 6;
const int button4 = 7;
const int button5 = 8;
const int button6 = 9;
const int button7 = 10;
const int button8 = 12;

Servo servo;


const int buzzer = 3;


bool servoState = false;
int toggleTime = 0;
int triggerInterval = 500;
int angle = 0;

void setup() {
  // put your setup code here, to run once:

  pinMode (button1, INPUT);
  pinMode (button2, INPUT);
  pinMode (button3, INPUT);
  pinMode (button4, INPUT);
  pinMode (button5, INPUT);
  pinMode (button6, INPUT);
  pinMode (button7, INPUT);
  pinMode (button8, INPUT);

  servo.attach(11);

}

void loop() {
  // put your main code here, to run repeatedly:

  int buttonState1 = digitalRead(button1);
  int buttonState2 = digitalRead(button2);
  int buttonState3 = digitalRead(button3);
  int buttonState4 = digitalRead(button4);
  int buttonState5 = digitalRead(button5);
  int buttonState6 = digitalRead(button6);
  int buttonState7 = digitalRead(button7);
  int buttonState8 = digitalRead(button8);





  if (buttonState1 == HIGH) {
    tone(3, NOTE_C4);
    servo.write(180);

  }


  else if (buttonState2 == HIGH) {
    tone(3, NOTE_D4);
    servo.write(160);
  }



  else if (buttonState3 == HIGH) {
    tone(3, NOTE_E4);
    servo.write(140);
  }


  else if (buttonState4 == HIGH) {
    tone(3, NOTE_F4);
    servo.write(120);
  }



  else if (buttonState5 == HIGH) {
    tone(3, NOTE_G4);
    servo.write(100);
  }


  else if (buttonState6 == HIGH) {
    tone(3, NOTE_A4);
    servo.write(80);
  }



  else if (buttonState7 == HIGH) {
    tone(3, NOTE_B4);
    servo.write(60);
  }



  else if (buttonState8 == HIGH) {
    tone(3, NOTE_C5);
    servo.write(40);
  }


  else {
    noTone(3);
    servo.write(0);
  }

}

 

Reading response 2: The Psychopathology of Everyday Things

Design is such an important part of any object.

Norman has a very interesting perspective on design and touches on some thought provoking points. As a visual arts major, and someone who has dabbled in design a little bit, I understand the challenges that Norman talks about in relation to designers. Design is so important. It can either simplify, or complicate things for the users/audience, it can be interesting, aesthetic, minimalistic, boring, or complex. An navigating between the visual appeal of something and the efficiency and ease of use is up to the designer.

Norman talks about human centered design, which makes a lot of sense to me. An idea or product might be good in theory, but it might not be suited to the behavior of the average human. Furthermore another challenge for the designer is deciding how complex something should be. Norman talks about how adding more functions to something is supposed to make things easier by providing more options, but just complicates life. So a designer needs to decide the best balance between the two. It is very interesting to think of the development of design, and the new and unique design being developed for some products, while others stay relatively the same, and to think about how this will develop and change in the future.

Musical Instrument

For this week’s assignment, Steven and I created a machine that plays the drum and the piano.

To create the drum, we attached pairs of chopsticks on each servo motor and super-glued it together. We used a potentiometer to control the speed of the drumming; one hit the Pringles can and another was attached to a paper ball that made noise.

Some of the problems we came across was trying to make the piezo buzzer louder and also being able to control the speed of the servo motor based on the analog input of the potentiometer.  We are still unsure about how to make the piezo buzzer louder, but we think it might be because there isn’t enough voltage going through to the buzzer.

The Tone library and Servo library were also not allowed to be in the same program, which we did not know about in the beginning, so we had one Arduino program for controlling the servo and another to control the piezo buzzer.

Group project with Rick

Greetings friends!

For this weekly assignment, we have created a music buzzer with a bpm bird.

We have made the song “All star” using piano notes and tone.h to make
make it sound like the actual song. It took a long time to make it because I had to make a list of notes manually from the music score. Rick made a BPM bird using a servo to hit the beat once per 400ms, and in combination it sounded on sync. The problems that we’ve encountered was that servo.h and tone.h are not compatible with one another due to the inner-timer that these libraries use. We tried to look into the tone.h library to find the respective frequencies of the notes, but due to the delay issue, we had to separate the servo and the buzzer on separate Arduino boards to make it work properly.

Source Codes:

#include <Servo.h>

unsigned long previousMillis = 0;
const long interval = 7;
int angle = 0;

Servo myservo;

void setup() {
  myservo.attach(5);
}

void loop() {
  myservo.write(angle);
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    angle = (angle + 1) % 64;
  }
}
#include<Tone.h>
//                  0       1         2         3         4       5       6       7         8       9
int notes[11] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_D5, NOTE_E5, 0};
int i = 0;
int duration[90] = {4, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 6, 4,
                    2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 4, 4,
                    2, 4, 1, 1, 2, 4, 1, 1, 2, 4, 4, 2, 4, 2, 4, 1, 1, 2, 4, 1, 1, 2, 4, 4, 2, 4,
                    4, 4, 2, 2, 2, 8, 2, 2, 2, 2, 8, 4, 2, 4, 4, 16
                   };
int note[90] = {4, 8, 6, 6, 5, 4, 4, 7, 6, 6, 5, 5, 4, 4, 8, 6, 6, 5, 5, 4, 4, 2, 10,
                4, 4, 8, 6, 6, 5, 5, 4, 4, 7, 6, 6, 5, 5, 4, 4, 8, 6, 6, 5, 4, 4, 5, 2, 10,
                6, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 6, 10, 6, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 6, 10,
                6, 8, 7, 6, 5, 5, 4, 4, 5, 4, 6, 5, 4, 5, 2, 10
               };
Tone player;

void setup() {
  player.begin(3);
}

void loop() {
  player.play(notes[note[i % 90]], duration[i % 90] * 100);
  delay(duration[i % 90] * 100 + 20);
  i++;
}

 

Response: A Brief Rant on the Future of Interaction Design

Despite how it appears to the culture at large, technology doesn’t just happen. It doesn’t emerge spontaneously, pulling us helplessly toward some inevitable destiny.

In his Brief Rant on the Future of Interaction Design, Bret Victor urges people to move away from extrapolation of previous models of technology design, namely the “Pictures Under Glass” model which most of our hand-held devices and computers are structured around. He proposes that we should instead move towards a future that does not, in his words, ignore our hands. Most of us have a similar vague idea of what future technology is going to look like, and this is aided by what we see in different media such as popular futuristic films, or infomercial-style clips of technological breakthroughs. A lot of it is just a regurgitation of the technology we already have, recreated to fit other surfaces. Victor believes that we should instead create models that exceed our limited knowledge of human capability, but also models that fit right within the knowledge we currently have, which is that our hands are massively tactile and the visual component of our interactions with the world is minimal in comparison. More and more of our interactions with technology are becoming visual, and in a world where everything else we engage with is three-dimensional, this creates a gap between our sensory capabilities and the capabilities of the technology we’re designing. I must admit, this is something I have never really thought of- which is ultimately just proof of how seamlessly the culture of “pictures under glass” has become integrated into our lives.

Victor’s responses to some of the comments people left underneath his rant post were amusing, my favorite comment was “Yeah! iPhone bad! iPad bad!”, because his response to it really put things into perspective. He goes on to say how iPads are good -for now- because they are truly revolutionary for our time. What’s bad is that if in twenty years we still had the same model of the iPad with a few new functions and perhaps a new surface. I wholeheartedly agree with this statement, especially when looking back at the history of most technologies we use today. Many things started out as revolutionary but that did not stop people from searching beyond that.  What’s truly great is that we have control over our future, and as Victor said, it  “doesn’t emerge spontaneously, pulling us helplessly toward some inevitable destiny”. Through visions, research, multiple trials, and errors- we are able to control that destiny (at least for the most part). Therefore, I hope that our technology will soon evolve to encompass a wider range of our human capabilities, enhancing our lives in ways that were not previously possible.

Week 4 Circuits & Code – Analog Write, Servo, Buzzer, Tone Library

 

const int knobPin = A0;
const int ledPin = 3; // be sure to use a PWM pin!

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // read the potentiometer value
  int knobValue = analogRead(knobPin);
  
  // analog write takes values between 0 and 255
  // map the knob value to be be between 0 and 255
  int brightness = map(knobValue,0,1023,0,255);

  // use the brightness value for the LED analog write
  analogWrite(ledPin, brightness);
}

 

 

#include <Servo.h>

Servo myServo;

const int knobPin = A0;

void setup() {
  // attach the servo to pin number 9
  myServo.attach(9);

}

void loop() {
  // read the potentiometer value
  int knobValue = analogRead(knobPin);
  
  // the servo only moves between 0 and 180
  // map the knob value to be be between 0 and 180
  int angle = map(knobValue,0,1023,0,180);

  // use the mapped angle to set the servo's rotation
  myServo.write(angle);

  // wait a very short bit for the servo to move to the location
  delay(15);
}

 

 

int buzzerPin = 4;

void setup() {
  pinMode(buzzerPin, OUTPUT);
}

void loop() {
  // arguments are pin, frequency, and duration
  tone(buzzerPin, 440, 200);
  // since the tone is lasting 200 milliseconds
  // delay for 400, so 200 on and then 200 off
  delay(400);

  // you could also do without the duration argument if you wanted a steady tone:
  //  tone(buzzerPin, 440);
}

Install the Tone Library by Brett Hagman to use more than one Buzzer:

// install the Tone Library by Brett Hagman to use multiple buzzers

#include <Tone.h>

// arrays to hold the note values
int notes[10] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_D5, NOTE_E5};

Tone player0, player1;

// length in milliseconds
int duration = 250;

//variable to change note for player0
int whichNote = 0;

void setup() {
  // use pin 5 for buzzer 0
  player0.begin(5);
  // use pin 6 for buzzer 1
  player1.begin(6);
}

void loop() {
  // player0's notes change according to the number in whichNote
  player0.play(notes[whichNote], duration);

  // player1's note stays the same
  player1.play(notes[9], duration);

  // set whichNote to equal itself + 1
  // then modulo that number by 8, which creates a loop between 0-7 (8 digits)
  whichNote = (whichNote + 1) % 8; //do plus 1 to go up major scale, try others numbers like plus 3

  //wait for the notes to stop playing before going to the next note
  delay(duration);
}

 

 

 

Response to the Response for A Brief Rant on the Future of Interactive Design

Some interesting points Victor made about others’ responses are:

iPad is good: After his first blog post, I did not expect him to say that iPads/iPhones are good for now. It seemed that he was against the whole idea of a screen, but regardless, it makes me question what the timeline is for when a certain technology is no longer innovative. At what point do we say a screen is not enough?

What about voice: I’m not sure when this post was made, but I wonder what Victor’s opinions on recent technologies like Alexa are because the technology definitely fit his idea of interested using “tools for creating and understanding.”

What about brain interfaces: I agree with Victor about how computers are pretty much controlling our body and how our daily activities will soon be dominated by computer controlled in some way or another. It’s what many people are worried about, but how does Victor want to address this? What future interaction design can be made in the future that would stop this from happening?

My child can’t tie his shoelaces, but can use the iPad: I felt the point he made here was a harsh. He says that using screen technology is similar to restricting literature to Dr. Seuss’s vocabulary as if that was bad. He says that a “fully-functioning adult human being deserves so much more.” However, isn’t the whole point of interactive designs to be simple and not overdone? Humans are looking to make their life simpler; a lot of people would rather read Dr. Seuss’s book than to have to read Shakespeare.

A Brief Rant on the Future of Interaction Design Response

Bret Victor’s post about the future of interaction design was very compelling to me because it made me question what the future looks like. I’ve always thought “What else can we make when everything’s already been invented?” I think the reason why developers are creating more and more apps through a screen is because there’s so much more you can create on phones, tablets, etc. Even within his own post, Victor does not mention any technology that’s not Pictures Under Glass, but I acknowledge the fact that he is writing this post to inspire younger generations to think of something more revolutionary than what is currently thought of as the future of interaction design. 

I believe the future is the screen because outside of that, what can you really create? I agree with Victor’s point about how these screen technologies leads us to lose connection with the task that we are performing. Isn’t that somewhat the purpose of technology though? It’s suppose to make your life easier; what if you’re too lazy to use your hands? Some people want things done with a swipe of the finger.

I respect what Victor has to say about the future of interaction design, but I really don’t know what else to expect than a screen that can do so much more than what we humans are capable of.

Fortune Cookie(?)

The title of this blogpost may be a little misleading, but the process behind bringing my idea to life might give you some clarity regarding the naming. So when I was thinking “unexpected”, I immediately thought of magic eight balls and fortune cookies, with their random phrases and words of wisdom that I never seem to anticipate. I saw the box displayed in the image below, when I was walking around the lab; and it was as if the idea was calling to me.

Initially, I had considered using a temperature sensor, and have the different members of the audience touch it; which would then detect their body temperature and display a random statement (similar to the ones we find in fortune cookies). However, there were several flaws in that logic, since most people have similar body temperatures, and the changes in the temperature sensor were too minuscule to alternate between statements. I then decided to change to a different analog sensor; the photoresistor. the photoresistor was easier to operate, since it encompasses a wider range of values when exposing it to light or darkness. But, I wasn’t able to devise a way to adapt the fortune cookie scenario to the function of the photoresistor, and instead opted for a different narrative. I will hopefully be able to implement and develop this idea further with more knowledge of code.

https://youtu.be/I_a97QBo_2s

https://youtu.be/cwU0_0GHOEk

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);   //defining lcd pins

int sensorValue = 0; // variable to store the value coming from the sensor
int sensorPin = A0; // select the input pin for LDR
 
void setup()
{
  pinMode(3,INPUT);      //setting arduino pin3 as input
  Serial.begin(9600);   // opens serial port, sets data rate to 9600 bps
  lcd.begin(16,2);      // set up the LCD's number of columns and rows
  
}

void loop()
{
sensorValue = analogRead(sensorPin); // read the value from the sensor
Serial.println(sensorValue); //prints the values coming from the sensor on the screen


//display text on lcd
if (sensorValue < 50) {
  lcd.clear();
  lcd.print("Never leave me");
} else {
  lcd.clear();
  lcd.print("This is why I");
  lcd.setCursor(0,2);
  lcd.print("have trust issues");
}

// Turn off the display:
  lcd.noDisplay();
  delay(100);
  // Turn on the display:
  lcd.display();
  delay(1000);

}