homehack

Made by Dong Qin

The device that I wanna create is Garage Usage Detector. It can detect whether our garage is in use and show the status on the door by LED.

0

Proposal

The device that I wanna create is Garage Usage Detector. It can detect whether our garage is in use and show the status on the door by LED. Of course, if it is possible, I wanna realize to send a message to me and my roommate. I share a single garage with my roommate. We don’t use the garage in turn but randomly, like who wanna use it or get home first. The problem there is that I have to drive into the backyard and check whether the garage is empty and then go back to the street to find another parking space. And our back yard is difficult to turn round.

0

Parts

PIR Motion Sensor (genetic)        x 1

Particle Photon                                x 1

LED (genetic)                                   x 1

Jumper wires

Breadbroad (genetic)                     x 1

Software

ThingSpeak API

0

Problem Statement

I am sharing a single garage with my roommate to save my money. But, sometimes, it can be very struggle when I drive to the garage and find my friend's car have already parked there. I have to turn around in the small back yard and find a place in street again. By this project, I can now whether and when my roommate park his car in the garage.

0

Goal

I want my device can monitor my garage and send me the information of my garage at anytime.

0

Process

In the beginning, I was thinking use the IR distance sensor through detect the distance to monitor whether there is a car in the garage. But, it doesn't work and then I changed to a PIR Motion sensor. When the sensor is blocked, the LED would be bright. At the same time, I want to realize that send the feedback to the internet so that I can monitor garage at anytime. To realize it, I used  ThingSpeak API which can connect to particle console and the data could be displayed in the Events part.

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 = 1000;      // 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 setLED(int state) {
    digitalWrite(ledPin, state);
}

void reportTheData() {
    if (val == HIGH) {
        // the current state is no motion
        // i.e. it's just changed
        // announce this change by publishing an event
        if (pirState == LOW) {
          // we have just turned on
          Particle.publish("PhotonMotion", "Motion Detected", PRIVATE);
          // Update the current state
          pirState = HIGH;
          setLED(pirState);
        }
    } else {
        if (pirState == HIGH) {
          // we have just turned of
          // Update the current state
          Particle.publish("PhotonMotion", "Off", PRIVATE);
          pirState = LOW;
          setLED(pirState);
        }
    }
}
Click to Expand
0
Project present
Don g Qin - https://www.youtube.com/watch?v=lKdFpAGhIPI
0

By this project, I learn how to work with wires and photon. I get the original idea from others which want to monitor mailbox. But, it didn't work on my project cause they are monitor whether and when the door of mailbox has been opened. It is not reasonable. Finally, I find a right sensor and solved this problem. I am so proud of what I have done in this project. I solved a small problem in practice using IOT products which I learned from class. A very exciting experience!

x
Share this Project


Focused on
About

The device that I wanna create is Garage Usage Detector. It can detect whether our garage is in use and show the status on the door by LED.

Created

January 24th, 2018