Things used in this project

Hardware components:
Photon new
Particle Photon
×2
Transistor TIP31C
×1
Camera
A camera with Wifi capabilities
×1
220 Resistor
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
Two from the particle kit, one for the camera.
×3
12002 04
Breadboard (generic)
×2
11026 02
Jumper wires (generic)
×10
Servo (generic)
×1
Software apps and online services:
Particle Build IO
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

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 CodeArduino
//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 IndicatorArduino
//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

0d878329d371af3f141071ffd719071e
roberto garcia
1 project • 1 follower
Contact
7c7a71069d0413f96d87c2b6dc855ce2
Devarshi Patel
1 project • 1 follower
Mechanical Engineering student at UNC Charlotte
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login