user354487
Published

Doorbell Box

A small box which acts as both a doorbell and can be used to tell the person at the door whether you are home.

IntermediateFull instructions provided4 hours883
Doorbell Box

Things used in this project

Hardware components

Photon
Particle Photon
×1
SparkFun Photon Shield
×1
Parallax Continuous Rotation Servo
×2

Story

Read more

Custom parts and enclosures

boxdiagram.svg

Code

Doorbell Box Code

Arduino
Servo servo2_test;
Servo servo_test;
int analogvalue;            
void setup() {
pinMode(A0, INPUT);             // sets the pressure sensor pin as INPUT
servo_test.attach(D0);           //setting the pin numbers of each servo
servo2_test.attach(D1);
Particle.function("Servo", ServoToggle);
}
  
 void loop() {
 analogvalue = analogRead(A0);          //sets analoguevalue to read the pressure sensor pin
 
    if (analogvalue > 1) {                                  //states that if the pressure sensor pin at any point is greater than 1, then publish that doorbell is active 
                                                           
    Particle.publish("doorbell", "active",5, PRIVATE);
    }
    
 }
    
 int ServoToggle(String command) {              //in a seperate function of the box, if the comand COMING is sent to the photon (I use sms messaging), then turn the servos to change the message.
     if (command=="COMING"){
    {servo_test.write(0);                      //the speeds and timing of these servos will differ which each project
    }
     {servo2_test.write(0);
    }
    delay(8000);                                    //the general gist is that the servos turn to display the msaage on the paper, wait 30 seconds, return to their original position
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
    delay(30000);
      {servo_test.write(180);
    }
     {servo2_test.write(180);
    }
    delay(8000);
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
}
else if (command=="NOT HOME"){             //The same concept applies here, but the speeds and timing are adjusted so as to display the other message "Not Home"
    {servo_test.write(0);
    }
     {servo2_test.write(0);
    }
    delay(4500);
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
    delay(30000);
      {servo_test.write(180);
    }
     {servo2_test.write(180);
    }
    delay(4500);
    {servo_test.write(94);
 }
  {servo2_test.write(94);
    }
}
}

Credits

user354487

user354487

1 project • 0 followers

Comments