Week_11_Reading Response

The most interesting idea raised by the article is shifting assistive devices from hiding the disability to embracing design. Glasses were used as an example of a good design that became a fashion trend rather than a clinical tool. But apart from its simple structure and variability in shapes and forms, I would tend to believe that another reason classes is such a success is because nearsightedness is increasingly common, and the variety of design came from the variety of needs. This idea could also insipire designerd to look at what the disabled group actually want for their assistive devices.

The other idea mentioned about not overburdening the device with features relates to one of the other readings in the past weeks about the realationship between mood, design and usability. Keeping the design simple would make it easy and good to use, but would lack emotional function. Adding design to the devices would add emotional support, which would also help bring a more possitive view to disabilities, making it less of a thing to be ashamed of. This would in turn generate more interest in design of diasbility aid and  actively catalyze and inspire broader design culture.

Week 11 – Serial Communication

Repository

Repository

Exercise 1

1. Overview

In this exercise, we explored serial communication between Arduino and p5.js. The main objective was to use a single sensor on Arduino and translate its input into visual movement in p5 — specifically controlling an ellipse moving horizontally across the screen. A potentiometer connected to pin A1 served as the analog input, and no data was sent back from p5 to Arduino, making this a one-directional communication exercise.

2. Concept

The core idea was to establish the simplest possible link between a physical input and a digital visual. By turning a potentiometer, the user directly moves an ellipse across a canvas in the browser in real time. This introduced us to the fundamental pipeline of physical interaction: sensor reads a value, Arduino maps and sends it, p5 receives and translates it into something visible on screen. The simplicity of the setup made it easy to trace the data flow end-to-end and understand what was happening at each stage.

3. Process and Methods
    • We began by following the example demonstrated in class and gradually adapted it to better understand the data flow. On the Arduino side, the potentiometer on pin A1 returns a raw analog value between 0 and 1023. We mapped this to a smaller range of 0–255 using map() before sending it through Serial.println(). This made the value easier to work with on the p5 side without losing meaningful range.
    • For p5.js, we used the p5.webserial library following the structure introduced in class. The serial connection is opened manually through a button, which triggers the browser’s port picker dialog. Inside draw(), port.readUntil(“\n”) reads each incoming line, trim() strips the newline character, and int() converts the string into a usable number. That number is then mapped to the canvas width using map(), which drives the ellipse’s horizontal position. The ellipse stays fixed on the vertical centre of the canvas at all times.
4. Technical Details
    • The Arduino maps the raw potentiometer value before sending it to reduce the range to something the p5 side can easily stretch across the canvas:
// ── READ SENSOR ──
// analogRead returns 0–1023 based on the voltage at A1.
// At 0V (GND side) → 0. At 5V → 1023.
int potentiometer = analogRead(A1);

// ── MAP TO SMALLER RANGE ──
// Compress 0–1023 to 0–255 so p5 can easily map it onto the canvas width.
int mappedPotValue = map(potentiometer, 0, 1023, 0, 255);

// ── SEND TO p5 ──
// Serial.println() sends the number as a string followed by a newline character '\n'.
// p5 uses that newline to know where one value ends and the next begins.
Serial.println(mappedPotValue);
    • On the p5 side, the incoming string is cleaned and converted before being mapped to a screen position:
let str = port.readUntil("\n");

if (str.length > 0) {
  // trim() removes the trailing '\n' (and any spaces).
  // int() converts the cleaned string into a number.
  let val = int(trim(str));

  // ── MAP VALUE TO CANVAS ──
  // Arduino sends 0–255. We stretch that range across
  // the full canvas width so the ellipse covers the
  // entire screen as the pot is turned.
  x = map(val, 0, 255, 0, width);
}
    • This two-step mapping — first on Arduino from 0-1023 to 0-255, then in p5 from 0-255 to 0-canvas width — demonstrates how data can be progressively transformed as it passes between systems.
5. Reflection

This exercise gave us a concrete understanding of how physical input can directly influence digital visuals in real time. The most valuable part was seeing the full pipeline in action: turning the potentiometer caused an immediate, visible response on screen, which made the abstract idea of serial communication feel tangible. It also highlighted the importance of consistent data formatting — the newline character that Serial.println() appends is what makes port.readUntil(“\n”) work reliably on the p5 side. If we were to continue developing this, we would explore using different sensors such as FSR or ultrasonic distance sensors, add smoothing to reduce noise, and expand the visuals to control more than one element.

