Week 8 – Unusual Switch – Wind Detector

Concept

I was initially very intimidated by this assignment, I couldn’t imagine using a switch without hands, but that was the problem, I was tunnel-visioned on the word “switch” that I associate with my index finger. I then saw some examples online and completely ditched the word “switch,” I tried to think about the assignment as linking to metal pieces together, then I started getting a lot of ideas! A couple of days later, I was going through some pictures from back home on my phone. In some picture, I saw a house in the background with a small wind turbine on it’s roof, and that gave me the idea!

 

Setting up

I taped a wire connected to the breadboard on the wall, and put a piece of aluminum foil behind it. The idea of the aluminum foil behind the wire its to create more area for contact with other conductors, that will be useful later on.

You probably are wondering what use is the mentos cap for this project, and to be honest, the mentos cap was probably one of the most important components of this project. It created just the perfect space for the conductor I will soon tape on the cap to not be too close to the wire so its on all the time, nor be too far so wind does not connect the two conductors together.

Here’s a full picture of the project with the circuit, well they’re not the prettiest, but they sure work.

 

 

 Video

Whenever I blow on the circular foil, the green LED turns on.

 

Code

The code to this project is honestly really really simple, I used  the same code for the button example from the examples dropdown, I just modified it a little bit.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
void setup() {
Serial.begin(9600);
pinMode(A2, INPUT);
pinMode(13, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int buttonState = digitalRead(A2);
Serial.println(buttonState); // debugging
if (buttonState == 1) {
digitalWrite(13, HIGH); // LED ON
} else {
digitalWrite(13, LOW); // LED OFF
}
}
void setup() { Serial.begin(9600); pinMode(A2, INPUT); pinMode(13, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // read the input pin: int buttonState = digitalRead(A2); Serial.println(buttonState); // debugging if (buttonState == 1) { digitalWrite(13, HIGH); // LED ON } else { digitalWrite(13, LOW); // LED OFF } }
void setup() {
  Serial.begin(9600);
  pinMode(A2, INPUT);
    pinMode(13, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int buttonState = digitalRead(A2);
  Serial.println(buttonState); // debugging
  if (buttonState == 1) {
    digitalWrite(13, HIGH);  // LED ON
  } else {
    digitalWrite(13, LOW);   // LED OFF
  }


}

 

 

Leave a Reply