49-713 Designing for the Internet of Things
· 26 members
A hands-on introductory course exploring the Internet of Things and connected product experiences.
This is a home-security device which will alert you when an unknown person comes into your house.
Problem statement: I am designing this solution for all my friends who stay alone in an apartment. Many times when they are out for college, they get worried what if someone tries to break into their apartment. Hence, I am designing a solution for them so that they can keep a check on their home safety. If someone tries to enter their house, they will be notified about it via their phones. This way, they could take immediate action as well.
Goals: I am trying to design a device which would be right next to the door and will be activated by the owner once he leaves the house. It will be directly linked to his phone so that he could be notified as and when someone tries to enter his/her house.
Precedents
Photon home alert system - by Shawn Osborne and Tracy Easter https://particle.hackster.io/29519/photon-home-alert-system-39a289?ref=search&ref_id=home%20safety&offset=0
College Friendly Security system- by Aidia Naim, Thomas Joyce and Babiker Suliman https://particle.hackster.io/30375/college-friendly-security-system-e75394?ref=search&ref_id=home&offset=43
Process: Since this was the very first IoT project I was doing, I started with a very basic circuit and code and built upon it as I progressed. The first phase included having only PIR sensor and a LED which glowed when the sensor detected someone. Once this worked out properly, phase 2 included implementing a Piezo buzzer as well to add to the output. The third phase included giving it a more visual appeal. It was done by replacing the normal LED with an RGB LED which was green when no person was there but turned red and buzzed when it detected a person.
Outcome: The final bill of material consisted of following parts:
int inputPin = D0; // choose the input pin (for PIR sensor)
int redLed = D1;
int greenLed = D3; // LED Pin
int speakerPin = D2; // Piezo 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( redLed, OUTPUT );
pinMode( greenLed, OUTPUT);
pinMode( inputPin, INPUT); // declare sensor as input
pinMode(speakerPin, OUTPUT);
Particle.publish("hardikpatelpir");
}
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 event
if (pirState == LOW) {
//Particle.subscribe("hardikpatelpir2");
// we have just turned on
// Update the current state
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, LOW );
tone(speakerPin, 2000, 1000);
delay(1000);
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
pirState = HIGH;
//setLED( pirState );
}
} else {
if (pirState == HIGH) {
// we have just turned of
// Update the current state
pirState = LOW;
digitalWrite(greenLed, LOW);
//setLED( pirState );
}
}
}
/*void setLED( int state )
{
digitalWrite( ledPin, state );
}
*/
Click to Expand
Reflections
Initially, I was very scared about doing an actual working prototype in a week since I had never touched electronics or coding before. I decided to learn first from the IoT lab website before starting my project and I was very impressed by the lab website content. The diverse guides and tutorials made me very familiar with the different components. After that, I started building progressively. I started with very basic circuit and fewer components and kept adding more stuff as I learned. I was not able to meet all of my goals because without realizing the scope of things. I had planned on a camera taking image of the person who enters and sending it to my phone. I was able to realise IFTTT and used it to send message but could not work out the image thing yet. With further learning I get in the course, I am confident I would be able to incorporate much more advanced stuff as well.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
This is a home-security device which will alert you when an unknown person comes into your house.
January 25th, 2017