Afra Binjerais – Week 9 assignment

Unusual Switch – Drink Me

For this assignment, I really struggled being creative, maybe because I’m fasting 🙂

I explored various metals in my room to discover a novel method for illuminating an LED. Eventually, I decided to use a metal straw as the conductor between two wires. By placing it in a cup and using my mouth to press the straw onto the wires, the LED lights up.

This is what my Arduino looked like:

Those two white wires were taped on the table, very close to each other but not touching.

I covered it with a cup to create the effect of drinking.

My niece volunteered to demonstrate this project. This is the LINK to the video

Lastly, this is my code:

const int ledPin = 2;      // Use pin 2 to control the LED
const int touchPin = 7;    // Use pin 7 to read the touch state

void setup() {
  pinMode(ledPin, OUTPUT);    // Initialize the LED pin as an output
  pinMode(touchPin, INPUT_PULLUP); // Initialize the touch pin as an input with internal pull-up resistor
}

void loop() {
  int touchState = digitalRead(touchPin); // Read the state of the touch pin
  
  if (touchState == LOW) {   // If wire A touches the wire on line 5, it will be LOW
    digitalWrite(ledPin, HIGH); // Turn on the LED
  } else {
    digitalWrite(ledPin, LOW);  // Turn off the LED
  }
}

I really enjoyed making this switch, and seeing it work at the end was truly rewarding.

Pi : Fwitch – A Flute Controlled Steampunk Switch

Guitar is overrated 🎸😒. Anyone who got impressed by a electric guitar controlled cyberpunk game should seriously raise their standards.

When I am not working on brain controlled robots, I look after my child, called The Tale of Lin & Lang,  which is a fictional universe where Industrial Revolution began in East Asia (China/Korea/Japan), and a re-imagination of alternative history. In that world, there are steampunk inventors who invent computers, clockwork, machines … and there are also artisans who plays the traditional bamboo flute (笛子 – dízi).

Well, that’s fiction…. or is it 🤔? Well, in real life, I am also a bamboo flute player and an inventor, and a steampunk enthusiast…. so I present Fwitch, a flute controlled steampunk switch.

Below is the complete demonstration.

HOW IT WORKS

It’s a switch, so nothing complicated. One end of the wire needs to go and meet another wire… I am just driving the motion using 2 steampunk style gears I 3D printed and painted.

When I blow the flute, the laptop mic listens to my flute volume, and above a particular threshold, will establish a serial connection to arduino and tell the servo motor to rotate to a particular degree. And with another note from the flute, it will toggle the switch. Simple.

The servo I am using is quite large (because the gears are large), hence I need an external power supply. It is hidden in the container below to be neat and tidy.

And yes, I am using a Chinese clone mega board.

Below are close up shots.

CODE

The following python code listens to the microphone on my computer, and above a particular volume threshold, it will send switch on and off signal through serial to arduino. I could have used a mic and do everything on arduino, but could not find one, so decided to use my laptop mic.

import pyaudio
import numpy as np
import os
import time
import serial
import serial.tools.list_ports

switch_on = False
volume_threshold = 30  # Configurable threshold
switch_toggled = False  # Flag to track if the switch was toggled

def clear_screen():
    # Clear the console screen.
    os.system('cls' if os.name == 'nt' else 'clear')

def list_serial_ports():
    ports = serial.tools.list_ports.comports()
    return ports

def get_volume(data, frame_count, time_info, status):
    global switch_on, switch_toggled

    audio_data = np.frombuffer(data, dtype=np.int16)
    if len(audio_data) > 0:
        volume = np.mean(np.abs(audio_data))
        num_stars = max(1, int(volume / 100))

        if num_stars > volume_threshold and not switch_toggled:
            switch_on = not switch_on
            ser.write(b'180\n' if switch_on else b'0\n')
            switch_toggled = True
        elif num_stars <= volume_threshold and switch_toggled:
            switch_toggled = False

        clear_screen()
        print(f"Switch:{switch_on}\nVolume: {'*' * num_stars}")

    return None, pyaudio.paContinue

# List and select serial port
ports = list_serial_ports()
for i, port in enumerate(ports):
    print(f"{i}: {port}")
selected_port = int(input("Select port number: "))
ser = serial.Serial(ports[selected_port].device, 9600)
time.sleep(2)  # Wait for serial connection to initialize
ser.write(b'0\n')  # Initialize with switch off

