My concept
For week 8’s assignment, we were asked to create a switch that uses the human body to complete a circuit, but without using our hands. I wanted something simple but still interesting, so I decided to build a foil‑based touch switch that activates an LED when my elbow connects two pieces of aluminum foil. The idea behind my switch is that the body can act as a conductor: when the two foil pads are separated, the circuit is open, and when my elbow touches both at the same time, the circuit closes and sends a HIGH signal to the Arduino. I liked this idea because it felt playful and intuitive, instead of pressing a button, I’m using a part of my body that normally isn’t used for electronics. Once everything was wired correctly, the LED lighting up from just a touch of foil felt surprisingly satisfying.
The demo and setup
Video: IMG_3331
Photo: https://intro.nyuadim.com/wp-content/uploads/2026/04/IMG_3322.heic
Photo: https://intro.nyuadim.com/wp-content/uploads/2026/04/IMG_3319.heic
The sketch: https://intro.nyuadim.com/wp-content/uploads/2026/04/IMG_3332.heic
The code I’m proud of
The part of the code I’m most proud of is the core logic that actually makes the switch work. Even though it looks simple, this was the section I spent the most time understanding and debugging. It reads the input from the foil and decides whether the LED should turn on or off. Once the wiring was correct, this logic worked instantly and reliably.
int state = digitalRead(switchPin);
if (state == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
This snippet represents the entire interaction: the Arduino constantly checks the state of the foil switch, and the LED responds in real time. After all the debugging I went through, seeing this simple logic finally work felt incredibly rewarding.
Github link: https://github.com/mhraalnuaimi/week8assignment/blob/main/foil_switch.ino
Problems I faced
This assignment ended up being much more challenging than I expected, not because of the code, but because of the wiring. At first, nothing happened when I touched the foil, the LED stayed off no matter what I did. I kept adjusting the foil, retaping wires, and trying different ways of touching it, but the Arduino wasn’t detecting anything. I assumed the foil wasn’t conductive enough or that my body wasn’t completing the circuit properly.
Eventually, I started debugging step‑by‑step. The most important test was touching the bare wire from pin 2 directly to the 5V pin. When I did that, the LED turned on immediately. That moment told me that the code, the LED, and the Arduino were all working perfectly. The problem had to be somewhere in the breadboard wiring.
After more testing, I discovered the real issue: the second GND wire connected to the resistor row was pulling the signal LOW permanently. Because of that, pin 2 could never go HIGH, even when the foil was touched. Removing that incorrect GND connection instantly fixed the problem. Once the wiring was corrected, the foil switch worked exactly the way it was supposed to.
I also rebuilt the foil pads so that the bare metal of the wire touched the bare foil directly, which made the connection much more reliable. After that, the LED responded perfectly every time my elbow bridged the two foil pieces.
Reflection
This assignment taught me a lot about how sensitive breadboard wiring can be. I realized that most Arduino problems aren’t caused by the code, they’re caused by one wire being in the wrong row or one resistor being connected incorrectly. Debugging forced me to slow down and test each part of the circuit logically instead of guessing. The moment I isolated the issue and saw the LED turn on from the foil switch felt incredibly rewarding.
I also enjoyed experimenting with different ways of activating the switch, like using a metal pen instead of my elbow. Overall, I’m proud of how much I learned from this process. Even though it was frustrating at times, it made me more confident in reading circuits, understanding pull‑down behavior, and debugging systematically. Next time, I’ll double‑check my wiring before assuming the code is wrong, it would have saved me a lot of time.
References
Arduino Documentation: digitalRead()
https://docs.arduino.cc/language-reference/en/functions/digital-io/digitalread/ I used this page to understand how the Arduino interprets HIGH and LOW signals from my foil switch.
Arduino Documentation: pinMode()
https://docs.arduino.cc/language-reference/en/functions/digital-io/pinmode/ I used this reference to confirm how to correctly set pin 2 as an INPUT so it could read the foil connection.
Arduino Documentation: Digital Pins
https://docs.arduino.cc/learn/microcontrollers/digital-pins I used this explanation to understand how input pins behave electrically, especially how they float without a proper pull‑down or pull‑up resistor.
Arduino Tutorial: Digital Input Pull-Up
https://docs.arduino.cc/tutorials/generic/digital-input-pullup I used this tutorial to compare my physical pull‑down resistor setup with Arduino’s internal pull‑up option and understand why my circuit needed stabilization.
Class slides
I used the class slides to review how switches work, how breadboard rows connect, and where resistors should be placed in a circuit.
Arduino cheat sheet
I used the cheat sheet to quickly double‑check syntax for digitalRead(), digitalWrite(), and pinMode() while writing and editing my code.
AI usage debugging (ChatGPT)
I used AI to help me debug the circuit step‑by‑step, especially to isolate the issue with the misplaced GND wire and confirm that the code itself was working correctly.