Exercise 2

1. Overview

In this exercise, we reversed the direction of communication — from p5.js to Arduino. The objective was to control the brightness of a physical LED using mouse movement in the browser. p5 continuously sends a brightness value based on the mouse’s horizontal position, and Arduino uses that value to dim or brighten the LED through PWM. No data is sent back from Arduino to p5.

2. Concept

Where Exercise 1 used hardware to control software, this exercise flipped that relationship. The browser became the controller and the LED became the output. Moving the mouse across the screen is a familiar, intuitive gesture, and seeing that gesture reflected immediately in a physical light made the connection between the two systems feel direct and satisfying. This exercise also introduced us to the handshake pattern, which is necessary when Arduino needs to wait for p5 to be ready before the communication loop can begin.

3. Process and Methods
    • We kept the overall structure close to what was demonstrated in class and simplified the communication to a single value per message. On the p5 side, mouseX is mapped to a range of 0–255 using map() and constrained with constrain() to prevent out-of-range values. This number is sent to Arduino as a string followed by a newline character using port.write().
    • On the Arduino side, the sketch begins with a handshake loop that repeatedly sends “0” and blinks the built-in LED until p5 responds. Once connected, Serial.parseInt() reads the incoming integer from the serial buffer. After confirming the message ends with ‘\n’, analogWrite() applies the value to the LED on pin 5. Because analogWrite() requires a PWM-capable pin, the LED must be connected to one of the pins marked with a tilde (~) on the Arduino board — in our case, pin 5.
4. Technical Details
    • The p5 sketch maps mouse position to brightness and sends it continuously while the port is open:
// ── CALCULATE BRIGHTNESS ──
// Map the mouse's horizontal position across the canvas
// to a brightness value in the range 0–255.
// This matches the range that analogWrite() accepts on Arduino.
let brightness = int(map(mouseX, 0, width, 0, 255));

// ── CONSTRAIN ──
// Clamp the value so it never exceeds 0–255,
// even if the mouse moves outside the canvas.
brightness = constrain(brightness, 0, 255);
// ── SEND TO ARDUINO ──
// Only write if the port is open (i.e., user has connected).
// We append '\n' so Arduino's Serial.read() can detect
// the end of the message after parseInt() runs.
if (port.opened()) {
  port.write(brightness + "\n");
}
    • Arduino reads the value and applies it to the LED:
// ── READ BRIGHTNESS ──
// parseInt() reads digits from the buffer and returns them as an integer. 
// It stops at any non-digit character (including the newline).
int brightness = Serial.parseInt();

// ── CONFIRM COMPLETE MESSAGE ──
// After parseInt(), the next character should be '\n'.
// This confirms we received a full message and not a partial one, preventing corrupted values.
if (Serial.read() == '\n') {

  // ── SET LED BRIGHTNESS ──
  // analogWrite(pin, 0–255) uses PWM to control brightness.
  // 0 = fully off, 255 = fully on, values in between = dimmed.
  analogWrite(ledPin, brightness);
}
    • The ‘\n’ check after parseInt() is important — it confirms that a complete message was received before acting on the value, which prevents the LED from responding to corrupted or partial data.
5. Reflection

This exercise made the communication feel more interactive than Exercise 01, because the browser was no longer just a display — it was actively sending instructions to hardware. The main issue we encountered was that the LED did not dim smoothly at first. After checking the wiring, we found the LED was connected to a non-PWM pin, which meant analogWrite() had no effect. Moving it to pin 5 resolved this immediately. This was a useful reminder that the physical wiring must match the assumptions in the code. If we were to continue, we would replace mouse control with a more interesting interaction such as key presses or dragging, add multiple LEDs with independent brightness values, and eventually expand into bi-directional communication.

Exercise 3

1. Overview

This exercise brought together everything from the previous two by implementing full bi-directional communication between Arduino and p5.js. A joystick connected to Arduino controls the wind force in a physics simulation, while p5 sends a signal back to Arduino to light up an LED every time the ball bounces. Data flows in both directions simultaneously.

2. Concept