# Audio setup
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
CHUNK = 1024

audio = pyaudio.PyAudio()

# Start the stream to record audio
stream = audio.open(format=FORMAT, channels=CHANNELS,
                    rate=RATE, input=True,
                    frames_per_buffer=CHUNK,
                    stream_callback=get_volume)

# Start the stream
stream.start_stream()

# Keep the script running until you stop it
try:
    while True:
        time.sleep(0.1)
except KeyboardInterrupt:
    # Stop and close the stream and serial
    stream.stop_stream()
    stream.close()
    ser.close()
    audio.terminate()

And this arduino part listens to the serial from python, and rotates the servo accordingly.

#include <Servo.h>

Servo myservo;  
int val;        

void setup() {
  myservo.attach(9); 
  Serial.begin(9600);
  Serial.println("Servo Controller Ready");
}

void loop() {
  if (Serial.available() > 0) {
    String input = Serial.readStringUntil('\n'); // read the string until newline
    val = input.toInt(); // convert the string to integer

    val = constrain(val, 0, 180);

    myservo.write(val);      
    Serial.print("Position set to: ");
    Serial.println(val);     
    delay(15);               
  }
}

Hope you enjoy.

Remarks

Well, since the assignment rubric required use of Arduino, I am using the Arduino. Had it been the original assignment without Arduino, things could have gotten more interesting 🤔. Arduino is a tool, transistors are tools. Many people are so inclined to believe that in order to implement a programmable logic, we need electronics.

🚫 NOOOO!!!!

My inner computer engineer says logic can be implemented anywhere with proper mechanism, and if you can implement logic, anything is a computer.

  • 🧬 Human DNA is just a program to read lines of nucleobases and produce proteins based on that.
  • 💧We can use water and pipes to implement logic gates and design our hydro switch.
  • 🍳If I wanted to, even the omelette on my breakfast plate can be a switch.

We don’t even need 3 pin transistors , we can design purely “Mechanical” logic gates and design the switch. But oh well… putting back my celestial mechanics into my pocket.

Week 9 – Unusual Switch

Ever since professor Sherwood told us about this assignment, I have started to think about how can I use my feet in order to make the LED light go on.

At first, I discovered that I need to use a sensor, which I found in the kit. Then, with a little inspiration from one of my favorite bands ever, Queen, I started to think about interactive ways to make this happen.

This was the result (excuse my PJs and slippers I was sick) :

At first, my right leg is right in front of the sensor. After the first few kicks, I move the right leg right next to the sensor, so that the LED light will turn off.

This was the code that I used:

//declaring the pins of the sensors
const int trigPin = 12;
const int echoPin = 13;
long duration; 
int distance;

//declaring the rgb led
int rgb_r = 8;
int rgb_b = 7;
int rgb_g = 4;

void setup() {
  // put your setup code here, to run once:
  pinMode(echoPin, INPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(rgb_r, OUTPUT);
  pinMode(rgb_b, OUTPUT);
  pinMode(rgb_g, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);

  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);
  distance = duration * 0.034 / 2;

  // We check the measured distance and control the RGB LED depending on it
  // If distance between 20-50 cm, LED is blue
    analogWrite(rgb_r, 0);
    analogWrite(rgb_g, 0);
    analogWrite(rgb_b, 255);
    Serial.println("Led is blue!");

  }

  delay(1000);
  Serial.print("distance = ");
  Serial.print(distance);
  Serial.print("\n");
  delay(1000);
}

It would have been complete if I added the hand claps with the kicks for sound purposes but I did not want to be taxed for that in regards to my grade 🙂 .

Overall, it was fun to make. The sensor is not that strong so in the future I would like to use something stronger maybe. Also, this can become an actual project and I could make it so that the color of the led would change when your feet have different positions.

Luke Nguyen – Week 9 Assignment – Lantern

 

 

Concept & Inspiration:

It’s during Ramadan and I wanted to capture the spirit and create something inspired by the month. I was working in the majlis room available in the Baraha area in C2 and I found this lamp stashed in the room corner. When I picked it up and opened the door, I noticed there was no light inside. It gave me the idea of putting a light in there with this assignment.

Circuit:

 

Demo:

Since the requirement of the assignment is creating an unusual switch that uses no hand, I thought of the idea that when the door is closed, the light will turn on. The body of the lamp besides the glass is made of metal material so it should transmit electricity almost everywhere on the surface. Taking advantage of this, I rigged the circuit inside the lamp and arranged of the placement of 2 jumper wires so that when the lamp’s door is closed, the circuit is closed and the LED will turn on thanks to the current running through it.

I created the entire circuit outside of the lamp, estimated the number of jumper wires I would need, then rigged/taped the circuit inside later though.

Challenges and reflections:

Initially, I planned to attach the 2 jumper wires in a way that when the door is closed, they would close the circuit. But that was not possible all the time because of the tape. So I took advantage of the material which the surface of the lamp is made of instead. The point is as long as their is a current running through the LED. Other than that, taping the entire circuit inside the lamp took a little bit of time because the space was too small for my hands, but I managed to do it.

Extremely weird kissing switch!

My main motivation came from Professor Aaron. Professor wanted us to be weird so I decided to be as weird as I can and decided to make a kissing switch 🙂

It started of with the ideation where I took inspiration from one of the videos we were shown in class where a guys connected cables with aluminum foil to his face and his face moved with the sound. That way I decided that one part would be attached to the face and one part would be placed on a cardboard pad.

With some sketchy soldering I soldered the Arduino cables to longer ones so that the kissing pad can be more accessible from a distance:

Here is how the kissing pad looks like:

Finally when everything was connected, I wanted the lights to blink in the tempo of a heartbeat when a kiss occurs. So naturally I searched up on Google what is the heartbeat of a person that is kissing. The answer was: 100. Let’s implement that into our code:

void heartbeatLED() {
  // Calculate the duration of one beat in milliseconds
  int beatDuration = 60000 / 100; // 100 beats per minute

  // Half of the beat duration for on and off phases
  int phaseDuration = beatDuration / 2;

  // Blink the LED with heartbeat rhythm
  for (int i = 0; i < 100; i++) { // Blink for 100 heartbeats
    digitalWrite(led0, HIGH); // Turn the LED on
    delay(phaseDuration); // Wait for the on phase
    digitalWrite(led0, LOW); // Turn the LED off
    delay(phaseDuration); // Wait for the off phase
  }
}

Finally, this is how everything looks connected together (practical presentation of how it works will be shown in class):

Video Demonstration:

I also arranged the lights in a heart formation whilst still thinking of how to make a “casing” in heart shape to make it look more pretty.

Overall I really liked exploring the Arduino for the first time and really tried to make something weird and push myself out of my comfort zone. I’m really excited for what is about to come 🙂

Week 8 Response

While reading the articles, it was challenging to find a link between the ideas due to the different design contexts discussed: Norman’s focus on emotional interaction with design and objects, versus McMillan’s article on Margaret Hamilton’s significant contributions to the Apollo mission. However, both narratives highlight the importance of innovative thinking and emotional engagement in creating technologies that are not only functional but also meaningful and intuitive for users. Adding to this, the concept discussed earlier in the semester, that design should be self-explanatory, resonates here. For example, Norman might argue that a well-designed object or interface naturally guides the user on how to interact with it, reducing the need for extensive instructions or training. Hamilton’s software, by being robust and error-tolerant, exemplifies this principle on a technical scale, ensuring astronauts could rely on it under the most extreme conditions without needing to understand its complexities.

Week 8a Reading Response

Now after having read both articles I realize how little beauty is appreciated in how productive it will make us. What I mean is that most people, myself included wouldn’t have thought that by getting a nicer looking laptop or by being in a more aesthetically appealing place that we could be more productive. However, not necessarily productive in general. The first author emphasized that positive affect (the experience of positive emotions, or feelings) could allow for broadened thinking, and make people more willing to disregard minor difficulties, and that positive affect is linked with a more aesthetically appealing design. That is not to say that all designs should focus on aesthetics. In a rocket or a plane for example, it is important that the design focus more on function so as to make it as easy as possible to complete simple tasks and not be distracted.

In the reading about the Apollo program I found it interesting how those in charge felt that because they had because “they were trained to be perfect” it meant that they wouldn’t make any mistakes. I wasn’t sure why they would think that. Personally, I don’t believe that they believed that they were perfect, instead I think those in charge thought that it would just be very unlikely that a mistake would happen, and maybe they just didn’t want to deal with adding any redundancies/error detection. Ultimately, the problem was that human-centered design wasn’t taken seriously.

