Concept:
For this project, I decided to create a simple on-and-off switch using aluminum foil, inspired by the idea of a chair pillow switch. Imagine a seat cushion that lights up when you sit on it, that’s the effect I wanted to recreate! I set up two layers of aluminum foil each connected to a different wire with a thin separator (tissue) in between, which makes it act like a “pressure switch.” When you sit down, the pressure causes the foil layers to touch, completing the circuit and turning on an LED. Although it looks like a regular chair pillow, it’s actually just layers of aluminum foil working as a switch.
I based my code on what we learned in class, using the code examples from the PowerPoint as a reference. The code is straightforward: it checks if the foil layers are touching (circuit closed) and turns the LED on or off based on that.
The Code Im most proud of is probably the loop function even though its simple:
const int switchPin = 2; // Pin connected to the aluminum foil switch const int ledPin = 13; // Pin connected to breadboard led // Setup function runs once when the program starts void setup() { pinMode(switchPin, INPUT); // Set the switch pin as an input pinMode(ledPin, OUTPUT); // Set the LED pin as an output } // Main loop function runs repeatedly void loop() { int switchState = digitalRead(switchPin); // Read the state of the switch (HIGH or LOW) if (switchState ==HIGH) { // If the switch is OPEN - the foils are touching digitalWrite(ledPin, HIGH); // Turn on the LED } else { // If the switch is closed - the foils are not touching) digitalWrite(ledPin, LOW); // Turn off the LED } }
Reflection:
For improvements, I’d like to experiment with adding a parallel circuit so multiple LEDs light up at the same time or even make them blink, using what we covered in class. I really wanted to use a sensor for the switch but kept it simple this time with just aluminum foil, definitely something to try next time.
Set Up: