Matthew Aggari
Published

Lane Tech HS "Not At Home Alert"

Automatically text your parents that you're out of the house when your wallet isn't in it's designated dock!

BeginnerFull instructions provided97
Lane Tech HS "Not At Home Alert"

Things used in this project

Hardware components

ky-008 laser transmitter
×1
Argon
Particle Argon
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Breadboard (generic)
Breadboard (generic)
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service

Hand tools and fabrication machines

Scissors, Free Fall
Scissors, Free Fall
Tape, Foam
Tape, Foam

Story

Read more

Schematics

Fritzing Schematic

Code

Untitled file

ActionScript
No preview (download only).

Particle Code

C/C++
Refer to comments on how to set a custom time.
int laser = D3;
int sensor = A0; //A0

int delayTime= 200;
int minuteMarker=0.5; //put how many minutes you want to pass before the alert gets sent here
//I want mine to go off after 30 seconds, so I put 0.5, or half of one minute
int timer= (minuteMarker*60000)/delayTime;//this variable checks when the alotted time has passed by multiplying the amount of minutes by 
//10000, the amount of miliseconds in a minute, and then dividing it by how frequently the code is looped
bool missingAlert = false;
int missingTime = 0;

void setup() {

  Serial.begin(9600);
  pinMode(laser, OUTPUT);
  pinMode(sensor, INPUT);
}

void loop() {

  int sensorValue = analogRead(sensor);
  digitalWrite(laser, HIGH);
 
  if (sensorValue <= 10) 
  {
      missingTime=0;
      missingAlert = false;
      Serial.print("Present: ");
      Serial.println(missingTime);
  }
  
  else if (sensorValue > 10)
  {
      missingTime++;
      Serial.print("Missing: ");
      Serial.println(missingTime);
  }
  
  if (missingTime == timer)
  {
    Particle.publish("Alert", "now");
    missingAlert = true;
  }
  
  if (missingAlert==true)
  {
    Serial.println("MISSING!!!");
  }
  Serial.print("Analog Value: ");
  Serial.println(sensorValue);
  delay(delayTime);
}

Credits

Matthew Aggari

Matthew Aggari

3 projects • 2 followers

Comments

Add projectSign up / Login