“Jingle Bells” Radio

Concept:

We created a basic radio that switched between two channels, each playing different songs, by adjusting a potentiometer. Inspired by the upcoming festive season, even though it is too early, we decided to integrate the beloved tune “Jingle Bells” into our project.

Video Demonstration: musical instrument

Implementation:

We used a switch, a potentiometer, and a buzzer in our setup. The switch turns on and off the radio, and the potentiometer switches between channels. Initially, we planned to include two songs: “Jingle Bells” and “Let It Be.” However, converting “Jingle Bells” into playable chords was a bit of a challenge. Consequently, the potentiometer plays “Jingle Bells” when set in the first half and stays silent in the second half.

To achieve the authentic “Jingle Bells” melody, we discovered the chords and their timing online. These chords, when played together, compose a recognizable tune. We organized this chord information into an array named “melody” in our code. Each chord in this array was linked to a specific frequency, dictating the notes played. Assigning these frequencies to each chord enabled us to establish a precise sequence of notes within the melody array, ultimately generating the iconic “Jingle Bells” tune. Later in the loop, it iterates through the melody array. Within the loop, it retrieves each note’s frequency and plays it for a specified duration using the buzzer.

const int POTENTIOMETER_PIN = A0;
const int BUZZER_PIN = 3;
const int threshold = 512;

// Define each chord's frequency
#define C 261
#define D 294
#define E 329
#define F 349
#define G 392
#define A 440
#define B 493
#define REST 0

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int analogValue = analogRead(POTENTIOMETER_PIN);
  Serial.println(analogValue);

  if (analogValue > threshold) {
    playJingleBells();
  } else {
    noTone(BUZZER_PIN);
    delay(100); // Delay to reduce loop frequency
  }
}

void playJingleBells() {
  // Melody and Timing
  int melody[] = {
    E, E, E, REST,
    E, E, E, REST, E, G, C, D, E, REST,
    F, F, F, F, F, E, E, E, E, D, D, E, D, REST, G, REST,
    E, E, E, REST,
    E, E, E, REST, E, G, C, D, E, REST,
    F, F, F, F, F, E, E, E, G, G, F, D, C, REST
  };
  int noteDurations[] = {
    4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4
  };

  int melodySize = sizeof(melody) / sizeof(melody[0]);

  for (int i = 0; i < melodySize; ++i) {
    int noteDuration = 1000 / noteDurations[i];

    if (melody[i] != REST) {
      tone(BUZZER_PIN, melody[i], noteDuration);
      delay(noteDuration); // Let the note play for its duration
    } else {
      delay(noteDuration); // If it's a rest, delay without tone
    }
    
    noTone(BUZZER_PIN); // Stop the note
    delay(50); // Delay between notes for spacing
  }
}

Reflection & Future Improvements:

As it was mentioned before, we wanted to create a radio with two channels, playing two different songs such as “Jingle Bells” and “Let It Be”, depending on the resistance of the potentiometer: the first half plays one song, and the second half another. However, we spent a lot of time working on our beloved Christmas song, finding the right chords, and frequencies, and figuring out the logic of making it play, so we didn’t have much time left to work on the second song. Because of this, we decided to make another channel of our radio empty for now, so we could add the song in the future. In addition to that, we would like to work on the aesthetics in the future by creating the painted cardboard in the form of the radio in order to create a more realistic experience. 



Week 10 – Slapping Music

Concept:

For this assignment of designing an unusual musical instrument, instead of making an instrument that can be actually played by people, we decided to make something that produces music on its own. Among all the electronic components we have, we think that the servo motor will be the perfect choice to show the mechanical movement of the music. And we decide to use the ultrasonic distance sensor as the main part that produces music. While the servo motor moves, the pad attached to it will move as well, leading to the changes in the distance measured by the ultrasonic sensor. According to different distances, the speaker plays sounds of different frequencies.

IMG_4401

Highlight of the code

For coding this self-playing musical instrument, we used the functions like map() that match the distance to the frequencies. We used the distance sensor code from the documentation example. While manipulating the servo motor’s position, the simple codes can produce surprising music. More over, we have the button that changes the frequency range. Whenever the button is pressed, the whole melody will be played at a higher frequency.