The gravity and wind sketch provided a compelling context for bi-directional communication because it has two clearly distinct interactions that naturally map to each side: the joystick controls something in the simulation, and something in the simulation triggers a response on the hardware. Rather than the user controlling a parameter directly, the LED reacts to an event — a bounce — which made the physical and digital feel genuinely connected rather than just linked. Replacing keyboard input with a physical joystick also made the experience more immersive, since it gave the user a tangible way to influence the simulation.

3. Process and Methods
    • We started from the gravity and wind example provided in class and kept the simulation structure mostly unchanged. The main modifications were replacing keyboard-based wind control with joystick input, and adding bounce detection that communicates back to Arduino.
    • On the Arduino side, the joystick’s horizontal axis is read from pin A0 using analogRead() and sent to p5 via Serial.println() after every incoming message. On the p5 side, the value is read with port.readUntil(“\n”), trimmed, converted to an integer, and mapped from 0-1023 to a wind force range of -1 to 1. This value is applied to the wind vector each frame, so tilting the joystick left or right pushes the ball accordingly.
    • For the return signal, we added bounce detection inside draw(). Each frame, a variable bounced is initialised to 0. If the ball hits the floor with a downward velocity greater than 2, it is counted as a real bounce and bounced is set to 1. This value is sent back to Arduino using port.write(). Arduino reads it with Serial.parseInt() and calls digitalWrite() to turn the LED on or off.
4. Technical Details
    • The bounce detection uses a velocity threshold to distinguish real impacts from the small residual movements that occur when the ball settles on the ground:
  // ── BOUNCE DETECTION ──
  let bounced = 0;                    // assume no bounce this frame
  let floorY = height - mass / 2;    // y where ball touches the floor

  if (position.y > floorY) {
    position.y = floorY;   // prevent ball from going below floor

    // ── VELOCITY THRESHOLD ──
    // Only count as a real bounce if the ball hits with enough
    // downward speed (> 2). This filters out the tiny movements when the ball is nearly at rest
    // Would otherwise cause the LED to flicker continuously.
    if (velocity.y > 2) {
      velocity.y *= -0.9;   // reverse and reduce (energy loss on impact)
      bounced = 1;           // signal a real bounce to Arduino
    } else {
      velocity.y = 0;        // ball has come to rest — stop it completely
    }
  }

  // ── SEND BOUNCE STATE TO ARDUINO ──
  // Sends 1 if a real bounce happened this frame, 0 otherwise.
  // Arduino uses this to briefly light the LED on each bounce.
  // '\n' is appended so Arduino can confirm end of message.
  if (port.opened()) {
    port.write(bounced + "\n");
  }
}
    • On the Arduino side, the received state is applied directly to the LED:
// ── READ LED STATE FROM p5 ──
// p5 sends '1' when a bounce is detected, '0' otherwise.
// parseInt() extracts the integer from the incoming string.
int ledState = Serial.parseInt();

// ── CONFIRM COMPLETE MESSAGE ──
// Check for the newline that p5 appends with port.write().
// This prevents acting on partial or corrupted values.
if (Serial.read() == '\n') {

  // ── CONTROL LED ──
  // ledState is 1 (HIGH) when p5 detects a bounce → LED on.
  // ledState is 0 (LOW) otherwise → LED off.
  digitalWrite(ledPin, ledState);
}
    • The joystick read and send happens inside the same while (Serial.available()) block, directly after the LED state is processed. This keeps the two directions of communication tightly coupled within each communication cycle.
5. Reflection

This was the most technically demanding exercise of the three, and also the most rewarding. The biggest challenge was the LED flickering continuously when the ball came to rest on the ground. Even though the ball appeared stationary, the physics simulation kept generating tiny downward movements due to gravity, which the system kept interpreting as bounces. Introducing the velocity threshold velocity.y > 2 solved this cleanly and also taught us something broader: physics simulations produce continuous, noisy output, and meaningful events often need an explicit threshold or condition to be extracted from that noise. If we were to continue, we would add a dead zone to the joystick centre to reduce drift, use both joystick axes for more complex motion, and add more LEDs to represent different simulation events.

6. Resources

Week 11 — Reading Response

