My time

Made by Xi Zhang

Found in DIoT 2018 1- Home Hack

Provide better time arrangement in bathroom for people living in a shared apartment.

0

Problem Statement

I have lived with two roommates for the past 5 years, and we, three people, need to share one bathroom in an apartment. It is troublesome because we have similar schedules nearly everyday, so it is common to see someone needs to check several times whether there is anybody in the bathroom. What I would like to design is a notification device for my roommates that sends whether there is anyone in the bathroom to the other roommates, then they don’t need to get up to check in the morning and they can sleep more. A PIR sensor would be installed in the bathroom to detect motion.

0

Goal

The input of device is status of a switch button and motion data from the PIR motion sensor. The output is text messages showing the status of the motion. When the switch button is turned on, the circuit will be on. After that, when someone is in the bathroom, PIR sensor will detect her motion and send signal to Twilio (an API that can send text message to phones). A message showing “Someone is in the bathroom.” will be sent to roommates’ phones. When the person is in the bathroom, a message will be sent every 10 minutes to the phones. After the person leaves, the message will show that the person leaves.

0

Process

I started with the installation of PIR sensor, which was easy. The hardest part is to install the message notification. I searched online and found the guide here : https://www.twilio.com/docs/guides/sms-mms-messages-particle-photon#sign-into-or-sign-up-for-a-twilio-account. But it failed to work on my photon, and it turned out later that my Particle Dev had some errors. Finally problem solved after I changed to use build.particle.io. I also find a similar project online that used PIR sensor (http://ideate.xsead.cmu.edu/uploads/contents/8028/original/homehack.pdf?1486020771), and learned how he coded PIR and switch button, I also learned from http://diotlabs.daraghbyrne.me/5-getting-input/switches/. I was struggling between using a LED as a sign or a text message, I finally choose using text messages because it is more mobile that people don't need to stay beside the LED. A challenge I met was that it kept sending messages to my phones when there is a detection, and the sensor is quite sensitive so my phone kept ringing. I later added "delay(600000)" to solve the problem.

0

Product

The product is able to send messages to users when there is someone in the bathroom for every 10 minutes, after the person comes out, another message showing "Nobody is in the bathroom" will be sent to the phone. At current state, one thing needs improving is that the sensor is quite sensitive, it is very hard to find a time that it's value is "LOW", it can always detect a very small motion. And also, people need to switch off the device after the morning busy time, otherwise users will keep receiving messages. This is a half completed prototype since it cannot send instant status of the sensor, for the future design, I think it would be better if the device can send instant notification maybe by applying status change as data source. 


Part List:

1 x PIR sensor

1 x phone (could be any)

6 x Jumper Wire

1 x Particle Photon

0
int pirPin = D1; // motion sensor
int switchPin = D2; // switch that turn on the device
String body = "Hey, someone is in the bathroom"; //text content that will be sent to user's phone

void setup() 

{
    
    pinMode (switchPin, INPUT_PULLUP);
    // Switch is an input
    pinMode (pirPin, INPUT);
    // When someone is in the bathroom, the motion sensor will detect it, which is the input.
    
}

void loop() 

{
    
    int buttonState = digitalRead( switchPin );

    
    if (buttonState == LOW)
    
    {
    
        int pirState = digitalRead( pirPin );
        // Name the input of pir as pirState
    
        if ( pirState == HIGH ) // When someone enters
      {
        
        Particle.publish("twilio_sms", body, PRIVATE);
        delay(600000);
        // A text massage will be sent to the subscriber's phone every 10 mintutes when there is someone
        // and it will stop after the person leaves.
          
      }else{
          
          Particle.publish("twilio_sms", "Nobody is in the bathroom now.", PRIVATE);
          delay(600000);
        // A text massage will be sent to the subscriber's phone every 8 hours when there is no one
        // and it will stop after a person enters.
          
      }
          
    }

}
Click to Expand
0
0

Reflection

I learned how to add a sensor into the device and using sending messages to the phone. I found it interesting that the device can be done in a not difficult way that I have never seen before. However, it is still a very simple prototype, it does not have good user experience and has limited functions. I think this product can be improved by adding a push button that shows the person has finished grooming, or it can be improved by notifying people more naturally, maybe on a watch. Further, I need to learn about more advanced loop so that it can be used in more complex situations, for example, someone enters, leaves and then enters again within a very short period of time, how to present the information is still a question for me.

x
Share this Project

Courses

49713 Designing for the Internet of Things

· 25 members

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


Focused on
About

Provide better time arrangement in bathroom for people living in a shared apartment.

Created

January 24th, 2018