// assign the variables for distance and button 
#define trigPin 13
#define echoPin 12
#define buttonPin 2

// include library for Servo motor 
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

// assign the first position
  // variable to store the servo position
int pos = 0;


void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);  //distance
  pinMode(echoPin, INPUT);
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  
  pinMode(buttonPin, INPUT); // switch
}

int frequency; // assign the frequency variable

void loop() {
  // from distance sensor example
  long duration, distance; 
  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2);        // Added this line
  digitalWrite(trigPin, HIGH);
  //  delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10);  // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1;


  if (distance >= 200 || distance <= 0) {
    Serial.println("Out of range");
  } else {
    Serial.print(distance);
    Serial.println(" cm");
  }


// we contrain the distance to be from 0 to 50 and map the distance values to the frequency values 
// if the button is not pushed then the melody plays in low frequencies
// if the button is pushed, then the frequency  is higher 


  if (digitalRead(buttonPin) == LOW) {
    frequency = map(constrain(distance, 0, 50), 0, 50, 100, 1000);
  } else {
    frequency = map(constrain(distance, 0, 50), 0, 50, 500, 2000);
  }


  //code for SERVO position 
  myservo.write(90);  
  delay(50);
  myservo.write(45);
  delay(50);
  myservo.write(25);
  delay(50);
  myservo.write(70);
  delay(50);
  myservo.write(100);
  delay(50);
  myservo.write(60);
  delay(50);
  // waits 50ms for the servo to reach the position
 

// play the sound from pin 6

  tone(6, frequency);


}

Reflections and Improvement

As for improvements, the appearance of the instrument could definitely be improved. For example, the entire device could be enclosed into a box that’s called music box. That will make the project more interesting and appealing. Moreover, we could include the function that allows the user to change melodies as they want. They can, for instance, manipulate the movement of the arm and the hand with a potentiometer. This gives more interactivity to the project.

Week 10 – Musical instrument

Concept: We created a basic radio that switched between two channels, each playing different songs, by adjusting a potentiometer. Inspired by the upcoming festive season, even though it is too early, we decided to integrate the beloved tune “Jingle Bells” into our project.

Video Demonstration: musical instrument

Implementation:

We used a switch, a potentiometer, and a buzzer in our setup. The switch turns on and off the radio, and the potentiometer switches between channels. Initially, we planned to include two songs: “Jingle Bells” and “Let It Be.” However, converting “Jingle Bells” into playable chords was a bit of a challenge. Consequently, the potentiometer plays “Jingle Bells” when set in the first half and stays silent in the second half.

To achieve the authentic “Jingle Bells” melody, we discovered the chords and their timing online. These chords, when played together, compose a recognizable tune. We organized this chord information into an array named “melody” in our code. Each chord in this array was linked to a specific frequency, dictating the notes played. Assigning these frequencies to each chord enabled us to establish a precise sequence of notes within the melody array, ultimately generating the iconic “Jingle Bells” tune. Later in the loop, it iterates through the melody array. Within the loop, it retrieves each note’s frequency and plays it for a specified duration using the buzzer.

const int POTENTIOMETER_PIN = A0;
const int BUZZER_PIN = 3;
const int threshold = 512;

// Define each chord's frequency
#define C 261
#define D 294
#define E 329
#define F 349
#define G 392
#define A 440
#define B 493
#define REST 0