As I was reading both articles I thought about the things I use around me. I’m not sure if this relates but I found that I am more willing to use something if its aesthetically appealing or just made me feel good in general. I’ll give an example: I was more willing to write notes or draw after buying a pen which feels nice to write with or if the notebook I’m using looks nice. Or, its easier for me to write code/debug if the environment around me makes me feel better. For example, being in bed is more comfortable than being in a public environment in my opinion.

Reading Response 8A

Norman,“Emotion & Design: Attractive things work better”

My personal view of design when it comes to applications/ websites goes deep into the particular balance of design and practicality and I think the author does an amazing job with explaining that concept. I believe the whole conceot of desin is completely objective where it depends on a person’s preference. One recent debate I have seen spread throughout social media is whether makeup brands fit their brand’s aesthetic or not on their website. The main brand that is talked about is Ariana Grande’s R.E.M. Beauty where many people argue that the website lacks aesthetic, whereas it is compared to other beauty brands like Apothecary 87 and KKW Beauty. This just shows the importance of design and how its existence is crucial.

Reading Response 8A – Shereena AlNuaimi

#1: Emotion & Design: Attractive Things Work Better

In “Emotion & Design: Attractive Things Work Better,” Donald Norman explores the impact of affect and emotion on design, emphasizing the relationship between usability and aesthetics. He clarifies how the effect affects cognitive function. For instance, although negative affect increases depth-first processing and focusses cognition, positive affect promotes creativity and flexibility. In addition, Norman highlights the importance of human-centered design and how important it is in high-stress situations when it may reduce issues and enhance usability. He illustrates these concepts and shows how environment and mood influence one’s choice of design by comparing three teapots. Furthermore, he argues that beautiful things work better because they can foster better performance, learning, and overall harmony.

He also looks at how affect influences behavior, arguing that negative affect improves focus and concentration while positive emotion fosters creativity by molding perceptions and judgments. Moreover, he then highlights how crucial thoughtful human-centered design is in high-stress situations, when cutting down on distractions and annoyances becomes crucial. Conversely, in neutral or advantageous conditions, the design’s pleasure and visual attractiveness might encourage positive affect, inventiveness, and the capacity to withstand minor setbacks. Norman challenges the notion that utility should take precedence over beauty in design and instead advocates for a balance between the two. In the end, he disavows the idea that style should supersede utility, highlighting the need for truly beautiful objects to have a purpose and be practical.

#2: 

8a Reading Response

When I first read the statement ‘attractive things work better’, I tried to justify it in my head but it simply did not work. However, through reading the article this statement made more sense.
It shows that human perception and behavior are highly influenced by attractiveness, which often determines choices and preferences. Attractiveness holds a user’s attention to different things that it is being used on whether products or individuals, and even ideas; positive emotions are evoked while trust as well as credibility are built up. Furthermore, ‘attractive’ features, which in this context refers to sleek, clean, minimal design, make the product easy to use. With so many options around us and so many choices to make, a simple or attractive design can provide us the relief we need, meaning they work better.

When I think of this concept my mind goes to Blackberry vs iPhone. iPhones work better, no doubt. iPhones are more attractive. At a young age I was not extremely aware of the limits each design has or the technology yet I understood iPhones earned a higher rank. This is due to the simple design, blackberry has a mini screen which is sort of limiting, and a ton of buttons. On the other hand, the iPhone had a simple home button and a wide screen to increase convenience. Which in return, made me realize the iPhone is more attractive, more user friendly, works better.

The second text discusses the programming process of Margaret Hamilton. Due to her innovation, she is regarded to be one of those who have laid down a foundation for today’s digital world. She even was involved in Apollo missions, which shattered all stereotypes and moved humanity further towards space. This therefore means that she became a symbol of breaking the gender barrier created and sustained over time. Ada Lovelace’s story can be seen as a mirror of the present-day version of Margaret Hamilton’s innovations in computer programming that made her called “the first computer programmer in the world.” For instance, during the 19th century, Lovelace cooperated with Charles Babbage on his mechanical universal computer called Analytical Engine. although the societal norms were suggesting science was not a women’s area, through her ideas and logical skills, Lovelace created grounds for all modern computation processes we know nowadays. For example, still serving as an icon for female empowerment within STEM fields even today are aspects such as Lovelace’s long-standing impact on software engineering and related issues similar to Hamilton