# Hey, get out pal.

Notify a roommate to get out of a private place (esp.bedroom and bathroom) in a friendly manner before knocking the door or using other disturbing way.

Created: January 29th, 2016

0

### Problem / Scenario

Have you ever experienced that...

My roommate rushed into the bathroom for some reason. He came out 1 hour later with a cellphone in hand.
"What did you do?"
>>"Inside a bathroom? Using toilet... Obviously..."
"You sure? Stop playing with your cell phone when you poop!"
>>"Hey! I only used for a while."

Bathroom is a private place though, it's shared among several people at home. Sometimes roommates spend too much time playing cellphone when using bathroom. That's a bad habit for their health as well as for the efficiency of sharing space.

The instant someone brings cellphone going inside a bathroom. Things can happen. However, knocking the door or telling them in person isn't effective enough. So here comes the solution - combination of timer and speaker.

To enhance efficiency of sharing private space like bathroom, I came up with a 15-minute rule powered by a simple circuit created by Particle Photon.

0

### Goal

"Even it's not that practical..."

To notify roommates to get out of a private place (esp.bedroom and bathroom) in a friendly manner before knocking the door or using other disturbing way.

Plus, sharing private space efficiently, and with fun.

0

### Process

"So let's play a song for the bathroom occupier!"

Components

Input: Switch // I wish I could use a sensor here, but for the time limit, I will explore after the due :(

Output:

1. LEDs to show the time states;

2. Piezo: Music (SuperMario Theme)

3. LED as alarming light flashing with the tempo of song;

4. LED as showing as a indicator of turning off the song

Sensor: 2 Photoresistors // If he/she turned off the notification, there's still a sensor with a indicating LED to track whether she/he's moving.

Other:  Jumper wires and 1kΩ resistors

Conceptual Workflow

Timing -> Alarming -> (If alarm turned off)Tracking

0

## Prototype and Iteration

0
``````// Set the led timer
int timeLedPin1 = A1;
int timeLedPin2 = A2;
int timeLedPin3 = A3;
int timeLedPin4 = A4;
long timeSinceGetIn = 0;

// Define player and leds
int speakerPin = D0;
int ledPin = D1;

// Sing the song
int melody [] =
{
//melody set1
2637, 2637, 0, 2637, 0, 2093, 2637, 0, 3136, 0, 0, 0, 1568, 0, 0, 0,
//melody set2
2093, 0, 0, 1568, 0, 0, 1319, 0, 0, 1760, 0, 1976, 0, 1865, 1760, 0,
//melody set3
1568, 2637, 3136, 3520, 0, 2794, 3136, 0, 2637, 0, 2093, 2349, 1976, 0, 0,
//melody set4
2093, 0, 0, 1568, 0, 0, 1319, 0, 0, 1760, 0, 1976, 0, 1865, 1760, 0,
//melody set5
1568, 2637, 3136, 3520, 0, 2794, 3136, 0, 2637, 0, 2093, 2349, 1976, 0, 0
};

//set tempo
int x1 = 8; //control tempo1
int x2 = 7; //control tempo2
int tempo [] =
{
x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,

x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,

x2, x2, x2,
x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,

x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,

x2, x2, x2,
x1, x1, x1, x1,
x1, x1, x1, x1,
x1, x1, x1, x1,
};

void setup() {
pinMode (timeLedPin1, OUTPUT);
pinMode (timeLedPin2, OUTPUT);
pinMode (timeLedPin3, OUTPUT);
pinMode (timeLedPin4, OUTPUT);
//Timeled are all off
digitalWrite(timeLedPin1,LOW);
digitalWrite(timeLedPin2,LOW);
digitalWrite(timeLedPin3,LOW);
digitalWrite(timeLedPin4,LOW);

pinMode (speakerPin, OUTPUT);
pinMode (ledPin, OUTPUT);
}

void loop() {
digitalWrite(ledPin, HIGH);
timer();
}

//This is how the timer works

void timer() {
timeSinceGetIn = millis();
if (timeSinceGetIn >0 && timeSinceGetIn <=4000)
{
digitalWrite(timeLedPin1,HIGH);
}
else if (timeSinceGetIn >4000 && timeSinceGetIn <=8000)
{
Serial.println("Yo!");
digitalWrite(timeLedPin1,HIGH);
digitalWrite(timeLedPin2,HIGH);
}
else if (timeSinceGetIn >8000 && timeSinceGetIn <=12000)
{
digitalWrite(timeLedPin1,HIGH);
digitalWrite(timeLedPin2,HIGH);
digitalWrite(timeLedPin3,HIGH);
}
else if (timeSinceGetIn >12000)
{
digitalWrite(timeLedPin1,HIGH);
digitalWrite(timeLedPin2,HIGH);
digitalWrite(timeLedPin3,HIGH);
digitalWrite(timeLedPin4,HIGH);
Serial.println("You are doomed!");
digitalWrite(ledPin, HIGH);
playNotes();
Particle.publish("HeyGetOut");
}
}

//This is how the song works
void playNotes(){
for (int thisNote = 0; thisNote <= 77; thisNote++){
int noteDuration = 1000/tempo[thisNote];
tone(speakerPin, melody[thisNote], noteDuration);
delay(tempo[thisNote]);
Serial.println("lalala~ you are doomed.");

//tempos!
int pauseBetweenNotes = noteDuration;
delay(pauseBetweenNotes);
noTone(speakerPin);
Serial.println("lalala~ ");

//leds dancing while playing
digitalWrite(timeLedPin1,HIGH);
digitalWrite(timeLedPin2,LOW);
delay(20);
digitalWrite(timeLedPin3,HIGH);
digitalWrite(timeLedPin4,LOW);
delay(20);
digitalWrite(timeLedPin1,LOW);
digitalWrite(timeLedPin2,HIGH);
digitalWrite(timeLedPin3,LOW);
digitalWrite(timeLedPin4,HIGH);
delay(20);
digitalWrite(timeLedPin4,LOW);
}
}``````
Click to Expand
0

# Outcome

0
testSound IOT Assignment 1
ruolan xia
0

## Reflection

The implementation of design is beyond my thinking. I was confident with my skills to visualize a design concept until I found myself incapable when getting my hands on the circuit.

Trial and error makes me confident in learning something new. When problem occurs, it's hard to tell whether it's a hardware or programming problem. And sometimes it takes me 2 hours to solve "serious" issue, which turns out to be a "stupid" general knowledge in physics. So I learn by doing something wrong but gradually fall in love with the process.