Week 9 – Variable Threshold Lightsensor

 

Concepts

In this week’s HW, the concept is a  variable threshold light sensor where the blue led lights up depending on if the ambient light is higher than the threshold which is controlled by the switch.

I built a simple Arduino circuit that used an analog sensor and a digital sensor to control two LEDs. To begin, I connected an LDR (Light-Dependent Resistor) and a switch to the Arduino board. The LDR measured the ambient light level, and the switch was used to control the threshold at which the LDR LED turns on.

The Demo


Code

For the coding part, I programmed the Arduino to turn on the LDR LED when the ambient light level fell below the threshold set by the switch. Conversely, when the ambient light level was lower than the threshold, the LDR LED turned off. To make the circuit more interactive, I added a feature that allowed me to adjust the threshold of the LDR LED by pressing the switch. Each time I pressed the switch, the threshold decreased by 200, making the LDR LED turn on at a lower ambient light level. Once the threshold reached 0, it looped back to the maximum value of 1023, allowing me to adjust the threshold again.

digitalSensorState = digitalRead(digitalSensorPin);
if (digitalSensorState == HIGH) {
  switchPressCount++;
  ldrThreshold -= 200;
  if (ldrThreshold < 0) {
    ldrThreshold = 1023;
  }

In addition to controlling the digital LED with the switch and LDR, I also programmed the analog LED to change its brightness depending on the threshold set by the switch. The analog LED became brighter as the threshold decreased. This was done using the map function.

int brightness = map(ldrThreshold, 0, 1023, 255, 0);
analogWrite(analogLEDPin, brightness);

Challenges and Future changes

During the development of this project, one of the challenges I faced was accurately calibrating the LDR threshold with the switch. Ensuring that the threshold value was accurate and consistent required some trial and error. Additionally, mapping the threshold value to the analog LED brightness required some experimentation to ensure that the changes in brightness were noticeable and distinct. In terms of possible future changes and improvements, one idea would be to add additional sensors, such as a motion sensor, to further expand the functionality of the circuit.

Thirst meter – Analog and Digital Input and LEDs

Concept
This project is a simulation of human thirst. We have two LED lights:
– A blue light, which indicates how ‘full’ of water we are. In the code, our ‘fullness’ is represented by the variable ‘capacity’. The lower the capacity, the thirstier we are. The blue light’s brightness indicates our capacity.
– A red light, which is a warning light. When our capacity goes below a threshold, the red light blinks, as a warning that we’re thirsty.
Moreover, we have two inputs:
– A push button. Clicking it refills our capacity to maximum.
– A photosensor. When we cover the photosensor with our hand, the capacity goes down faster, which is similar to how physical activity (e.g. exercise) makes us thirstier faster.
Video demonstration
Circuit
The circuit.
Code

Because the code is pretty long, you can find the whole thing here.

Forgotten Item Switch

Concept

The concept is pretty simple make an LED that reminds you if you forgot to grab something before leaving your room. The light will stay on until you picked up all the things you need before going outside. Only when you picked up everything it will turn off.

Circuit

1 LED, 5 jumper wires, a breadboard, an Arduino board, and 1 220-Ohm resistor were used.  The switch makes use of a simple circuit that introduces an opened circuit when at least one item is still on the table and a closed circuit when all items are taken out.

Reflection

After building this switch, I gained some practical experience in working with an Arduino board and various electronic components. I learned how to connect different components together on a breadboard and how to use jumper wires to make connections between them. I also learned how to use a resistor to limit the current flowing through the LED.

I learned about the concept of switches and how they can be used to turn electrical circuits on and off.  During the process of building the switch, I encountered some difficulties or errors, and I had to use my problem-solving skills to identify and fix the issues. This taught me the importance of troubleshooting and problem-solving when building electronic circuits.

Finally, successfully building the switch and seeing it work gave me a sense of satisfaction and accomplishment. It also gave me some inspiration for further projects or ideas for using switches and other electronic components in creative ways.

Overall, building this switch was a valuable learning experience that helped me develop my skills in electronics and problem-solving.

Diary Switch

Concept

The concept for this switch is derived from the idea of bookmarks. In this case, when you close a book, there is a light indicator. I made this as a motivation to write poems in an orderly manner before sleeping every night.

Circuit

The switch makes use of a simple circuit that introduces an opened circuit when a book is opened and a closed circuit when the book is closed. See below for circuit diagram.

Remarks

The assignment gave me a keen understanding of how the Arduino breadboard works as I needed to come up with a way to separate the circuit without removing wires from the Arduino Uno board. Overall, challenges I faced was coming up with a creative switch idea.

 

Assignment 5: Unusual Switch

Police Car

Concept

The concept of the creating this unusual switch was to use to design the circuit in such a manner that the LEDs lights would represent the alternating lights on a police car. Coincidentally, I also found a metallic bell in my room which I thought would be the perfect complement for this switch.

The following circuit was used to give this effect:

 

 

 

 

 

 

The red and the blue LEDs were connected in parallel each with its own resistor to each side of the bell. They are connected to the Arduino by a 5V wire and another ground wire. The second ground wire was connected to the center of the bell. The bulbs were initially placed in series but the idea was to light bulbs alternatively such that if one bulb is off the other can still turn on when the bell strikes the respective edge. The wires were attached to the bell as shown in the picture below:


Through this assignment, I got a much better understanding of how the rows and columns in a breadboard our connected to each other. I also learned the importance of using resistors after having short circuited two LED lights. I accidentally connected the whole circuit without using any resistors which led to the LED lights blowing up. Overall, this was a very fun project to work on and it was very creatively stimulating to design a switch using an external object.

Demo Video:

This is how the complete switch works:

 

HW 5: Creative Switch using a trash bin

Inspiration

Making a creative hands-free switch that could turn on a light inside a trash can served as the motivation for this project. The intention was to design a switch that could be activated with the foot or another body part, eliminating the need to touch the trash can with your hands. This could be useful in situations where your hands are dirty or full, and you want to avoid the spread of germs or in the case where the room is dark.

Concept

The concept for the switch was to use two pieces of aluminum foil attached to any two surfaces of the trash bin that come in contact as soon as the pedal of the trash bin is pressed. When the bin is opened, the foils come into contact, completing the circuit and allowing current to flow through an LED. The switch is powered by an Arduino board, and the LED provides visual feedback to let the user know when the switch has been activated.

Implementation

To implement the switch, I first attached two conductive aluminum foils to the lining of the trash bin, making sure they were securely attached and wouldn’t come loose over time. I then connected one wire to the positive terminal of the LED and the other wire to the positive terminal of the Arduino board (3.3V). I connected the negative terminal of the LED to the ground terminal of the board, completing the circuit.

When the trash bin is opened, the two wires come into contact, allowing current to flow through the LED and light it up. The LED provides visual feedback to the user, letting them know that the switch has been activated.

Pictures

Circuit Image
Aluminum foil plates

Challenges

One of the main challenges I faced was making sure that the conductive wires were securely attached to the lining of the trash bin. I experimented with a few different adhesives before finding one that worked well. I also tried out by putting the foil in different parts of the trash can before finally finding a place that remained completely hidden to the user and would definitely come in contact every time the bin was opened. Another challenge was making sure that the wires were positioned in such a way that they wouldn’t come into contact accidentally and complete the circuit when the switch wasn’t being used.

Reflections

I am pleased with how the switch turned out. It is simple yet effective, and it meets the goal of creating a hands-free switch for a trash bin light. I learned a lot about working with conductive materials and designing circuits, and I feel that this project could be a useful starting point for other similar projects in the future.

Assignment 5: Unusual Switch

Concept

As part of the 5th Assignment of Intro to IM, being tasked with using creativity to build a switch, I tried to think of a practical use case of such a switch. In the process of brainstorming, while I was having water in a mug, I tried to sip but realized the mug was empty. This triggered an idea for me to design a mug, which essentially indicates the level of water that remains within it.

Implementation

With limitations of equipment available, I had to make do with the things I had around me and within the Kit provided.Hence, I decided to use three lights, which could intuitively indicate the level of water in the mug – Red (Low), Yellow (Medium), and Green (High). As for the mug, to demonstrate the idea, I decided to use a transparent container (which I got with my Iftar Meal from D2), and connected the + (Power/Positive) of the three LED Bulbs at different levels, and connected Ground at the lowest level. Hence, when there was water in the Container, the LED Bulbs would light up according to the level of water that was left in the container.

Pictures of Circuit

With this, I produced the following circuit:

Demo Video

A demo video, in detail, can be seen here:

Improvements

While the existing version of the tool does not use any code, the utilization of the Arduino Coding Environment could make it more advanced, such that allowing us to only have the ‘highest level’ of LED switched on. In our case, when the water level is the highest, all three LEDs stay switched on, and with code we could reduce that to the light only on that level being switched on.

Unusual Switch | Mouth Stick

Inspiration

In my favorite movie “The Intouchables”[1+1, alternatively], the main character Philippe is a disabled person, and he is paralyzed below his neck. There was a moment in the film when it was shown how he uses the mouth stick, instead of hands, to turn pages of the physical book. Mouth stick is a useful tool for those who do not have hand functionality and need assistance with writing, typing, pointing, or turning a page of a book as in the movie.

For this homework assignment, I tried to replicate the idea in a quite abstract way of using mouth to touch a panel and let LED light signal that the touch occurred. It may be useful on an idea basis as the signal to turn the page using digital devices with touch sensors now.

Implementation

Implementation is very similar to the circuit we built in class using LED light. The difference lied in adding two more wires that were also covered in aluminum foil as the conductive material. One of the wires was connected to a cardboard panel covered by foil, while the other one was connected to a plastic straw that I used to replicate mouth stick. The foils/wires had to touch with each other to make circuit complete and let LED turn on. When there was no contact, LED light was off.  Thus, touching panel with mouth stick was signaled by turning on LED light.

Demo

 

Unusual Switch

Concept

I tend to misplace and forget to carry with me 3 things a lot: my AirPods case, my wallet, and my keys. So for this assignment, I decided to create a tool that would incentivize me to put those things together in one spot and never misplace them again.

Process

I wanted to create a board that would make the LED light up when I had all 3 of my belongings on top of it. I started off by first building the circuit we built in class without the switch and creating an opening where I could add the switches. I used pieces of an aluminum container as my conductor to both lengthen jumper wires and act as a switch. simple LED circuitStep 1

Then I built the bottom part of the board: a piece of paper with a line of aluminum but with 3 openings that act as my switches in series – when there are conductors that connects all four pieces of aluminum the switches are all “on” and so is the light. At this step, I also lengthened my “wire” by using a double jumper wire.

Step 2

From here I built the top part which consisted of another piece of paper with small pieces of aluminum that would connect to the pieces on the bottom when there is pressure applied to them and disconnect when there was no pressure. This step surprisingly took the longest because my first prototype (pictured in the top right corner below) did not turn out as I intended it. Step 3

I ended up putting 2 smaller and one bigger piece of aluminum after some experimentation and seeing what worked and did not work. Here I faced the challenge of making the paper “bounce back”, disconnecting the wires when I removed the objects, and thus turning off the LED light. My solution to this problem was to fix the top part slightly concaved down so that the default state of my board would be “disconnected”.

Final Product

Circuit Diagram

Week 8 – Birthday Switch

Concept

For this week’s assignment we were to create an unusual switch. Since it was one of my suitemates birthday, I decided to create a switch using a birthday blower. The idea was that it would open and hit a grounding wire and connect it to another grounding wire which would close the circuit consisting of three diodes in parallel.

The Circuit

The circuit was pretty straightforward to implement. Having taken A2 Level Physics, I still remember most of the content from Electricity and Circuits. Since voltage divides over elements (Three 2.0-2.4V diodes) in series, the 5.0V supply was not enough to run the circuit in series. Hence, I decided to connect them in parallel and maintain the same voltage across the different components. Below is the circuit diagram.

Figure 1. Circuit diagram

In order to connect the two grounding wires, I used copper wire/tape. By attaching the two ends of the grounding wires to a piece of double-sided tape, and appending the copper wire to the end of the birthday blower, I was able to close the circuit. The challenging part was aiming the end of the device such as to close the circuit properly. It took a few tries in order to get a hand of it, but I was ultimately able to aim it correctly and light up the diodes.

Reflection

This was probably one of my favorite assignments in the class to date. It made me feel extremely happy when the diodes lit up, even though the circuit was bound to work. Unfortunately, one of the diodes was faulty and as I was setting everything up, I thought that the circuit was bad. After changing the diode, everything worked, but it was a good lesson on having patience (because I was honestly running out of it). It would have been more fun to mount the board and arduino on a wall so that I can stand properly while closing the circuit, but since everything worked out in the end, I was very pleased with this week’s assignment outcome.

Video