Ben KwiatkowskiAlexander Harkey
Published

Remote Security Camera

A live feed movable security camera that is not only monitored from a remote location, but is remote controlled as well.

IntermediateShowcase (no instructions)2 hours3,096
Remote Security Camera

Things used in this project

Hardware components

Photon
Particle Photon
×2
Servos (Tower Pro MG996R)
×1
Camera (generic)
The camera used is in the link below: https://www.amazon.com/dp/B0140OFWRM/ref=cm_sw_r_em_api_c_vNjnybE0Z5QGA
×1
TIP31C Transistor
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 220 ohm
Resistor 220 ohm
One needed but two are Included in each Particle Photon kit
×1
LED (generic)
LED (generic)
One needed, there is one included in each Particle Photon kit.
×1
Jumper wires (generic)
Jumper wires (generic)
Any single strand wire can be used.
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Three total are used, NONE need to be purchased separately. One to power the control photon and one to power the indicator photon. There is one cable included with each Particle Photon. The other cable is included when the camera is purchased.
×3
Breadboard (generic)
Breadboard (generic)
Two breadboards total are needed, there is one included per Particle Photon Kit.
×2
Outlet Plug power source for USB
Two are used, one for the control photon and one for the indicator photon. NONE need to be purchased separately. The plugs are included with the photons when purchased.
×2

Software apps and online services

Mobicle
ControlEverything.com Mobicle
Atomiot

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Drill

Story

Read more

Schematics

Micro USB

This picture displays what the cable looks like when it is stripped. As stated on the story page, only the positive and ground was used (pin 1 and 4).

3D View

Schematic View

Code

Security Camera Code

Arduino
//Security Camera Code

Servo myservo;  // create servo object to control a servo
                
                
int pos = 0;                                                // variable to store the servo position
int digitalvalue=0;                                         //sets inital values for graphs
int status=0;


void setup()
{
    Particle.function("gong", gong);                        // create a function called "gong" that
                                                            // can be called from the cloud
                                                            // connect it to the gong function below

    myservo.attach(D0);                                     // attach the servo on the D0 pin to the servo object
    myservo.write(50);                                      // initial servo position
    
        Particle.function("transistor", transistor);        // create a function called "gong" that
                                                            // can be called from the cloud
                                                            // connect it to the gong function below

    Particle.variable("digitalvalue", &digitalvalue, INT);  //data for graphing
    Particle.variable("status", &status, INT);
    Particle.function("digitalvalue",transistor);
    Particle.function("status",gong);
    
    
    pinMode(D7, OUTPUT);                                    // set D7 as an output to control transistor
}



int transistor(String command) 
{   delay(1000);                    
    if(command == "on")                                     //when command is on, pin D7 set to high
    {                            
    digitalWrite(D7, HIGH);
            Particle.publish("cam_on","camera is on");      //publishes to the cloud to communmicate with other particle
            digitalvalue = 1;                               //sets digital value to 1 to be graphed
    
        return 1;                                           //returns 1 if command is understood              
    }
    else if(command == "off")                               //when command is off, D7 set to low
    {                               
    delay(1000);
    digitalWrite(D7, LOW);
            Particle.publish("cam_off","camera is off");    //publishes to the cloud to communmicate with other particle
            digitalvalue= -1;                               //sets digital value to -1 to be graphed
            delay(1000); 
            
            
        return 2;                                           //returns 2 if command is understood                  
    }

}



int gong(String command)                                    //function to control camera turn
{                          
    if(command == "right")                                  //if command is right, camera turns to the right
    {                            
           // wait 100 ms
        myservo.write(0);                                   // move servo to 0°
          // turn off LED
          status = 1;
          
        return 1;                                           // return a status of "1"
    }
    else if(command == "left")                              // if command is left, camera turns to the left
    {                               
    
            myservo.write(100);                             // move servo to 100°
            status = -1;
                
                
            delay(1000);             
        return 2;                                           // return a status of "2"
    }
      else if(command == "center")                          // if command is center, returns to 50°
    {                               
    
            myservo.write(50);
            status = 0;
                
                
            delay(1000);              
        return 3;                                           // return a status of "3"
    }
}

void loop()
{
                                                            // empty because we call functions via the cloud
}

Camera On/Off Indicator

Arduino
//LED Camera On Indicator

int led = D7;                                                           //declare D7


void setup() {
    
    pinMode(led,OUTPUT);
    digitalWrite(led,LOW);                                              //sets D7 to LOW
    
    Particle.subscribe("cam_on",led_on, "2b001a000247353138383138");    //subsribes from security camera photon when camera is on
    
    Particle.subscribe("cam_off",led_off, "2b001a000247353138383138");  //subsribes from security camera photon when camera is off

}

void led_on(const char *event, const char *data)
{
 digitalWrite(led,HIGH);                                                //if camera is on, D7 set to HIGH
 
}

void led_off(const char *event, const char *data)
{
 digitalWrite(led,LOW);                                                 //if camera is off, D7 set to LOW
 
}

void loop() {

}

Credits

Ben Kwiatkowski

Ben Kwiatkowski

1 project • 1 follower
Alexander Harkey

Alexander Harkey

1 project • 1 follower

Comments

Add projectSign up / Login