[Solved] Contolling digital camera with Arduino Mega

Hi,

I am new to Arduino and am in need of help. I do apologize in advance if I am not clear on what I am trying to achieve.

I am trying to use a Arduino Mega to control a Digital Camera (Mini DV). The Arduino is connected to a PIR which when detects motion sets Digital Pin 3 to High. The Digital Pin 3 is connected to a 1k resistor and a NPN Transistor (P2N2222AG) which is then connected to the record button of the Digital Camera which operates on its own 5V battery.

I am unable to trigger the record function.

The general picture of the schematic is included

https://picasaweb.google.com/lh/photo/9aj4dXb8Y5QwX-y3RRo83dX-t50N34v9Q3AjJRYm57o?feat=directlink

Code:

int ledPin = 13;                // choose the pin for the LED 
int inputPin = 2;               // choose the input pin (for PIR sensor) 
int camPin = 3;
int pirState = LOW;             // we start, assuming no motion detected 
int val = 0;                    // variable for reading the pin status 

void setup()
{ 

  pinMode(ledPin, OUTPUT);      // declare LED as output 
  pinMode(inputPin, INPUT);     // declare sensor as input 
  Serial.begin(9600); 

} 

void loop()
{
  
  val = digitalRead(inputPin);  // read input value 
  if (val == HIGH)              // check if the input is HIGH
  {             

    digitalWrite(ledPin, HIGH);  // turn LED ON 
    delay(150); 

    if (pirState == LOW)        // we have just turned on 
    { 

      Serial.println("Motion detected!"); 
      // We only want to print on the output change, not state
      digitalWrite(camPin, HIGH);
      delay(150);
      digitalWrite(camPin,LOW);
      pirState = HIGH; 

    } 

  }
  else
  { 

    digitalWrite(ledPin, LOW); // turn LED OFF 
    delay(300);     
    if (pirState == HIGH)      // we have just turned off 
    { 

      Serial.println("Motion ended!"); 
      // We only want to print on the output change, not state
      digitalWrite(camPin, HIGH);
      delay(1000);
      digitalWrite(camPin,LOW);
      pirState = LOW;     } 

  } 

}

Any and every help will be greatly appreciated.

Than you.

The transistor needs to be in parallel with the record button if its to do anything. (Unless you intend holding
down the record button continuously while you circuit does its job).

Thank for the reply MarkT.

I do apologize for that. I did not realize that I had the wrong schematic. Here is the correct one.

https://picasaweb.google.com/lh/photo/ff50bocX-TctsVESdf9qzNX-t50N34v9Q3AjJRYm57o?feat=directlink

I have two wire from both terminals of the record button on the camera connected to the E and C of the Transistor.

insazacorp:
Thank for the reply MarkT.

I do apologize for that. I did not realize that I had the wrong schematic. Here is the correct one.

https://picasaweb.google.com/lh/photo/ff50bocX-TctsVESdf9qzNX-t50N34v9Q3AjJRYm57o?feat=directlink

I have two wire from both terminals of the record button on the camera connected to the E and C of the Transistor.

Do you have that ground wire wired also to an arduino ground pin? That is a requirement.

Lefty

No Lefty, I did not but will try it now. Thank you much.

Lefty, I can't thank you enough. What you pointed out was the exact problem. After I connected the ground on the Arduino it worked great. Thank you again.

I learned that too!

connect all GNDS.. :slight_smile: