Hamdah AlSuwaidi – Unusual switch

For this assignment I have created a switch that activates an LED light when two jumper wires come into contact with a conductive liquid. Initially utilizing saltwater due to its well-known conductive properties, the project later incorporates laban, showcasing the project’s versatility and the unexpected utility of common substances in electronics. The switch operates on the principle that when the liquid completes the circuit between the two wires, the LED is powered on, demonstrating a basic but effective application of electrical conductivity and circuit design.

Concept:

The concept revolves around the exploration of electrical conductivity in liquids and the application of this property in creating an unconventional switch. Conductivity in liquids is often associated with the presence of ions. Saltwater, being rich in ions, is a good conductor of electricity. On the other hand, laban, while less conventional, also contains various salts and minerals that can facilitate the flow of electricity, making it a surprising but effective choice for this experiment.

How It Works:

Circuit Setup: The project utilizes an Arduino board as the control unit, a simple LED light as the output indicator, and two jumper wires inserted into two separate GPIO (General-Purpose Input/Output) pins on the Arduino. One of these pins is set up as an input to detect the circuit’s completion, while the other serves to provide a low voltage signal. The LED is connected to another GPIO pin on the Arduino, configured as an output.

Conductive Medium: The circuit is initially open, meaning the electrical path is incomplete, and the LED remains off. The introduction of a conductive medium (saltwater or laban) bridges the gap between the two jumper wires, allowing current to flow through the liquid and complete the circuit.

Detection and Response: When the Arduino detects the completion of the circuit through its input pin, it triggers the LED to turn on. This response acts as a visual indication that the circuit has been completed through the conductive medium.

Experimentation and Learning: By experimenting with different liquids like saltwater and laban, users can learn about the properties of electrical conductivity in a hands-on manner.

Video:

IMG_5445

Image:


 

WEEK 9 Unusual Switch + Documentation blog post Shereena AlNuaimi

I spent hours trying to think of a concept until it eventually occurred to me. To be very honest, I’m happy with the result, but I wanted to challenge myself further and attempt to learn more about Arduino. My original plan was not to blow a charm into the jumper cable to achieve the light produced by the LED, but since my code was crashing and my Arduino board stopped working all of a sudden, I had to modify my plan. I had to make the most of my limited time to do my task.

Naturally, investing a significant amount of time to complete this “unusual switch” project enabled me to become comfortable with the Arduino board concept overall. While this wasn’t how I intended to become familiar with it, the experience was still an eventful rollercoaster. Moreover, I decided to incorporate a very memorable part of my childhood a charm of the Arc De Triomphe. France was a huge part of my childhood and still is, something that everyone finds shocking is that my first language surprisingly was French (I know crazy right?). Furthermore, I wanted to combine a partial part of my life into this project as well.

Something I’d like to improve on in the future is trying to figure out why the brightness of my LED was so dim and not that bright. Overall, I’m pleased with the outcome, and the fact that I get to include something somewhat special was pleasing.

Unusual switch

const int led0 = 11; // LED connected to digital pin 11
const int touchSensorPin = 3; // Touch sensor (white wire) connected to digital pin 3

void setup() {
  pinMode(led0, OUTPUT); //LED as output
  pinMode(touchSensorPin, INPUT_PULLUP);
}

void loop() {
  if (digitalRead(touchSensorPin) == LOW) {  // if touch sensor detects physical contact
    digitalWrite(led0, HIGH); // Turn on LED
  } else {
    digitalWrite(led0, LOW); // Turn off LED
  }
}

 

 

Raya Tabassum: Unusual Switch Project

Concept & Usage: My idea was to build a distance-sensitive security system. The system is designed to be sensitive to distance, using the HC-SR04 ultrasonic sensor paired with an Arduino board to trigger an audible alarm. The closer the object is to the sensor, the faster the alarm—or buzzer—will beep, which serves as an intuitive indicator of proximity.

The ultrasonic sensor-based alarm acts not only as a simple security device but can also be an interactive element for various applications. By emitting ultrasonic waves, the sensor can determine the distance to an object based on the time it takes for the waves to return. In the context of security, this setup can detect potential intruders or unauthorized access by sensing motion within a predefined range.

The versatility of the alarm allows it to be adapted for different purposes, such as:

  • Intruder detection for personal properties, alerting homeowners to possible trespassers
  • Industrial safety, where restricted areas can be monitored to ensure personnel safety
  • Public events, to manage crowd control and prevent attendees from accessing sensitive areas

Implementation:

When the system senses an object within a specified distance (less than 50 cm in your code), it activates the buzzer. The alarm’s operation is controlled by the code which defines the pins for the sensor and the buzzer, measures the distance by calculating the time interval of the echo’s return, and dynamically adjusts the beeping speed based on this distance.

Code:

//Security Alarm with Ultrasonic Sensor//

#define trigPin 6  
#define echoPin 5
#define buzzer 2
float new_delay; 


void setup() 
{
  Serial.begin (9600); 
  pinMode(trigPin, OUTPUT); 
  pinMode(echoPin, INPUT);
  pinMode(buzzer,OUTPUT);
  
}


void loop() 
{
  long duration, distance;
  digitalWrite(trigPin, LOW);        
  delayMicroseconds(2);              
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);           
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  new_delay= (distance *3) +30;
  Serial.print(distance);
  Serial.println("  cm");
  if (distance < 50)
  {
   digitalWrite(buzzer,HIGH);
   delay(new_delay);
   digitalWrite(buzzer,LOW);
 
  }
  else
  {
    digitalWrite(buzzer,LOW);

  }
  
 delay(200);
}
  • trigPin and echoPin are defined for sending and receiving the ultrasonic signals.
  • buzzer is defined for the alarm sound.
  • In the loop function, the program triggers the ultrasonic sensor and listens for the echo. The distance is calculated based on the time it takes for the echo to return.
  • The new_delay is calculated based on the measured distance. The closer the object, the smaller the delay, resulting in a faster beep.
  • The buzzer is activated if the object is within 50 cm of the sensor, with the beeping speed proportional to the object’s proximity.

References:

I used several Youtube tutorials for executing the project using the tools.

-https://youtu.be/HynLoCtUVtU?si=zHnjgYTF8wYnlOKp

-https://youtu.be/0Lhgd8PQmn0?si=OXr1fvTP4b9X0pPW

Week 9 – Saeed Lootah

Before this assignment I spent a lot of time trying to brainstorm different ideas, I wasn’t really sure what to do until the last minute to be honest. Some of my ideas were if you say a specific word the switch triggers, or if you’re nodding off or maybe just a sound trigger, but none of those ideas seemed very original or interesting. Thankfully I ended up coming up with an idea I feel is far more unique.

When thinking about different limbs (other than my hands) and which I could move to cause the switch to turn on I eventually landed on my ear. Unlike most people I have the ability to slightly move my left ear. Not enough to be very noticeable but enough to have two contacts connect or disconnect.

The plan was to connect one wire to my glasses and one wire to the side of my head. I chose to do this because I noticed that when I do move my ear it also moves my glasses. Therefore, the switch would be turned on when I don’t move my ear as the glasses would be in its normal position, and the switch would be turned off once I move my ear.

Above is the finished product when it is not attached to me. The red wire on the bottom left is what I attach to my head with electrical tape and it is supposed to touch the copper contact that you can see on my glasses. You may also notice that on the breadboard there are two LEDs, one red, one blue. The red LED turns on when current is flowing between the contacts. Then the blue LED is connected to the Arduino. When the current is flowing a signal is sent to the Arduino, then the output is sent to the blue LED. I made it such that the blue LED flickers when current isn’t flowing, i.e. when I move my ear.

Making this was very tedious especially getting the wire on my head to stick and also because sometimes I had to take my glasses off while working on the project. Fortunately while writing this my glasses are on but I didn’t attach the red wire. Unfortunately, when I do attach the red wire it is slightly uncomfortable so I’ve decided to keep it disconnected until the last moment. There are also other problems with my design: The wires easily move around, I rely heavily on electrical tape to keep everything in place, and to make sure everything works I have to adjust my glasses as well since if they move then the switch no longer works, also the wires are messy. Since this is only a prototype problems are expected. Regardless I’m surprised at how well it works, for people who don’t realize I’m moving my ear it looks like I’m using my mind alone to control the light.

Thank you Aadhar the lab assistant for helping me with getting wires of the right length and finding electrical tape. And, thank you ChatGPT for writing the flicker code.

 

Code:

 

// PINS //
const int powerPin = 2;
const int outputPin = 3;
// ---------- //

// GLOBAL VAR //
int val = 0;
int outputVal = 0;
bool flicker = false;
// unsigned long time;
unsigned long previousMillis = 0;   // ChatGPT
const long interval = 200;
// ---------- //

void setup() {
  // note to self, returns either HIGH or LOW
  pinMode(powerPin, INPUT);
  pinMode(outputPin, OUTPUT);

  
  // Serial.begin(1000); // Begins serial communication with my computer

}

void loop() {
  // DIGITAL READ //
  val = digitalRead(powerPin);
  digitalWrite(outputPin, outputVal);
  // // ---------- //

  // time = millis();
  unsigned long currentMillis = millis(); // get the current time

  // Test
  // if(val == LOW) {
  //   outputVal = LOW;
  // } else {
  //   outputVal = HIGH;
  // }

// turn on later 
  if (currentMillis - previousMillis >= interval) {
      // save the last time you blinked the LED
      previousMillis = currentMillis;
      flicker = !flicker;
  }

  if(flicker && val == HIGH) {
    outputVal = HIGH;
  } else {
    outputVal = LOW;
  }

  // Serial.println();
}

 

Week 9 – Personal Distance Machine

For my first Arduino-based assignment I wanted to incorporate the use of an ultrasonic sensor to generate an interaction for the user based on their presence alone. My initial idea was to have the output in the form of a message displayed on an LCD screen – I even wired up the circuit for this idea as shown below. However I was unable to figure out how to link information from the sensor to the LCD screen and decided to try a new approach.

In an attempt to simplify things for myself while maintaining the idea of detecting someone’s/something’s presence, I decided to create a ‘personal distance machine’ which tells users when something is too close for comfort. To do this I replaced the LCD screen with a buzzer and an RGB light which changes incrementally from green to yellow to red depending on the distance detected by the sensor. Below is an excerpt from the code as well as an example video.

void loop() {
  distance = getDistance();   //variable to store the distance measured by the sensor

  Serial.print(distance);     //print the distance that was measured
  Serial.println(" in");      //print units after the distance

  if (distance <= 20) {                       //if the object is close

    //make the RGB LED red
    analogWrite(redPin, 255);
    analogWrite(greenPin, 0);
    analogWrite(bluePin, 0);
     tone(buzzerPin, 272);  


  } else if (20 < distance && distance < 40) { //if the object is a medium distance

    //make the RGB LED yellow
    analogWrite(redPin, 255);
    analogWrite(greenPin, 50);
    analogWrite(bluePin, 0);

  } else {                                    //if the object is far away

    //make the RGB LED green
    analogWrite(redPin, 0);
        analogWrite(greenPin, 255);
    analogWrite(bluePin, 0);
        noTone(buzzerPin);   
  }

https://youtube.com/shorts/5y1aWPqcZVg?feature=share

Creative Switch: Trash Can

For my first Arduino project, I was struggling to find ideas that didn’t involve my hands. I looked around my room, trying to utilize what I already have, and searched for objects that require the use of the body (not hands) to function. Which is when I saw my trash can! The idea was simple, create a circuit that closes when I press down on the trash can to open, and the circuit opens when I remove my foot. I used two foil pieces one stuck to the ground and one to the bottom of the trash can lever, allowing them to intersect and close the circuit when I press down with my foot. 

Additionally, the code was pretty straightforward, exactly what we’ve been doing in class:

const int ledPin = 2;
const int foilPin = 3;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(foilPin, INPUT);
  Serial.begin(9600);
}
void loop() {
  int buttonState = digitalRead(foilPin);
  Serial.println(buttonState); 
  digitalWrite(ledPin, buttonState); 
}

Overall, the code functions by reading the state of the aluminum foil switch and uses that info to control the state of the LED (high/low). When the switch is closed, the LED turns on, and when the switch is open, the LED turns off.

However, I faced several issues during my project:

Error messages from IDE kep showing up, after multiple attempts to troubleshoot (going back and forth between Arduino and IDE) I decided to restart my laptop and Arduino board which ended up solving the issue.

My second issue was that the Led light stays on regardless of the foils touching or not, it’s like the circuit was complete or was not relying on the foils. However, when the foils do touch the led light gets brighter which meant there was an intervention from the foils but not exactly what I’m looking for. I tried to find ways to trouble shoot this but ended up giving up after going back and forth with the code and the board. 

Here’s a Demo:IMG_6092 2

Week 10 – Sara Al Mehairi

Concept

Credit: iStock

For this assignment, my goal was to create a miniature car sensor system using Arduino. The system uses ultrasonic sensors to detect objects/vehicles and provide feedback to the user using RGB LED, similar to the sensors used in modern cars for reversing or parking assistance. Components used include: Arduino Board, Breadboard, Ultrasonic Sensors, RGB LED, 330Ω Resistors, and Jumper Wires.

Overview

Ultrasonic sensors for linear position and distance measuring
Credit: Texas Instruments

if (distance <= 10) {
    //red
    analogWrite(redPin, 255);
    analogWrite(greenPin, 0);
    analogWrite(bluePin, 0);
  } else if (10 < distance && distance < 20) {
    //orange
    analogWrite(redPin, 255);
    analogWrite(greenPin, 50);
    analogWrite(bluePin, 0);
  } else {
    //green
    analogWrite(redPin, 0);
    analogWrite(greenPin, 255);
    analogWrite(bluePin, 0);
  }
  • Distance Measurement: With some googling, I learned that ultrasonic sensors emit high-frequency sound waves and measure the time it takes for the waves to bounce back after hitting an object. Based on this time measurement, the system calculates the distance to the obstacle.
  • Visual Feedback: The RGB LED is used to provide visual feedback to the user based on the distance readings from the sensors. The LED changes color to indicate the proximity.
  • Consistency: the Arduino continuously monitors the distance readings from the sensors & updates the LED color accordingly. In reality or with the vision I had in mind, this real-time feedback would help the driver to move the vehicle carefully, especially in tight spaces.

IMPLEMENTATION

As the vehicle/object moves, the ultrasonic sensors detect obstacles in the path and passes on distance measurements to the Arduino. The Arduino then processes the distance readings and controls the RGB LED to provide real-time visual feedback to the driver. This is possible thanks to the loop that continuously retrieves distance measurements & adjusts the LED colors accordingly. I also came across echoTime which represents the duration for which the ultrasonic sensor receives an echo signal after emitting a sound wave, pretty cool!
– Red: Stop the vehicle immediately.
– Orange: Proceed with caution, slowing down if necessary.
– Green: Continue driving as the path is clear.

Conclusion

Tiny but mighty, it was quite enjoyable to create this miniature system. Although I may have accidentally followed the description of next week’s assignment and realized it a few minutes ago, I learned a lot. As a driver, I understand the importance sensors play in parallel parking and avoiding hitting a curb. Therefore, I wanted to contribute to improving this aspect in terms of accuracy. After encountering some obstacles, I resorted to Core Electronics on YouTube as a guide for this assignment. Overall, I had hoped to attach the sensors to the front or rear bumper of an actual vehicle and test the accuracy, but step by step, I’ll hopefully create something greater!

Week 9 Creative Switch – Khalifa Alshamsi

Concept:

In an endeavor to merge the timeless charm of LEGO with the dynamic glow of LED lighting, I took on a project that tested my creativity and also my persistence. The challenge was clear: integrate an LED system within a LEGO car in a functional and aesthetically pleasing manner. After numerous attempts and exploring various configurations, I found the perfect harmony by positioning the LED as the car’s internal dome light. This strategic placement allowed me to achieve an interactive feature where the light automatically turns on as the door closes and dims when the door is left open.

Code:

int ledPin = 9;           // LED connected to digital pin 9
int doorSensorPin = 2;    // Sensor (wires touching) connected to pin 2
int doorState = 0;        // Variable for reading the sensor status

void setup() {
  pinMode(ledPin, OUTPUT);      // Sets the digital pin as output
  pinMode(doorSensorPin, INPUT); // Sets the digital pin as input
  digitalWrite(doorSensorPin, LOW); // Enables pull-down resistor
}

void loop(){
  doorState = digitalRead(doorSensorPin); // Reads the state of the sensor value
  if (doorState == HIGH) {
     digitalWrite(ledPin, LOW);   // Turns LED off when the door is closed (wires touching)
  } else {
     digitalWrite(ledPin, HIGH);  // Turns LED on when the door is open (wires not touching)
  }
}

Video of Project:

Reflection and ideas for future work or improvements:

As I look back on this complicated project for me, I recognize the journey was as enlightening as it was challenging. One significant area for improvement that stands out is the need for a more refined wiring management system. Despite the project’s success, the sight of exposed wires and adhesive tape detracts from the overall aesthetic appeal. In future iterations, prioritizing a sleeker integration of the electronics will hopefully enhance the design.

Furthermore, this project served as a profound learning curve. Despite consuming countless videos and undergoing a trial-and-error process that saw me revising the wiring and code more times than I can count, I confess there remains a haze around my understanding of the underlying electronics principles. This realization, far from discouraging me, has sparked a curiosity to delve deeper into the fundamentals of electronics and programming.

Looking Ahead:

This project has laid the groundwork for further exploration into the fusion of technology with traditional toys. Ideas for future projects include incorporating more interactive elements, such as sound effects synchronized with the door’s motion or ambient light sensors to activate the headlights in dim conditions, transforming the LEGO car into an even more immersive and interactive experience, maybe even fully coding a 3D printed one to drive using the Arduino but again I still don’t know the full stretch of an Arduino board.

In essence, this journey has not only expanded my technical skills but also opened up a scenery of possibilities for exploring.

Week 9_Creative Switch – Jihad Jammal

Concept:

The requirement was clear: devise an alternative that bypasses the conventional hand-operated mechanism. Recognizing that our feet are just as capable when it comes to applying force in a precise manner—much like how we use them to operate pedals in a car—I decided to explore this avenue. I constructed a prototype using cardboard for the pedal, taking advantage of its availability and ease of manipulation, and copper for its conductive properties, essential for transferring the switch’s command.

A highlight of some code that you’re particularly proud of:

const int ledPin = 13; // LED connected to digital pin 13
const int touchSensorPin = 2; // Touch sensor (white wires) connected to digital pin 2

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

void loop() {
  // Check if touch sensor is touched (wires are connected)
  if (digitalRead(touchSensorPin) == LOW) {
    digitalWrite(ledPin, HIGH); // Turn on the LED
  } else {
    digitalWrite(ledPin, LOW); // Turn off the LED
  }
}

Video of Project:

Reflection and ideas for future work or improvements:

Reflecting on the process of creating my foot-operated light switch, I initially envisioned using aluminum for its excellent conductivity and lightweight properties. However, practical limitations often steer the course of innovation, and this project was no exception. With aluminum out of reach, I adapted to the materials available to me, selecting copper tape as a suitable alternative. This choice was not without its merits; copper’s conductivity is remarkable, and its flexibility proved invaluable during the assembly process.

The simplicity of the code was my saving grace, making the integration of electrical components less daunting than anticipated. Yet, every project presents its challenges. One such challenge was securing the wires in such a manner that they consistently made contact with the copper tape. Due to their placement, there were occasions when the connection was missed, disrupting the switch’s functionality. I recognized that increasing the copper tape’s surface area could potentially mitigate this issue, providing a more forgiving target for the wires to connect with.

 

Week 9: Unusual Switch

Overview

In this assignment, I was tasked with designing a unique switch that doesn’t use hands for activation. I embraced the challenge with creativity, creating two distinct switches: a water detection switch and a bicep flexion switch.

Switch 1: Water Detection System with Visual Indicator

Concept

The concept behind this water detection system is rooted in the fundamental principle of electrical conductivity in water. Utilizing a simple circuit design with an Arduino, the project aims to detect the presence or absence of water through basic electronic components. When water connects two strategically placed wires, it completes a circuit, allowing current to flow, which the Arduino interprets to trigger a visual signal.

Inspiration

The inspiration for this project came from the need to monitor water levels or detect water presence in various situations, such as checking if a plant needs watering or preventing overflow in tanks.

Image

Components Used

  1.  Arduino Uno
  2. Green LED
  3. Red LED
  4. 330Ω Resistors (2)
  5. Jumper Wires
  6. Breadboard

How It Works

  • I connected the anode of each LED (green and red) through a 330Ω resistor to digital pins 13 and 12 on the Arduino, respectively. The cathodes were connected to the ground (GND).
  • I prepared two wires as water sensors by stripping a small section of insulation off each end. One wire was connected to digital pin 2 on the Arduino, and the other wire was connected to GND. These wires were then placed close to each other but not touching, ready to be submerged in water.
  • I wrote and uploaded the code to the Arduino that checks the electrical connection between the sensor wires. If water is present (completing the circuit), the green LED turns on. If the circuit is open (no water detected), the red LED illuminates.

Video

Switch 2: Bicep Switch

Concept

The goal was to create a device that could detect muscle flexion, particularly of the bicep, and provide immediate visual feedback.

The circuit setup and the code used are the same as the water detection switch.

Image

Components Used

  1.  Arduino Uno
  2. Green LED
  3. Red LED
  4. 330Ω Resistors (2)
  5. Jumper Wires
  6. Breadboard
  7. Cardboard Pieces
  8. Copper Tape

How It Works

When the bicep is flexed, the circuit completes, and the green LED lights up, indicating muscle activity. Conversely, when the muscle relaxes, the circuit breaks and the red LED turns on, indicating that the muscle is at rest.

Video