49713 Designing for the Internet of Things
· 18 members
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Found in DioT 2019: Augmented Objects · UNLISTED (SHOWN IN POOLS)
Let you know when your significant other or roommate is home or not
One of the main items that came up in the interview was knowledge about your home space and if someone was there. In college, living with one or multiple roommates is the norm and many times you need to know if someone is home. This knowledge is used for a multitude of reasons from needing someone to bring them forgotten homework to preheating the oven for you so you can pop that frozen pizza in as soon as you walk through the door.
With this project I wanted to show that a device can be used to track the ingress and egress of an apt or home. The flex sensor would go against the door and when the door is opened it will push the sensor to a certain amount. If the sensor passes the amount an led and buzzer will go off notifying that the door is in fact open and someone is most likely entering or leaving. This is just a way of keeping track of someone being inside the living space or not.
At first I tried to use a hall effect sensor to keep track of the state of the door but with the certain sensor I would need to have the magnet change poles in order to change the state. This provided an issue that I could not figure out and honestly did not have the time to look into (snow days messed up timing).
After this I settled on the flex sensor for my readings. This allowed me to use an analog signal to read the flex of the sensor and create an if statement for when it reaches a certain amount. When it does it triggers an led to flash and a piezo buzzer to sound as a sort of alarm that the door is open.
What was hard was trying to go through the different sensors and find the best one(s) that would fit my needs. Although the flex sensor works it is not the ideal component for this application as it has the possibility of getting caught in the closing door. Due to time constraints and my limited knowledge I had to settle and use what I could.
The proof of concept works as intended. Once the flex sensor reaches a certain limit of 3500 both the led and the buzzer go off indicating movement. The state reading changes and pushes to the particle console and is read as 1, or that someone is in the home. AN ITEM I could not figure out was how to keep the state the same value until the sensor reached that threshold again. For example, if the state = 0 then the sensor hits >3500 the state = 1, but once the sensor goes back under 3500 the state returns to 0. It troubled me that I could not figure out how to have the state stay at 1 until the sensor went above 3500 again.
Continuing on with this project, I could probably adjust the sensor used to create maybe an IR or Photosensitive motion sensor so that it does not physically interact with the moving door. Along with this I could potentially set up a locking system that when it reads state of 0 saying that no one is home the door could automatically lock or be controlled by the cloud.
Overall this project really got me thinking about how to interact and think in the space of connected devices. Not only how to think but how to build and what components are used for what, even possibly being substitutes for other components.
//Flex Door Sensor
//Define led and flex sensor pins
int ledPin = D2;
int flexPin = A0;
int buzzPin = D3;
//Define flex sensor reading and led brightness
int flexRead = 0;
int flexInv = 4095;
int ledBrightness = 0;
//Define begining state
int state = 0;
void setup() {
//Set up the led output
pinMode(ledPin, OUTPUT);
Particle.variable("Flex", &flexInv, INT);
Particle.variable("State", state);
Particle.variable("led", ledPin);
}
void loop() {
// Use analogRead to read from the sensor
// This gives us a value from 0 to 4095
//Inverse the flex reading
flexRead = analogRead(flexPin);
flexInv = 4095 - flexRead;
// Map this value into the PWM range (0-255)
// and store as the led brightness
//ledBrightness = map(flexInv, 3000, 4095, 0, 255);
//analogWrite(ledPin, ledBrightness);
//delay(100);
//if loop to trigger led and buzzer
if (flexInv > 3500)
{
state = 1;
analogWrite(ledPin, 255);
delay(100);
analogWrite(ledPin, 0);
delay(100);
analogWrite(ledPin, 255);
tone(D3, 200, 1000);
}
else
{
state = 0;
analogWrite(ledPin, 0);
digitalWrite(buzzPin, LOW);
}
}
Click to Expand
This project is only listed in this pool. Be considerate and think twice before sharing.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Let you know when your significant other or roommate is home or not
January 31st, 2019