Bathroom Notification

Made by hanyuan1

Found in DIoT 2018 1- Home Hack · UNLISTED (SHOWN IN POOLS)

For people live and share bathroom together, and it will be helpful for them to know if the bathroom is occupied. Once the motion sensor senses anyone in the bathroom, it will send a notification to my phone.

0

Intention

I’m sharing the bathroom with my roommate, and sometimes it is hard to know if someone is in the bathroom. So I decided to design a product to send out a notification when the other person is in the bathroom.

0

Context

For people live and share bathroom together, and it will be helpful for them to know if the bathroom is occupied. Once the motion sensor senses anyone in the bathroom, it will send a notification to my phone.

0

Process

Component used:

-Particle Photon board (and photon inventor kit essentials such as:)

-breadboard

-Jumper Wires (about 6 needed here)

-1 kOhm resistor

-A LED

-A PIR Sensor

-Right Angle Connector-Through-3-Hole-Pin (JST)



Circuit Diagram (from Github)




Then I set up a Pushover account and an IFTTT account in order to send out trigger and get a notification.





When I turn the led light will light up when the motion sensor detects anything moving, and it will send a notification to the IFTTT and my phone to let me know that someone is in the bathroom.



0

Product

Detail what you created. What methods or techniques did you use? What tools and technologies were involved? Include images, code or video.

0

Reflection

One challenge I had during setting up the motion sensor is to figure out why it did not work. So I checked the code and the connection to figure out where the problem is. Finally, I figured that it was because the breadboard was upside down when I follow the instruction so that the positive and negative side of the breadboard is switched.

It was really fun to figure out the problem, and it allows me to think more about its opportunities to improve. 

0
int inputPin = D0;              // choose the input pin (for PIR sensor)
int ledPin = D1;                // LED Pin
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status

int calibrateTime = 10000;      // wait for the thingy to calibrate

void setup()
{
  pinMode( ledPin, OUTPUT );
  pinMode(inputPin, INPUT);     // declare sensor as input
}

void loop()
{

  // if the sensor is calibrated
  if ( calibrated() )
  {
  // get the data from the sensor
    readTheSensor();

    // report it out, if the state has changed
    reportTheData();
  }
}

void readTheSensor() {
  val = digitalRead(inputPin);
}

bool calibrated() {
  return millis() - calibrateTime > 0;
}

void reportTheData() {

  // if the sensor reads high
  // or there is now motion
  if (val == HIGH) {

    // the current state is no motion
    // i.e. it's just changed
    // announce this change by publishing an eent
    if (pirState == LOW) {
      // we have just turned on
      Particle.publish("designingiot/s15/motion");
      // Update the current state
      pirState = HIGH;
      setLED( pirState );
    }
  } else {
    if (pirState == HIGH) {
      // we have just turned of
      // Update the current state
      pirState = LOW;
      setLED( pirState );
    }
  }
}

void setLED( int state )
{
  digitalWrite( ledPin, state );
}
Click to Expand
0
x
Share this Project

This project is only listed in this pool. Be considerate and think twice before sharing.


Courses

49713 Designing for the Internet of Things

· 25 members

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


About

For people live and share bathroom together, and it will be helpful for them to know if the bathroom is occupied. Once the motion sensor senses anyone in the bathroom, it will send a notification to my phone.

Created

January 31st, 2018