What struck me most about Pullin’s argument is the way he reframes concealment — not as a neutral design default, but as a value judgment quietly embedded in every flesh-toned hearing aid and skin-matching prosthetic. I’d always assumed that “discreet” design for disability was simply considerate, a way of respecting the user’s desire to blend in. Pullin destabilizes that assumption by asking who decided blending in was the goal in the first place. The eyeglasses example is effective precisely because it’s already resolved: nobody today apologizes for visible frames or tinted lenses, and the question of why hearing aids can’t occupy the same cultural space is genuinely difficult to answer without exposing some discomfort about how disability is perceived. What this raises for me is whether the concealment instinct in design is a response to user needs or a projection of the designer’s own unease — and whether those two things are even distinguishable in practice. If a designer has never lived with a hearing aid, their intuition about “what users want” is shaped by imagining the stigma from the outside, which may be a very different thing from what someone actually navigating that stigma would choose.
The tension I keep returning to is the one between designing for expression and designing for choice — and I’m not sure Pullin fully resolves it. His most compelling cases, like Aimee Mullins’ carved wooden legs, work because they belong to a specific person with a specific relationship to visibility and performance. But what interests me is the middle ground he gestures at: the user who neither wants to pass as non-disabled nor be conscripted into a narrative of disability-as-spectacle they didn’t ask for. That unresolved space feels like the honest core of the book, and it connects for me to broader questions in interaction design about whether personalization is a solution or a way of deferring a harder design decision. Giving users options is good, but the options still frame what’s possible — and right now, as Pullin shows, the frame has been set almost entirely by clinical priorities and the discomfort of people who aren’t disabled. That framing shapes perception in ways I hadn’t fully considered before reading this.

Week_11_Assignment

Schematics

Video Demo

P5 code

https://editor.p5js.org/JingyiChen/sketches/8ggtbgHZV

I made changes to the code to include the serial communication components and also adjust the LED logic slightly so it would fit the bounce better. The code for serial communication was all adapted from the week 11 example 2 bidirectional communication example.

//original bounce code, but it doesnt work well if I put the ledState deciding if else in here.
if (position.y > height - mass / 2) {
  velocity.y *= -0.9; // A little dampening when hitting the bottom
  position.y = height - mass / 2;
}
//so I added another if statement to individually decide whether the LED should light up according to ball y position
//first line creats a 15 pixel range near the bottom line for the led to light up, to prevent the glitch like blinks that would happen with the original bounce code.
if (position.y > height - mass / 2 - 15) {
  // Use the absolute of the velosity so the ball triggers the LED on both the way down and up
  if (abs(velocity.y) > 2) {
    ledState = 1;
  } else {
    ledState = 0;
  }
} else {
  //if the ball is not within the 15 pixel range
  ledState = 0;
}

This code snippet is where I added some logic to make the LED poerform more in sync with the bounce. Originally I added the ledStae changee directly to if (position.y > height – mass / 2){}, which resulted in a bit of a glitchy looking blink, which I think might have to do with the very small time frame on the on signal and the time it takes for the information to be communicated between p5 and arduino. So I added another if statement to have the LED turn on when the ball is in a 15 pixel range above the bottom line, and also checked the velocity so the led does not stay on when the ball is barely bouncing or stationary. This make the led a lot more stable and light up correctly every bounce.

Arduino code

https://github.com/JingyiChen-jc12771/Intro-to-IM/blob/8f5bdbc0282acbce4a7edea2334f1305c493216c/W11_01_serial_simple_potentiometer.ino

The arduino code is also adapted from the week 11 example 2 bidirectional communication example. I changes the code very slightly so it would reflect the wiring of having only one input from the potentialmeter.

Difficulties and areas for improvemment

The biggest difficulty was the glitchy blink when I added blink code to the original code. I spend some time trying to figure out why but because I couldnt find anything wrong with the p5 or arduino code I had to guess it was timing differences. It would have been better if I had been able to uncover the root cause of the problem and figured out how to solve it in the original code.

 

 

Week 11 – Serial Communication

Exercise 1

Demo:

Schematic:

Implementation:

  • Arduino
    • I began by setting up a simple circuit with an ultrasonic sensor to control the circle’s position in p5 using my hand’s distance from the sensor.
    • For the code, I used the same distance calculating code I used in one of my previous assignments that used the ultrasonic sensor. The only thing I changed is
      void loop(){
      //...
        Serial.println(mappedDistance);
      //...
      }

      where I used println instead of just print, so that a new line is printed with every write to the serial monitor.

  • p5:
    • I used the same connection logic from the class example using the “click to connect” button. Then, I read from the serial monitor and convert the string it reads into a value. Then, I draw the ellipse and insert the x-value we read from Arduino into its appropriate place in the parameters.

