Anna DevereauxAaron Macri
Published

The WakeUp-Inator

The Wakeup-Inator is a system that serves as a manual alarm and the ultimate accountability partner that will ensure no man is left behind.

BeginnerFull instructions provided5 hours77
The WakeUp-Inator

Things used in this project

Hardware components

Argon
Particle Argon
×2
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Buzzer
Buzzer
×2
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
LED (generic)
LED (generic)
×2
Jumper wires (generic)
Jumper wires (generic)
×15
Male/Female Jumper Wires
Male/Female Jumper Wires
×4
Breadboard (generic)
Breadboard (generic)
×4

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Fritzing
Maker service
IFTTT Maker service
Google Docs

Story

Read more

Schematics

Live Data Time Stamps (UltraSonic Sensor)

This is the file link to see our live data time stamps and graph. You can set up your IFTTT to keep a running tally of wake-up times, just as we have.




https://docs.google.com/document/d/1ndndZxbn7Ln4fkUHB5r1EOpyWx8z3zr510IX9yLLS4I/edit?usp=sharing

Aaron's Argon Fritzing Diagram

Anna's Argon Fritzing Diagram

Logistical Diagram

Code

Aaron's Argon Code

C/C++
int LED = D7; // pin D7 is set to the LED
int trigPin = D3; //the trigger pin for the ultrasonic sensor is set to pin D3
int echoPin = D2;// the echo pin for the ultrasonic sensor is set to pin D2
int buzzer = D5;   //pin D5 is set to te buzzer

void setup() {
    pinMode(LED, OUTPUT); //set LED pinmode to an output
    pinMode(buzzer, OUTPUT); //set buzzer pinmode to an output
    pinMode(trigPin, OUTPUT); //set the ultrasonic trigger pin as an output
    pinMode(echoPin, INPUT); //dset the echo pin as an input so it can receive the trigger signal
    Particle.subscribe("toggle", toggleLed, MY_DEVICES); //subscribe to the toggle cloud event for the button
    Serial.begin(9600);
}

void loop() {
    long duration, distance; //store variables
  digitalWrite(trigPin, LOW);// send trigger signal
  delayMicroseconds(2);// delay 2 microseconds
  digitalWrite(trigPin, HIGH);// turn off trigger signal
  delayMicroseconds(10);// delay 10 microseconds
  digitalWrite(trigPin, LOW); //send trigger signal
  
  duration = pulseIn(echoPin, HIGH); //define the variable 'duration' as the pulse integer of the echopin response of trigger
  distance = (duration*0.343)/2;// define distance as the duration of the trigger signal, 
  //multiply by the speed of sound and divide by two because it will have to travel the distance twice
  
  if (distance<= 200){ //if distance is less than 20 cm 
      Particle.publish("sensor", PRIVATE); //publish sensor event to be read by other particles
      delay(1000);//delay 1 second
  }
Serial.print("distance: ");//this is for live data tracking of the ultrasonic reading distance in mm
Serial.println(distance);
delay(50);
}

void toggleLed(const char *event, const char *data){ //this is the event reading of the push button
    digitalWrite(LED, HIGH);//if the event is recognized turn on the LED and Buzzer for 1 second
    tone(buzzer, 3000);// buzzer tone frequency 3000 hz
    delay(2000);
    digitalWrite(LED, LOW);//after 2 second turn off the LED and buzzer again
    noTone(buzzer);
}

Anna's Argon Code

C/C++
int button = D4; //button read off of D4
int LED = D7; // LED read off of D7
int buzzer = D5; //buzzer read off of D5


void setup(){
        pinMode(LED, OUTPUT); //set LED pin as output
        pinMode(D4, INPUT_PULLUP); //set D4 (button) as an input pull up resistor
        pinMode(buzzer, OUTPUT);//set buzzer pin as output
        Particle.subscribe("sensor", toggleAaron, MY_DEVICES); //subscribe to read for 
        //the ultrasonic event publishing
}

void loop(){
    button = digitalRead(D4); // set the button to read pin D4, for its input
    if(button==LOW){ //LOW state means button has been depressed
    Particle.publish("toggle", PRIVATE); //if button is depressed publish event "toggle" to the cloud
    delay(1000); //delay of 1 second to avoid throttling the publishing
    }
}
void toggleAaron(const char *event, const char *data){ //call on instances of the ultrasonic event publishing
    digitalWrite(LED, HIGH); //turn LED on
    tone(buzzer, 3500); //make buzzer tone of 5000 hz
      delay(1000); // delay 1 second
    digitalWrite(LED, LOW); //turn off LED
    noTone(buzzer); //turn on LED
}

Credits

Anna Devereaux

Anna Devereaux

1 project • 0 followers
Aaron Macri

Aaron Macri

1 project • 0 followers

Comments

Add projectSign up / Login