Gavin Jeganathan
Published

Niner Pan Cam

A pan shift that will allow you so see more angles on your camera!

IntermediateFull instructions provided2 hours165
Niner Pan Cam

Things used in this project

Hardware components

Photon
Particle Photon
×2
Arlo Q Camera
Any camera with WiFi capabilities will work with this project. Does not have to be an Arlo Q.
×1
Resistor 221 ohm
Resistor 221 ohm
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Two are used for the photons, one is used for the camera.
×3
General Purpose Transistor PNP
General Purpose Transistor PNP
×1
LED (generic)
LED (generic)
×1
Servos (Tower Pro MG996R)
×1
Jumper wires (generic)
Jumper wires (generic)
Will need plenty
×1
Breadboard (generic)
Breadboard (generic)
×2
Case or Box
This will be used to place both photons in. Further details are below.
×1

Software apps and online services

Mobicle
ControlEverything.com Mobicle
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Drill
A drill was used to place holes in the case. A different tool can be used depending on the case used.

Story

Read more

Schematics

Camera Pan

Pans the Camera

Camera LED on/off

LED indicating if camera is on or off

Graphs- On/Off Indicator

The graph expresses the time the camera is on or off. Negative 1 shows that it is off, positive 1 shows that it is on.

Code

Camera Pan Code

Arduino
This is the code for the camera commands.
//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) 
{                       
    if(command.startsWith("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              
    }
    if(command.startsWith("off"))                               //when command is off, D7 set to low
    {                               
    
    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.startsWith("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"
    }
    if(command.startsWith("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"
    }
    if(command.startsWith("center"))                          // if command is center, returns to 50°
    {                               
    
            myservo.write(50);                              // move servo to 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 LED Display

Arduino
LED display showing if camera is on/off
//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

Gavin Jeganathan

Gavin Jeganathan

1 project • 0 followers

Comments