Exercise 2

Demo:

Schematic:

Implementation:

For this exercise, I used a slider on p5 to control the brightness of an LED on my Arduino.

  • Arduino:
    • I started by setting up a simple circuit with one LED light connected to pin 9
    • For the code, it reads the incoming values from p5, then it constrains the incoming value to be between 0-255 to match the values for brightness, and then it analogWrites the value to the LED.
  • p5:
    • I used the createSlider() function to create a simple slider that controls the LED’s brightness. The slider ranges from 0-255 and by default sets to 127, the halfway point.
    • I, again, used the connect button logic to prompt the browser to connect to the Arduino
    • In the draw function, the slider’s value is read. If the port is open and the connection is established with the Arduino, then p5 sends the slider’s value as a string followed by a newline character “\n” so Arduino knows when a full value has arrived. It also displays the “Disconnect” text on the button if the port is open. If the port is closed, it shows “Connect to Arduino” on the button. The current brightness value is also displayed as text on the canvas

Exercise 3

Demo:

Schematic:

Implementation:

  • Arduino
    • For my circuit, I connected a potentiometer and an LED light to pins on the Arduino
    • For the code, it can be divided into two main sections: sending information from the potentiometer to p5 and receiving information from p5 for the LED
      1. Potentiometer:
        • It reads the potentiometer’s value
        • It maps it from 0-1023 to -100-100 and divides my 100.0 to get a float value. This gives us a good range for the wind variable in the p5 sketch (-1 to 1)
        • It prints the mapped value to the serial monitor using println() to send the data to p5
      2. LED:
        • It checks if data has been received and reads it
        • If the data reads ‘H’ for HIGH, then it turns on the LED, else if it’s ‘L’ for LOW then it turns off the LED
  • p5:
    • For the wind, it reads the value through the port from Arduino and just sets the wind’s x value to the pot’s value
    • For the ball, when it hits the bottom of the screen it sends an ‘H’ to Arduino to signal the LED to turn on, and when the ball is in the air it sends an ‘L’ to signal the LED to turn off.

Reflection

Due to the nature of the tasks and their specific requirements, I found it a bit difficult to get creative with my ideas for each exercise; however, they were an excellent way to familiarize myself deeply with serial communication and test my knowledge.

Arduino/P5 Exercises

https://drive.google.com/drive/folders/17BOPjKsdqArQirTPjNIaXM87Vg7DWi_E?usp=sharing

Exercise 1: change horizontal position of ellipse

https://github.com/da3755-ui/intro-to-im/blob/4715fd118fa2091c8d727f6e3131c1cfebcfeccd/p5_to_ardunio_example1.ino

references:

https://stackoverflow.com/questions/1133770/how-can-i-convert-a-string-to-an-integer-in-javascript

Exercise 2: control led brightness from p5

https://github.com/da3755-ui/intro-to-im/blob/4274788ff7e0d80f2de29f5b4b86e653817c0fcc/P5_arduino_exercise2.ino

Exercise 3: bidirectional

https://github.com/da3755-ui/intro-to-im/blob/b749d30cee9ae91995d3ad61607f140d6e2135fd/P5_AND_ARDUINO_EX3.ino

 

 

Week10

This reading reminded me of when I was getting my first glasses. I was well aware that even thou I need glasses to see things clearly. They are gonna be much more than that. They will become an integral part of my outlook. Which directly aligns with the authors idea of eyewear being a from of expression and how they overlap in terms of fashion and disability. Glasses in specific have a far greater effect of ones well being. but then thinking about it in a way that such a self expression can become mandatory. It is a scary idea. because then it is something that cages the freedom of self expression. The second aspect of the reading was hiding disability. It is indeed a psychological take that hiding something extra to give a sense that its not there. It reminds me of a saying that “The more you try to fill a shoe that is not yours , the emptier the look” What is intended to be a assistance can backfire in worse way. A solution can create a problem that is far more problematic then the original problem.

 

Week 11: Reading Response

