Water Wake Up

Made by Jasper Tom

My housemate has trouble waking up in the morning. I have created a system which will soak his bed with a spray bottle if he doesn't get up.

Created: February 6th, 2018

0
Water Wake Up
Jasper Tom - https://vimeo.com/254590817/1b8a8210d2
0

Intention

My housemate has trouble waking up in the morning. I have created a system which will soak his bed with a spray bottle if he doesn't get up.

0

Context

Projects quite similar to this have been done, but this alarm clock has more nuanced interactions. Using IFTTT to trigger particle functions has been done, as well as connecting a squirt gun to an alarm clock.

0

Process

Parts list
  • Spray bottle
  • 1 servo
  • 1 piezo motion sensors
  • Microcontroller (photon)
  • Button/switch
  • LED
  • IFTTT installed
  • Resistor
  • Wires
0
Servo Button Test
Jasper Tom - https://vimeo.com/254575044/edcb4dfe8e
0
//Initial test for pirSensor

int PIRsensor = D4;
int ledPin = D2;
int value = 0;

void setup(){
  pinMode(PIRsensor, INPUT);
  pinMode(ledPin, OUTPUT);

  Serial.begin(9600);
}

void loop(){
  value = digitalRead(PIRsensor);
  if (value == HIGH){
    digitalWrite(ledPin,HIGH);
  }
  else{
    digitalWrite(ledPin,LOW);
  }
}
Click to Expand
0
//Initial test for servo and spray bottle

Servo servoMove;

int servo = D0;
int buttonPress = D3;
int servoAngle = 0;

void setup() {
  pinMode(buttonPress, INPUT);
  pinMode(servo,OUTPUT);

  servoMove.attach(D1);
}

void loop(){
  if (buttonPress == HIGH){
    servoMove.write(180);
    delay(200);
    servoMove.write(0);
    delay(200);
  }
}
Click to Expand
0
//Initial test of calling a function using IFTTT

int ledPin = D2;

void setup(){
  pinMode(ledPin, OUTPUT);
  Particle.function("emailSwitch", emailSwitch);
}

int emailSwitch(String){
    digitalWrite(ledPin,HIGH);
    delay(1000);
    digitalWrite(ledPin,LOW);
  }
Click to Expand
0

Product

If the user first does not wake up, they will be repeatedly sprayed with more water. After the first volley of water, the user has 10 seconds to get out of bed and trigger the motion sensor. If the user remains motionless, the second volley of water will begin. The second volley of water can be stopped if the user presses the "off" button.

0
//Final Code
//Test components
int ledPin = D2;
int testButton = D5;

//Actual components
int servoPin = A5;

int pirSensor = A2;
int pirValue = 0;

Servo myServo;
int servoAngle = 60;

void setup(){

  pinMode(testButton, INPUT_PULLUP);
  pinMode(pirSensor, INPUT);

  pinMode(ledPin, OUTPUT);
  pinMode(servoPin, OUTPUT);
  myServo.attach(A5);
  Serial.begin(9600);
  // allows function to be used in IFTTT
  Particle.function("emailSwitch", waterGunFirst);
}

void loop(){
  //// FOR TESTING PURPOSES
  // if (digitalRead(testButton) == LOW){
  //   digitalWrite(ledPin,HIGH);
  //   waterGunFirst("String");
  // }
  // if (digitalRead(testButton) == HIGH){
  //   digitalWrite(ledPin,LOW);
  // }
}

int waterGunFirst(String){
  //initial water to wake up user, 3 shots
    for (int i=0; i<3;i++){
      myServo.write(20);
      delay(200);
      myServo.write(180);
      delay(200);
      myServo.write(20);
    }
    //time for user to get out of bed
    delay(10000);
    //checks for motion of user getting out of bed
    pirValue = digitalRead(pirSensor);
    if (pirValue == HIGH){
      //light goes on to signify "safety" from second volley
      digitalWrite(ledPin, HIGH);
      delay(10000);
      digitalWrite(ledPin, LOW);
      return 1;
    }
    else{
      //Second volley sequence initiated
      waterGunSecond("String");
      return 1;
    }
  }

int waterGunSecond(String){
  for (int i=0; i<100;i++){
    //Button to stop the second volley
    if (digitalRead(testButton) == LOW){
      digitalWrite(ledPin, HIGH);
      delay(5000);
      digitalWrite(ledPin, LOW);
      return 1;
    }
    else{
      myServo.write(20);
      delay(200);
      myServo.write(180);
      delay(200);
      myServo.write(20);
    }
  }
  return 1;
}
Click to Expand
0

Reflection

I learned how to first code and test smaller components of a larger IoT project and combine them into a cohesive project. My initial intent changed slightly, as I incorporated motion sensors to check whether the user had awoken versus to aim the spray bottle.

x
Share this Project

Courses

49313 Designing for the Internet of Things (Undergrad)

· 22 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

My housemate has trouble waking up in the morning. I have created a system which will soak his bed with a spray bottle if he doesn't get up.