Week 9: Creative Switch

For this assignment, I made a water-based switch. Thinking of a switch that does not use your hands is really tricky so I started thinking of conductors that could be easily placed and removed with a part of the human body that isn’t the hands. My mind immediately went to water – or well, technically, spit (essentially using your mouth to connect the circuit with water as a conductor).

Implementation

My circuit is based on the circuit we built in class with a switch whose state controls the action of an LED light. The Arduino code is simple, reading the state of the water switch and illuminating the LED if water is detected.

const int waterSwitchPin = 2;  // water switch digital pin 
const int ledPin = 13;         // LED digital pin 

void setup() {
  pinMode(waterSwitchPin, INPUT); // set water switch pin as input
  pinMode(ledPin, OUTPUT);        // set LED pin as output
  Serial.begin(9600);
}

void loop() {
  int waterSwitchPinState = digitalRead(waterSwitchPin); // read the state of water switch
  Serial.println(waterSwitchPinState);
  if (waterSwitchPinState == HIGH) { // water detected
    digitalWrite(ledPin, HIGH); // turn on LED
  } else { // no water detected
    digitalWrite(ledPin, LOW); // turn off LED
  }
  
}

To make the switch, I place two jumper wires in an empty bottle cap such that they are separated. I initially thought of just spitting water into the cap to create conductivity between the wires and turn the switch state to HIGH. However, Darko (thank you, Darko) rightfully pointed out that a true switch should also be switched off and suggested the use of a straw to lower the level of water in the cap and break the circuit. It was difficult to make sure the straw remained stable without using my hands but I managed to pull it off. I also had to use salt to make sure the water was ionized enough to conduct (thank you, Professor Aaron, for the trick!).

 

 

 

Leave a Reply