This week’s reading, Design Meets Disability, made me realize how limited my understanding and awareness of design in this aspect was. I initially thought that design in functional contexts was mainly about creating something accessible for problem-solving. I also thought that disabilities were something people might feel worried or concerned about when it comes to appearance. What really stuck with me was the idea that disability can actually inspire mainstream design, not just be something that adapts to it. I was particularly interested when I read the discussion about glasses, as I never really thought of them as related to a serious disability, and that is because of how normalized they are nowadays. People who need glasses wear them openly, and they come in many different styles from different brands. Along with this, the example of the Eames leg splint showed how something designed under strict constraints for injured soldiers led to completely new techniques that later influenced furniture design. This made me understand that disabilities are not always limitations, but can actually lead to innovation.

Moreover, comparing this to hearing aids made the contrast very clear, where focusing too much on hiding them can limit both their function and how people feel about using them. This also made me think of different applications, and the one that stood out most to me was prosthetic arms and legs. They started off as very visible and mechanical, made of materials like metal or wood, but with improvements, they are becoming more realistic, and sometimes even designed in creative ways. I felt like this shows a combination of both hiding the disability and expressing design, which highlights how complex this topic can be. Overall, this reading made me realize that design is not just about fixing an issue, but also about experimenting and thinking beyond it. This connects a lot to the work we do, because I sometimes focus too much on making something work, without thinking about how I can push it further or make it more creative.

Week 11: Bidirectional Communication Exercises

Exercise 1:

P5 code:

https://editor.p5js.org/farahshaer/sketches/K1ETNJevI 

Arduino code:

https://github.com/farahshaer/Intro-to-IM/blob/15f03b7108b0eead04ecc8fbade23e0703c774e4/sketch_apr16a.ino 

Process:

So for the first part, it was a one way communication between arduino and p5 with the idea of taking an input from a sensor on arduino and using that data to control the circle on p5. I used a potentiometer as my sensor because it gives a smooth range of values which makes it easier to control the movement on the screen. The arduino reads the values and sends it to p5 using serial.prin1n(). Then in p5 I used readUntil(“\n”) to receive the data and once I got that value I cleaned it using trim() and converted it into a number using int(). Then I map it from the sensor range to the width of the canvas so it can control the x position of the ellipse. As I turn the potentiometer, the circle moves left and right on the screen. 

Exercise 2:

P5 Code:

https://editor.p5js.org/MariamAlameri/sketches/oWfNkocIc 

Arduino Code:

https://github.com/mariam9766/Intro-to-IM/blob/736de2e50c777dff22b3545885aebfa6cce33cfd/BidirectionalCommunicationExercise2_mariam.ino 

Process:

The second exercise involved bidirectional communication between p5 and Arduino, where we were asked to control the Arduino from p5. I wanted to create a p5 sketch that allows the user to control the brightness of an LED on the Arduino board. I chose to use a slider in the sketch, as it provides an intuitive and suitable way to adjust brightness. I also referred to the exercises completed in class and adjusted them to meet the purpose of this assignment. In the Arduino code, I used two if statements to ensure that the LED responds when data is received from p5, and to constrain the brightness value within the range of 0–255 for proper PWM control. In the p5 sketch, I implemented the slider using createSlider, adjusted its position and appearance, and used port.write to send the brightness value to the Arduino, allowing accurate control of the LED.

Exercise 3:

Concept:

After completing the first two exercises and creating communication between the p5 sketch and the Arduino code and board back and forth, in this exercise we had to combine both. When the ball in the p5 sketch bounces on the ground, the LED on the board flashes on and off, and when we use the potentiometer, which is the analog sensor on our Arduino board, we control the wind in the sketch and move the ball left and right.

P5 Code:

https://editor.p5js.org/farahshaer/sketches/hAwlRZjXM 

Arduino Code:

https://github.com/mariam9766/Intro-to-IM/blob/9f561f01e2719a784d6c54e8d43e4bbc998a6608/BidirectionalCommunicationExcercise3_mariam.ino 

Demonstration:

Circuit:

Schematic:

Code we’re proud of:

One part of the code that we are proud of is the bounce detection and how it connects to the Arduino:

//the bounce detection
  if (position.y > height - mass / 2) {
    //check if the ball hits the ground
    velocity.y *= -0.9; // A little dampening when hitting the bottom (reverse the direction when it hits)
    position.y = height - mass / 2; //keep it above the floor
    bounce = 1; //to mark that the bounce happened
  }
  //send to arduino
  let sendToArduino = bounce + "\n"; //send the bounce value 1 or 0 and the "\n" tells ardunio the message is done
  port.write(sendToArduino);
  // reset bounceafter it sends
  bounce = 0;
}