void setup() {
  pinMode(BUZZER_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int analogValue = analogRead(POTENTIOMETER_PIN);
  Serial.println(analogValue);

  if (analogValue > threshold) {
    playJingleBells();
  } else {
    noTone(BUZZER_PIN);
    delay(100); // Delay to reduce loop frequency
  }
}

void playJingleBells() {
  // Melody and Timing
  int melody[] = {
    E, E, E, REST,
    E, E, E, REST, E, G, C, D, E, REST,
    F, F, F, F, F, E, E, E, E, D, D, E, D, REST, G, REST,
    E, E, E, REST,
    E, E, E, REST, E, G, C, D, E, REST,
    F, F, F, F, F, E, E, E, G, G, F, D, C, REST
  };
  int noteDurations[] = {
    4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
    4, 4, 4, 4, 4, 4, 4
  };

  int melodySize = sizeof(melody) / sizeof(melody[0]);

  for (int i = 0; i < melodySize; ++i) {
    int noteDuration = 1000 / noteDurations[i];

    if (melody[i] != REST) {
      tone(BUZZER_PIN, melody[i], noteDuration);
      delay(noteDuration); // Let the note play for its duration
    } else {
      delay(noteDuration); // If it's a rest, delay without tone
    }
    
    noTone(BUZZER_PIN); // Stop the note
    delay(50); // Delay between notes for spacing
  }
}

Reflection & Future Improvements: As it was mentioned before, we wanted to create a radio with two channels, playing two different songs such as “Jingle Bells” and “Let It Be”, depending on the resistance of the potentiometer: the first half plays one song, and the second half another. However, we spent a lot of time working on our beloved Christmas song, finding the right chords, and frequencies, and figuring out the logic of making it play, so we didn’t have much time left to work on the second song. Because of this, we decided to make another channel of our radio empty for now, so we could add the song in the future. In addition to that, we would like to work on the aesthetics in the future by creating the painted cardboard in the form of the radio to create a more realistic experience.

Week 10 – Reading Reflection

When I started reading the text “Hands”, I felt like the author was telling the obvious things. However, recalling how my little sister was born during the pandemic time with an iPad and iPhone at home, his words have value. My sister knows everything about the screens and how to manipulate them, but she might not know the basic things such as how to tie the shoes, hold the pen properly, etc. Because of this, I understand that pictures under glass are affecting the skills and reducing the capabilities of the hands, thus, reducing the real-life experience. What I mean by experience is that we are replacing the papers with screens, or table games such as chess and ping-pong with screen ‘dynamics’, but they don’t create the same tactile feeling… it is just a screen. 

Furthermore, the picture in the glass puts a huge emphasis on the vision, assuming that it might compensate for the tactile feelings. However, I think that this might be not the best inclusive solution for people with visual impairments. Hands give enough intuitive information for us to understand the material we are touching, how thick it is, how to manipulate it, etc, which cannot be replaced by the glass screen unless we look at it. As the author said, this is a good temporary solution, but not in the long term. So, he gave good ideas about the issues we have and now it is time to start thinking about the solutions for this issue. 

Overall, I think that our desire to touch, feel, and move cannot be replaced with visual aesthetics. 

[Week 10] Reading Response

< A Brief Rant on the Future of Interactive Design>

Looking at the video, I think my very shallow but instant impression was: cool. It definitely is close to what I’ve been picturing- something that’s been displayed to us through media (like Netflix Black Mirror series) until now, somewhat brainwashing this is what we have coming and this is all we could expect.

I love how the reading questions if the aspect of our future daily lives shown in the video is the next form of ‘technology’, or interaction, as the author focuses.

I think a big part of why technology has limited power to fascinate people and bring joy with the littlest thing is that lack of feeling. The reading talks about how if we were to read a book, we’d be able to feel it. With basic interactions with ‘Pictures Under Glass’, this is not possible. I think we’ve all felt this limitation with certain technology like e-books and simply visually satisfying games.

The author acknowledges that this is just a rant and that the current developments the world is showing are still great. It’s just a matter of how do we progress from here, using everything humans can do. Regardless of any statements that can be made around his opinion, I like how he approached the concept of ‘tool’ and what that can mean when we are inventing or developing a tool.

Musical Instrument – Week #10

Concept:

Our idea for the musical instrument was drawn from the classic guitar mechanism. By integrating Light-Dependent Resistors (LDRs) as the sensory input and buzzers as the output, we’ve created a playful experience. Each LDR is strategically positioned to represent a distinct musical note, and when covered, it triggers a corresponding buzzer, simulating the act of plucking strings on a guitar. There’s also a digital switch, which, when pressed, records the notes being played. When the switch is released, the notes are played back.

Items used:
  • Arduino Uno
  • 6 Light-Dependent Resistors (LDRs)
  • 6 Buzzers (Speakers)
  • Resistors (for LDRs )
  • Jumper Wires (for connecting components)
  • 2 Breadboards
  • 1 Momentary Switch
Technical Implementation:

In our musical instrument, each Light-Dependent Resistor (LDR) is assigned to represent a specific musical note, creating a musical sequence reminiscent of a guitar tuning. The choice of notes – E, A, D, G, B, E – corresponds to the standard tuning of the six strings on a guitar. When an LDR is covered, it changes the resistance and triggers the Arduino to interpret this change as a command to play the designated note through the corresponding buzzer.

The Arduino continuously reads the analog values from the LDRs and, upon detecting a significant change, maps the input to trigger the corresponding buzzer connected to a digital output pin. The code is designed to be modular, allowing for easy adjustments to resistor values or the addition of more sensors and buzzers for expanded musical possibilities. 

When the digital switch is pressed, the notes which are played are recorded in an integer array. As soon as the switch is released, the notes in the array are played back using the regular tone() function. 

// check recording state
 if (digitalRead(SWITCH_PIN) == HIGH) {
   Serial.println("Recording");
   recordMode = true;


 } else if (digitalRead(SWITCH_PIN) == LOW) {
   if (noteCount > 0) {
     Serial.println("Playback");
     recordMode = false;
     for (int i = 0; i < noteCount; i++) {
       tone(playback_PIN, melody[i]);
       delay(200);
     }
     noTone(playback_PIN);
     noteCount = 0;
   }
 }
Future Improvements:

The array can only hold a maximum of 50 notes, and a future improvement could be adding some warning (LED flashing?) to indicate that the array capacity has been reached. There’s also no error handling at this stage, so there could be some unexpected errors if more than 50 notes are recorded.

week 10: musical instrument (zion & lukrecija)

Demo:

Concept:

Our idea for the musical instrument was drawn from the classic guitar mechanism. By integrating Light-Dependent Resistors (LDRs) as the sensory input and buzzers as the output, we’ve created a playful experience. Each LDR is strategically positioned to represent a distinct musical note, and when covered, it triggers a corresponding buzzer, simulating the act of plucking strings on a guitar. There’s also a digital switch, which, when pressed, records the notes being played. When the switch is released, the notes are played back.

Items used:

    • Arduino Uno
    • 6 Light-Dependent Resistors (LDRs)
    • 6 Buzzers (Speakers)
    • Resistors (for LDRs )
    • Jumper Wires (for connecting components)
    • 2 Breadboards
    • 1 Momentary Switch

Technical Implementation:

In our musical instrument, each Light-Dependent Resistor (LDR) is assigned to represent a specific musical note, creating a musical sequence reminiscent of a guitar tuning. The choice of notes – E, A, D, G, B, E – corresponds to the standard tuning of the six strings on a guitar. When an LDR is covered, it changes the resistance and triggers the Arduino to interpret this change as a command to play the designated note through the corresponding buzzer.

The Arduino continuously reads the analog values from the LDRs and, upon detecting a significant change, maps the input to trigger the corresponding buzzer connected to a digital output pin. The code is designed to be modular, allowing for easy adjustments to resistor values or the addition of more sensors and buzzers for expanded musical possibilities. 

When the digital switch is pressed, the notes which are played are recorded in an integer array. As soon as the switch is released, the notes in the array are played back using the regular tone() function. 

 // check recording state

 if (digitalRead(SWITCH_PIN) == HIGH) {

   Serial.println("Recording");

   recordMode = true;

 } else if (digitalRead(SWITCH_PIN) == LOW) {

   if (noteCount > 0) {

     Serial.println("Playback");

     recordMode = false;

     for (int i = 0; i < noteCount; i++) {

       tone(playback_PIN, melody[i]);

       delay(200);

     }

     noTone(playback_PIN);

     noteCount = 0;

   }

 }

Future Improvements:

The array can only hold a maximum of 50 notes, and a future improvement could be adding some warning (LED flashing?) to indicate that the array capacity has been reached. There’s also no error handling at this stage, so there could be some unexpected errors if more than 50 notes are recorded.



Reading Response – Week #10

Are we really going to accept an Interface Of The Future that is less expressive than a sandwich?

The warning about avoiding the body’s natural interfaces inspires reflection about the effects of immobile futures. Despite the simplicity and accessibility of touchscreens, the absence of tactile interactions raises concerns about the long-term impact on human development. Some of the consequences are already visible, such as an increase in bad posture, poor eyesight or decreased attention span. The rant invites to contemplate the depth of interaction design in the context of adult capabilities, expressing the notion that a fully-functioning adult human deserves interfaces that go beyond the simplicity of existing touch-based interactions. However, it is interesting to imagine the alternatives. As discussed in the second reading, many more expressive options are simply not optimal, such as voice or gestures. Even besides their limitations, just thinking about having to control the multiple windows on my laptop with a hand gesture in a cafe or another public space makes me uncomfortable, not to mention the discomfort associated with voice commands. I think this is where a lot of difficulties emerge as well – as a society we are already on a path to a screen-based future, and some deep habits have already been formed. This is where the challenge arises. We’re already heading towards a screen-centric future, and deep-rooted habits have taken hold. Transitioning to more expressive interactions would face resistance, as significant changes are often taken pessimistically and lack widespread support. This reluctance makes achieving a shift towards more expressive interfaces even more challenging.

Week 10 – Creative Musical Instrument

Concept:

For this week, Izah and I decided to create a musical instrument based on our favorite analog sensor: the photoresistor. To do this, we decided to utilize an interesting concept to make the instrument work: an instrument that can only be played with 2 people. The idea here was to provide a completely different experience compared to traditional musical instruments. First of all, by allowing the notes only to be played with 3 hands and second, allowing to have different notes based purely on the placement of the hand (no touch). Because no traditional instrument requires 2 people to play it, we considered that this would be a greatly innovative idea.

Demonstration

 

Code highlight:

if (switchState ==1){
    //sensor 1
    if(sensorValue1 > 500){
      currentState+=100;
    }
    else if (sensorValue1>250 && sensorValue1 < 500) {
      currentState+=10;
    }

    else if (sensorValue1 < 250){
      currentState+=1;
    }

    //sensor 2
    if(sensorValue2 > 500){
      currentState+=100;

    }
    else if (sensorValue2>250 && sensorValue2 < 500) {
      currentState+=10;

    }

    else if (sensorValue2 < 250){
      currentState+=1;
    }

    //sensor 3
    if(sensorValue3 > 500){
      currentState+=100;

    }
    else if (sensorValue3>250 && sensorValue3 < 500) {
      currentState+=10;
    }

    else if (sensorValue3 < 250){
      currentState+=1;
    }

This code provides the change of currentState. Current State can be incremented in increments of 1, 10, or 100. This ensures that the state is always controlled in a way where we can always tell exactly in what level all sensors are working on. For example, if currentState = 111, then that means that there is one HIGH, one MID and one LOW state, regardless of which is which.

Challenges:

In this project, we faced multiple challenges that slowed down and hindered our development. For starters, because of the circuit that we built, being able to sustain the structure of the instrument was a big challenge we had to face. To solve this problem, we utilized a cardboard base, supported by the same paper cups we used to cover the light for the photoresistors.

Improvements:

In this case, the improvements would be related to polishing the implementation of the photoresistor detection. One of the biggest improvements we could apply would be to place all sensors at the same angle, in such a way that all of them captured the same light level initially. By doing this, the hand movements could be more streamlined and straightforward. Because we  utilized

Another possible improvement would be to solder the photoresistors and the cables together in order to provide a more solid connection and avoid some connection problems that happen every once in a while.

WEEK 10 Reflection

 

A Brief Rant on the Future of Interaction Design:

Main points

  • We take for granted the importance of touch and how much we rely on our hands. Touch is one of the, if not the most important sense out of all five of our senses. 
  • Interactivity shouldn’t be confined to the press of a finger, but rather engage our entire bodies. Only then will we be able to progress into an era of true interactivity.

Follow up article:

  • From what I could gather in the response article, the author was emphasizing the importance of further developing the technology already at our disposal. Technology cannot remain stagnant, it needs to develop and advance with us. 
  • Again the author highlights that we must NOT neglect our bodies, allowing ourselves to create a future of total immobility. We should engage all aspects of our being and ensure that we give ourselves the chance to experience true interactivity. 

Personally, I find myself extremely scared of our future. The author mentions the possibility of complete immobility in the future due to our lives becoming too heavily reliant on external technologies. To me this is so dystopian to even think about. I don’t want every aspect of my life to be consumed by technology. I want to feel HUMAN and be HUMAN.