roberto garciaDevarshi Patel
Published

MEGR 3171 Wireless Security Camera

An affordable security camera controlled by your phone through Wifi connection.

IntermediateFull instructions provided4 hours352
MEGR 3171 Wireless Security Camera

Things used in this project

Hardware components

Photon
Particle Photon
×2
Transistor TIP31C
×1
Camera
A camera with Wifi capabilities
×1
Resistor 220 ohm
Resistor 220 ohm
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Two from the particle kit, one for the camera.
×3
Breadboard (generic)
Breadboard (generic)
×2
Jumper wires (generic)
Jumper wires (generic)
×10
Servos (Tower Pro MG996R)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

3D view of 2 photons

Screen shot 2017 11 24 at 3 57 29 pm opsvtjecg8

Schematic View

Screen shot 2017 11 24 at 4 15 08 pm iz5aikbmed

Code

Camera Movement Code

Arduino
//Security Camera Code

Servo myservo; 
                
                
int pos = 0;                                                
int digitalvalue=0;                                         
int status=0;


void setup()
{
    Particle.function("gong", gong);                        
    myservo.attach(D0);                                     
    myservo.write(50);                                    
    
        Particle.function("transistor", transistor);        

    Particle.variable("digitalvalue", &digitalvalue, INT);  
    Particle.variable("status", &status, INT);
    Particle.function("digitalvalue",transistor);
    Particle.function("status",gong);
    
    
    pinMode(D7, OUTPUT);                                    
}



int transistor(String command) 
{                       
    if(command.startsWith("on"))                                    
    {                            
    digitalWrite(D7, HIGH);
            Particle.publish("cam_on","camera is on");      
            digitalvalue = 1;                              
    
        return 1;                                                      
    }
    if(command.startsWith("off"))                               
    {                               
    
    digitalWrite(D7, LOW);
            Particle.publish("cam_off","camera is off");    
            digitalvalue= -1;                              
            delay(1000); 
            
            
        return 2;                                                         
    }

}



int gong(String command)                                    
{                          
    if(command.startsWith("right"))                                  
    {                            
           // wait 100 ms
        myservo.write(0)                                   
          // turn off LED
          ;status = 1;
          
        return 1;                                          
    }
    if(command.startsWith("left"))                              
    {                               
    
            myservo.write(100);                            
            status = -1;
                
                
            delay(1000);             
        return 2;                                         
    }
    if(command.startsWith("center"))                          
    {                               
    
            myservo.write(50);                             
            status = 0;
                
                
            delay(1000);              
        return 3;                                          
    }
}

void loop()
{
                                                            
}

Camera Indicator

Arduino
//LED Camera On Indicator

int led = D7;                                                           


void setup() {
    
    pinMode(led,OUTPUT);
    digitalWrite(led,LOW);                                              
    
    Particle.subscribe("cam_on",led_on, "2b001a000247353138383138");    
    
    Particle.subscribe("cam_off",led_off, "2b001a000247353138383138");  

}

void led_on(const char *event, const char *data)
{
 digitalWrite(led,HIGH);                                                
 
}

void led_off(const char *event, const char *data)
{
 digitalWrite(led,LOW);                                                
 
}

void loop() {

}

Credits

roberto garcia

roberto garcia

1 project • 1 follower
Devarshi Patel

Devarshi Patel

1 project • 1 follower
Mechanical Engineering student at UNC Charlotte

Comments

Add projectSign up / Login