We are proud of this part because it turns the ball bouncing into a signal that affects something physical (the LED). It also only sends the signal once per bounce, which makes the interaction feel more intentional instead of constant.

Process:

So in this version of the gravity and wind example, I added serial communication so the sketch can interact with an Arduino on p5. Instead of controlling the wind using the keyboard like in the original example, the wind now comes from an analog sensor (like a potentiometer) connected to the Arduino. The Arduino sends that sensor value to p5, and I map it to a wind force so it pushes the ball left or right. I also added a bounce signal that goes the other way. Every time the ball hits the bottom of the canvas, I set a variable to 1 and send it to the Arduino. This tells the Arduino to briefly turn on an LED, then it gets reset back to 0 so the signal only happens once per bounce. Most of the original physics code stayed the same, but the main changes were adding serial setup, reading sensor data to control wind, and sending a bounce message back to control the LED.

For the Arduino side, I worked on the Arduino code to align with the p5 sketch we have and create serial communication from the Arduino board to the p5 sketch and vice versa. I set it up so the Arduino sends the analog sensor value from A0 to control the wind on the ball on the sketch, and receives a bounce signal from p5 when the ball hits the ground. When this signal is received, the Arduino briefly turns on an LED to indicate the bounce, and then resets the value so the LED only activates once every time it touches the ground. I also made sure the serial communication was properly structured so both inputs and outputs work smoothly together at the same time, allowing interaction between the physical sensor and the digital sketch.

Reflection:

This exercise helped us understand how bidirectional communication actually works, instead of just sending data one way. It was interesting to see how the Arduino and p5 sketch can influence each other at the same time. One challenge we ran into was getting the potentiometer to properly control the wind. Even though the LED response worked, the sensor input was inconsistent, which made it harder to debug whether the issue was in the Arduino code or the p5 code. This made us realize how important timing and serial communication structure are, especially when both sides are sending and receiving data continuously.

If we had more time, we would focus on possibly smoothing the wind movement so it feels less jumpy. We would also experiment with adding more physical outputs, like multiple LEDs or different types of sensors, to make the interaction more dynamic but we just wanted to stick with the assignment instructions for now to get a grasp of the concept.

Final Project: Textile Pattern Machine

For my final project, I want to create a physically interactive pattern machine that uses Arduino controls to generate and transform digital patterns in p5. Instead of drawing directly on the screen, the user would control the structure of the pattern through physical input. I want the project to feel more like an artwork than a tool, where the physical controls shape a visual composition in real time. Right now, I am thinking of using potentiometers and buttons so the user can change things like the density of the pattern, the size of the shapes, the color palette, or the type of pattern being generated.

The Arduino side of the project would be responsible for reading the physical input, and the p5 side would process that input and turn it into the visual response on screen. For example, buttons could be used to switch between different pattern types or different color modes. For this project, I took inspiration from patterns I see in rugs, embroidery, traditional clothes, and decorative geometric designs. I am especially interested in the way these patterns use repetition, symmetry, borders, and structured color palettes to create a full composition. Because of that, I want to make something that feels artistic while still having a clear interaction system.

For the visual direction, I want the patterns to feel more designed than random. I am interested in geometric repetition, floral motifs, textile-like patterning, and decorative compositions that change in response to the user. I do not want it to just feel like shapes moving around on a screen. I want it to feel like the user is shaping a system that produces a full visual composition. Some of the references I collected have a central medallion structure, some are more grid-based and repeated like tiles, and others are softer and more floral. I am still deciding exactly how the final look will come together, but I know I want the visuals to feel cohesive, decorative, and intentional.

For inspiration, I am looking at rug patterns, embroidery, geometric ornament, floral textile designs, and repeated decorative motifs. What I am most drawn to in these references is the use of repetition, symmetry, borders, and controlled color palettes. I also want to look at p5 pattern and symmetry examples, repeated shape systems, and tutorials related to mapping Arduino input into visual parameters in p5. For the Arduino side, I will likely look back at the potentiometer and button examples, and for p5 I want to look at examples that use repetition, grid systems, tiling, and color palette switching.

Images:

This is an AI generated image that gives a more concrete example of my project:

References: