Week 11 | Exercises

Exercise 1: 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

I used an Arduino potentiometer to change the horizontal position of the ellipse in the p5js sketch. The values read from the potentiometer are mapped to the x coordinates of the ellipse, moving it across the horizontal axis in the middle of the screen.

Video of implementation:

Code:

let left = 0;

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  fill("red");
  ellipse(left, 50, 50, 50);
}

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

function readSerial(data) {
  left = map(data, 0, 1023, 0, 400);
}

//// Arduino Code
/*

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
  int sensor = analogRead(A0);
  delay(5);
  Serial.println(sensor);

}

*/

 

Exercise 2: make something that controls the LED brightness from p5

To control the led brightness through P5JS, I created a brightness slider similar to that in our smartphones. The value of the slider is sent to Arduino to be the value of the analog write of the led and change its brightness.

Video of implementation:

Code:

let brightnessSlider;
let brightnessValue = 0;

function setup() {
  createCanvas(400, 200);

  // Create a brightness slider
  brightnessSlider = createSlider(0, 255, 128);
  brightnessSlider.position(width/2-50, height/2);
  brightnessSlider.style('width', '100px');
}

function draw() {
  background(255);

  // Get the brightness value from the slider
  brightnessValue = brightnessSlider.value();
}

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

function readSerial(data) {
  console.log(data);
    let dataToSend = brightnessValue + ", \n";
    writeSerial(dataToSend);  
}

///Arduino COde
/*

const int ledPin = 9;  // Digital output pin for the LED

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

  // Start serial communication
  Serial.begin(9600);
}

void loop() {
  Serial.println("sensor");
  // Check if data is available from p5.js
  if (Serial.available() > 0) {
    // Read the brightness value from p5.js
    int brightness = Serial.parseInt();

    // Map the received value to the LED brightness range
    brightness = constrain(brightness, 0, 255);

    // Set the LED brightness
    analogWrite(ledPin, brightness);
  }
}

*/

Exercise 3: 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

When the ball touches the ground, the value of the variable Led changes accordingly (either 0 or 1) and then sent to the Arduino to toggle the led at pin 9. For the wind effect, I used a potentiometer where its values are mapped to values between -2 and 2, making a smooth wind effect moving the ball horizontally.

Video of implementation:

Code:

let velocity;
let gravity;
let position;
let acceleration;
let wind;
let drag = 0.99;
let mass = 50;
let led = 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);
  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;
  }
  if(position.y == height-mass/2 && (velocity.y > 0.5 || velocity.y < -0.5)){ 
    led = 1;
  }else{
    led = 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 == "n") {
    // important to have in order to start the serial connection!!
    setUpSerial();
  }
  if (key==' '){
    mass=random(15, 80);
    position.y=-mass;
    velocity.mult(0);
  }
}

function readSerial(data) {

  if (data != null) {
    // make sure there is actually a message
    // split the message
    wind.x = data;

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

///Arduino COde
/*

int ledPin = 9;

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

void loop() {
  int sensor = analogRead(A0);
  int wind = map(sensor, 0, 1023, -2, 2);
  Serial.println(wind);
  delay(10);
  if (Serial.available() > 0) {
    // Read the brightness value from p5.js
    int touch = Serial.parseInt();
    // Set the LED brightness
    digitalWrite(ledPin, touch);
  }
}
*/

 

Week 11 | Final Project Idea

The concept

Embarking on the final project, my vision is to delve into the realms of robotic design and control, materializing as a remotely operated car ingeniously crafted with P5JS. This innovative creation aims to seamlessly integrate a webcam, offering users a live, visual stream on P5JS that transcends physical boundaries, enabling intuitive remote navigation, even when the car finds itself in a distant locale. A noteworthy feature includes the incorporation of a distance sensor, strategically placed to alert users and avert potential collisions, enhancing the overall safety and user experience.

The broader implications of this project are both captivating and practical. Beyond the realms of a mere technological endeavor, this remotely controlled car carries the potential to be a transformative tool. One significant application lies in aiding individuals with limited mobility, serving as a conduit for them to virtually traverse diverse spaces.

Week 11 | Reading Reflection

The reading looks into the complicated world of inclusive design, examining the obstacles and trade-offs involved in developing products that appeal to a wide range of abilities and needs. The conflict between universality and simplicity is a reoccurring subject, presenting serious concerns about the delicate balance required to achieve both accessible and user-friendly designs.

One argument highlights the difficulties and conflicts involved in designing for disability, especially in the context of universal or inclusive design. On one hand, there’s a commercial rationale for not fragmenting the market by developing specialized designs for tiny populations. In contrast, inclusive design seeks to meet the unique needs and goals of the whole population while taking into account varying abilities and preferences. I see that inclusive design is a good approach designers should always seek regardless of the financial objectives. I feel like it’s our commitment to create products and environments that are welcoming and functional for a diverse range of individuals. We don’t always have to choose between simplicity and universality; instead, we might achieve a balance that meets both needs. I think that Apple’s invention of the iPod device is a good example of this balance.

The reading also looks at examples of radios developed for specific purposes, such as assisting dementia patients. It highlights the importance of design in developing things that are not only usable but also aesthetically beautiful and emotionally engaging, even for those who have cognitive challenges. For me, it is not only about design, but about enhancing the quality of life and making daily experiences accessible for everyone.

Week 10 | Musical Instrument

Instrument: piano.

Team members:  Fady John (fje3683) and Victor Alves Gomes Nadu (va2269).

Concept

For our instrument project, we have decided to create a piano that plays different tones of the musical scale depending on the measured distance that someone is from the sensor. To build the instrument on the breadboard, we utilized an ultrasonic sensor, LEDs, resistors, and jumper wires, creating an interactive and dynamic musical experience. The analog ultrasonic sensor was responsible for measuring the distance, allowing for an intuitive interaction with the piano. As the user moves closer or farther away, the musical output changes, providing a unique take on the instrument. As for the LEDs, they add a visual element to the project besides also offering an understanding of the distance-based musical scale since they light up corresponding to the played notes.

Circuit Schematic

Figure 1

Code

In the code, we defined the specific pins used for each LED and provided the notes in the musical scale in the form of an array. Specifically, we have used the tones from C4 to C5 in the musical scale as shown in figure 3 below.

Figure 2
Figure 3

 

 

 

Reflections and improvements

Initially, we planned to create drums, but we ended up settling on a piano since that was a more feasible and practical instrument. As for improvements, currently, the distance sensor is not that accurate, which is something that could be worked on. Other than that, we have managed to create something fun and so we are proud of our work.

Week 10 | Reading Reflection

Thinking about the Microsoft Productivity Vision video and Bret Victor’s thoughts, it feels like there’s a big question about where technology is heading. The video shows a future where everything is super connected and digital, but it made me worry about losing the real experiences that make us human. Bret Victor’s point about wanting more tangible and inclusive interactions with technology makes sense. He’s saying that we shouldn’t sacrifice the good things about being human just to make technology more efficient.

It’s interesting to note that Victor grew up in a different time, which shapes his views. I get that the ‘Pictures behind Glass’ way of doing things is familiar and easy, especially for someone like me who grew up in the digital age. Still, Victor’s idea of finding a balance between the physical and digital world seems like a smart move. The challenge is to make technology work with us, enhancing our experiences instead of taking away from them. Looking at new innovations, like a pen turning physical notes into digital copies, shows a step in that direction. In short, Victor’s thoughts push us to think about how we can have the best of both worlds in our tech-filled future.

As I dove into the second article, what struck me was how people had such different reactions to where interactive media is headed. One response “My child can’t tie his shoelaces, but can use the iPad.” shows the influence of technology on people. It’s just a simple example about a child using ipad but it has more beyond it. Our interaction with technology is a double-wedged weapon. Hence, we should carefully try to use technology to have a positive impact on our life rather than negatively affecting it.

Week 9 | Analog_Digital_I/O

The concept
For this assignment, I wanted to make use of one of the sensors to automate a process. The first sensor I thought of was Grove Light Sensor, which is a module that is used to measure light intensity. The idea is simply controlling the speed of LED blinking based on the ambient brightness of the room. The system monitors brightness through the light sensor and intensifies the LED blinking speed in low-light or dark conditions, serving as a visual cue for urgent notifications.

Process
I started the assignment by creating a schematic diagram for my circuit, illustrated in Figure 1. The pivotal components include a light sensor, responsible for monitoring the ambient brightness of the room, and dynamically adjusting the blinking speed of the LEDs accordingly. Additionally, a toggle switch has been integrated into the circuit, allowing users to seamlessly switch between the two LEDs based on their preferences.
Figure 2 delves into the software aspect of the assignment. The software reads the digital input generated by the switch, ensuring a smooth and controlled transition between the two LEDs.

Figure 1
Figure 2

Video of implementation

Reflections
In this task, it was really interesting that I got to combine physical parts like circuits with software to create interactive and automated product. However, I faced some issues while designing the circuit. It was a bit confusing at the beginning to add these different components together, but I eventually figured it out by going step by step from using just a simple led to using a sensor for controlling other components.

Week 9 | Reading Reflection

Physical Computing’s Greatest hits and misses

The first article “Physical Computing’s Greatest Hits (and misses)” provides a fascinating insight into the world of interactive design, showcasing recurring themes and popular ideas in the realm of physical computing. As I read through the diverse range of projects and ideas, I could reflect on the ingenuity and creativity that arises from the fusion of technology and human interaction.
Different types of projects, like making instruments that work like theremins or devices for sending remote hugs, show how flexible and adaptable physical computing can be. Each project has its own special appeal and room for creative ideas. It highlights how important it is to think about the person using the technology when designing interactive systems. Instead of just focusing on what the machine does, these projects make sure that technology improves and reacts to what people do, making the interaction more meaningful.
Additionally, I liked how the article mentioned projects that mix different ideas. It shows that new and creative things often come from combining unrelated concepts. For example, the flight simulator, which combines a tilty controller with a big glove, demonstrates how unexpected combinations can be both surprising and enjoyable.

Making Interactive Art: Set the Stage, Then Shut Up and Listen

In this article, the author advises artists creating interactive art not to interpret their own work explicitly. Instead of providing detailed explanations and pre-scripting the participant’s experience, the focus should be on designing an environment or device that initiates a conversation with the audience. I totally agree with the writer’s perspective on creating interactive art without explicit interpretation. The idea that artists should let their audience engage with the work independently resonates deeply with my own experiences as a user not a designer.
Reflecting on my visits to art museums, I can recall instances where the lack of clear interpretation hindered my appreciation of certain works. Some pieces seemed inaccessible, their beauty obscured by ambiguity. I often found myself yearning for a more interactive and participatory experience, one that allowed me to unravel the layers of meaning at my own pace.
Overall, the article confirmed my belief in the power of interactive art, where the beauty lies not only in the creation but also in the ongoing conversation it sparks between the artist and the audience.

Week 8 | Creative Switch

Concept:
For this assignment, I wanted to set up something automated. You see, in my dorm room, I’ve got these cool, colorful LED lights that I like to switch on when it gets dark. But here’s the thing: I often turn them on when I close the window by my bed. That got me thinking: why not connect the LED with the window? So, I came up with a simple idea. Now, when I close the window, the LED light automatically pops on. And when I open the window, it goes off. It’s like a little automation trick to make my room feel cozy without me even lifting a finger.

Process:
I’ve put together a basic circuit here. It’s pretty straightforward – just one resistor and one light bulb. I connected the wires and fixed a little coin to the end of each wire. At the bottom of the window, I stuck a sheet of aluminum foil. When I shut the window, those two coins make contact with the foil, and that’s when the circuit completes. The light bulb lights up when they touch the foil.

Video of implementation:

Reflections:
This assignment was so fun and I really liked that I did something that is very interesting for me. The only problem I encountered was attaching the board to the window, but I managed to solve it in no time. Another aspect that could be improved is the choice of materials. I used basic items like coins and aluminum foil, which I believe may not be the most suitable options for projects like this.

Week 8 | Reading Response

Emotion & Design: Attractive things work better

Norman’s article explains the often misunderstood relation between design, usability, and aesthetics. It’s a refreshing perspective that challenges the notion that usability and beauty are at odds with each other. Instead, he suggests they can and should coexist, creating products that are not only functional but also visually pleasing.

I found Norman’s personal examples, like his collection of teapots, to be relatable. It’s a reminder that the objects we use daily can be more than just tools; they can be sources of joy and satisfaction. The idea that an attractive design can make a product work better may sound unconventional, but it resonates with my experiences in web development. Often, web visitors experience better browsing and interactivity with a webpage if it is visually appealing.

The discussion about the impact of emotions on design is particularly interesting. Norman’s insights into how positive and negative affect can influence our cognitive processes and decision-making make me rethink the relationship between our emotions and the things we interact with daily.

Her Code Got Humans on the Moon

Margaret Hamilton’s story underscores the significance of gender diversity in the tech field. It prompts us to reflect on the ongoing gender disparity that still plagues the industry. While there has been some progress, we’re far from achieving true gender equality in tech. Indeed, some studies specifically focused on software developers suggest that as few as 8-10% of all software developers are female [1]. Hamilton’s journey from an era when women were discouraged from pursuing high-powered technical roles to becoming a pioneering figure in software engineering is incredibly inspiring.

What strikes me most is Hamilton’s unwavering determination and resilience. Her ability to lead a team, make critical technical decisions, and solve complex problems during the Apollo project is a testament to her expertise and commitment. Her dedication to perfection and her diligence in addressing potential issues serve as a valuable lesson in the importance of rigorous testing and debugging in software development. Moreover, we need to keep in mind the time when she was working, especially in terms of technological progress. Just picture this: the thousands of lines of code we can effortlessly write, compile, and debug in a matter of seconds today were back then written and meticulously refined using the available technology of that era. Here is her photo [2] while standing next to listings of the Apollo Guidance Computer (AGC) source code.

Hamilton stands next to listings of the Apollo Guidance Computer (AGC) source code.

 

Resources:

[1] https://jetrockets.com/blog/women-in-tech-why-are-only-10-of-software-developers-female
[2] https://www.wired.com/2015/10/margaret-hamilton-nasa-apollo/

Week 6 | Midterm Project

The Concept:
In this engaging “Chromamood” game, players take control of a catching hand, moving it through the game screen width. The objective is to collect words falling from the top of the screen. These words encapsulate various human moods, such as “happy,” “calm,” and “excited.” But the interesting part of the game lies in its categorization system. These words are neatly organized into distinct categories, with each category intimately linked to a unique display color and an associated score. As players adeptly gather these words, they trigger a series of cascading effects. The real magic happens as the words are seamlessly woven into the live video feed, enhancing the text display in the most visually enthralling way possible. The text dynamically updates, with its color shifting harmoniously, reflecting the precise word that the player has successfully captured.

Why “ChromaMood”?
The name “ChromaMood” is a fusion of two essential elements in the game. “Chroma” relates to color and represents the dynamic background shifts triggered by the words collected, where each mood category is associated with a distinct color. “Mood” encapsulates the central theme of the game, which revolves around collecting words that express various human emotions and moods

How the project works:
The game starts on a welcoming screen with the title “ChromaMood” and two options: “start” and “help.” Clicking “start” leads you to the main game screen. Here, you’ll see a hand-shaped object set against a black background, with words falling from the top. The game’s twist is in the words you catch. Each word represents a different mood, like “happy” or “angry,” and it impacts the background and your score. For example, catching words associated with anger turns the background red and gives you a score of 2. The words on the background change too. The goal is to get the highest score by collecting words that reflect positive moods within a limited time.

Welcoming Screen
Chromamood In-game Screenshot

Code Highlight I am proud of:
The part of the game I am proud of is developing the video display background as I had no idea of how to do it. It required somehow intricate coding to seamlessly integrate dynamic text updates with the live video feed, ensuring a cohesive and engaging user experience. The idea is that I am dealing with the sketch as pixels. So, I update the pixels with every character of the words the player catches. Honestly, it was challenging for me to do it but I watched some tutorials and managed to figure it out.

Sketch:
The video and sound effects are not working in the embedded iframe below. Open it on P5JS editor for better experience.

Soma areas of improvement:
A potential enhancement to consider is shifting the way we control the hand object. Instead of relying on traditional keyboard controls, we could explore the possibility of tracking the player’s movements in the live video feed. By doing so, we could introduce a new level of interactivity, allowing players to physically interact with the game. This change not only simplifies the game’s control mechanics but also aligns perfectly with its fundamental concept. It would create a more immersive experience, where players can use their own motions to catch the falling words, making the game even more engaging and unique.