This summer I purchased a GoPro Hero2 camera. Mostly so I could bore my friends and family with videos of my airplane related escapades:
Along with HD video, the camera will also take nice wide angle fish eye photographs, and has a timelapse mode.
I wanted to do a long timelapse video of the assembly of the next RC model aircraft I was going to build. The GoPro seemed like it could do the job well. The wide angle lens lets me get most of my workshop in the frame. The main problem was that I wanted a way to automatically start and stop the time-lapse. Here's what I came up with.
The requirements were that the GoPro had to start taking photos when I went into the shop, it had to stop taking the pictures when no one was in the shop, and it had to stay charged.
First thing was to do some research on the interfaces available on the GoPro. There's a mini-USB connector for charging and accessing the data in the camera, HDMI out, microphone jack, and a 30-pin connector on the back of the camera. The 30 pin connector looked like it had some possibilities.
I found a pin-out for the 30 pin connector here: http://chargeconverter.com/blog/?p=71
The pins that jumped out at me as looking useful were:
Pin 5 and 6: USB 5V power for charging the camera.
Pin 12: Power/Mode button (for turning the camera on and off).
Pin 24: GoPro battery power while the camera is turned on.
My plan was to trigger the whole thing off of the light switch in the basement. By doing the following:
Connect a regular USB wall charger to one of the light sockets.
Use the 5V from the USB charger to charge the GoPro.
Use the 5V from the USB charger to also power an Arduino.
The Arduino, once powered would check to see if the camera is on. If the camera wasn't on it would toggle the Power/Mode button (pin 10) to power the camera.
By putting the GoPro into "One Button Mode" I could have the GoPro automatically start taking pictures as soon as it's powered.
When I'm not in the workshop, I would turn off the lights. When this happens:
The Arduino detects that it has lost 5V power from the wall charger.
The Arduino stays alive on the power provided by the GoPro on Pin 24.
The Arduino turns off the camera by toggling The Power/Mode button (Pin 12).
The GoPro powers down, and removes power from Pin 24. The Arduino, having lost power shuts down as well.
This all might seem complicated, but the result is that the camera is taking pictures whenever the lights in the room are turned on. You can see this in action in my breadboard prototype in the video below.
So here's the circuit that I ended up with.
The Arduino code is at the bottom of this post for those that are interested
Initially I tried to control the GoPro Power switch (Pin 12) directly from an output from the Arduino. However, I couldn't make it work. I think what was happening was the pull up on the GoPro pin 12 was enough to keep the Arduino alive, and the system went into an endless loop of powering on and off and on and off when I removed USB power. I ended up adding the FET to separate the GoPro switch pin from the Arduino. This seems to work much better.
Here's the circuit soldered onto some prototyping board:
The red connector from the left is 5V power coming from a USB wall wart. The connector on the right goes to the GoPro 30 pin connector.
Incidentally, soldering to the GoPro connector was a little tricky. For once the magnifying glass on my "Third Hand" came in useful.
Once the backshell is on the 30-pin connector though, it ALMOST looks professional:
Which goes through the Arduino Circuit and then to the GoPro.
Here's the Arduino Code.
int ON_PIN = 9;
int WALL_POWER = 12;
int CAMERA_POWER = 11;
int wall_power_state = 0;
int camera_power_state = 0;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(ON_PIN, OUTPUT);
digitalWrite(ON_PIN, HIGH);
pinMode(WALL_POWER, INPUT);
digitalWrite(WALL_POWER, LOW);
pinMode(CAMERA_POWER, INPUT);
digitalWrite(CAMERA_POWER, LOW);
Serial.begin(9600);
Serial.println("Arduino Boot");
}
void loop() {
wall_power_state = digitalRead(WALL_POWER);
camera_power_state = digitalRead(CAMERA_POWER);
Serial.print("WALL POWER:");
Serial.print("\t");
Serial.print(wall_power_state);
Serial.print("\t");
Serial.print("CAMERA POWER:");
Serial.print("\t");
Serial.print(camera_power_state);
if (wall_power_state && !camera_power_state) {
//turn on the camera
digitalWrite(ON_PIN, HIGH);
Serial.print("\t");
Serial.println("Case 1");
}
if (!wall_power_state) {
//turn off the camera
digitalWrite(ON_PIN, HIGH);
Serial.print("\t");
Serial.println("Case 2");
// Power_Pin_Low_Z();
delay(3000);
// pinMode(ON_PIN, OUTPUT);
digitalWrite(ON_PIN, LOW);
delay(3000);
//delay(10000);
}
if (wall_power_state && camera_power_state) {
//bring the camera pin high-Z
digitalWrite(ON_PIN, LOW);
Serial.print("\t");
Serial.println("Case 3");
}
}
Along with HD video, the camera will also take nice wide angle fish eye photographs, and has a timelapse mode.
I wanted to do a long timelapse video of the assembly of the next RC model aircraft I was going to build. The GoPro seemed like it could do the job well. The wide angle lens lets me get most of my workshop in the frame. The main problem was that I wanted a way to automatically start and stop the time-lapse. Here's what I came up with.
The requirements were that the GoPro had to start taking photos when I went into the shop, it had to stop taking the pictures when no one was in the shop, and it had to stay charged.
First thing was to do some research on the interfaces available on the GoPro. There's a mini-USB connector for charging and accessing the data in the camera, HDMI out, microphone jack, and a 30-pin connector on the back of the camera. The 30 pin connector looked like it had some possibilities.
I found a pin-out for the 30 pin connector here: http://chargeconverter.com/blog/?p=71
The pins that jumped out at me as looking useful were:
Pin 5 and 6: USB 5V power for charging the camera.
Pin 12: Power/Mode button (for turning the camera on and off).
Pin 24: GoPro battery power while the camera is turned on.
My plan was to trigger the whole thing off of the light switch in the basement. By doing the following:
Connect a regular USB wall charger to one of the light sockets.
Use the 5V from the USB charger to charge the GoPro.
Use the 5V from the USB charger to also power an Arduino.
The Arduino, once powered would check to see if the camera is on. If the camera wasn't on it would toggle the Power/Mode button (pin 10) to power the camera.
By putting the GoPro into "One Button Mode" I could have the GoPro automatically start taking pictures as soon as it's powered.
When I'm not in the workshop, I would turn off the lights. When this happens:
The Arduino detects that it has lost 5V power from the wall charger.
The Arduino stays alive on the power provided by the GoPro on Pin 24.
The Arduino turns off the camera by toggling The Power/Mode button (Pin 12).
The GoPro powers down, and removes power from Pin 24. The Arduino, having lost power shuts down as well.
This all might seem complicated, but the result is that the camera is taking pictures whenever the lights in the room are turned on. You can see this in action in my breadboard prototype in the video below.
So here's the circuit that I ended up with.
The Arduino code is at the bottom of this post for those that are interested
Initially I tried to control the GoPro Power switch (Pin 12) directly from an output from the Arduino. However, I couldn't make it work. I think what was happening was the pull up on the GoPro pin 12 was enough to keep the Arduino alive, and the system went into an endless loop of powering on and off and on and off when I removed USB power. I ended up adding the FET to separate the GoPro switch pin from the Arduino. This seems to work much better.
Here's the circuit soldered onto some prototyping board:
The red connector from the left is 5V power coming from a USB wall wart. The connector on the right goes to the GoPro 30 pin connector.
Incidentally, soldering to the GoPro connector was a little tricky. For once the magnifying glass on my "Third Hand" came in useful.
Once the backshell is on the 30-pin connector though, it ALMOST looks professional:
Now that that was working, I just needed to connect it up to the light in the workshop.
The extension chord goes to a USB wall charger.
Which goes through the Arduino Circuit and then to the GoPro.
The final result is I don't have to remember to turn on the camera when I walk into the workshop and start building. Here's a teaser:
Here's the Arduino Code.
int ON_PIN = 9;
int WALL_POWER = 12;
int CAMERA_POWER = 11;
int wall_power_state = 0;
int camera_power_state = 0;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(ON_PIN, OUTPUT);
digitalWrite(ON_PIN, HIGH);
pinMode(WALL_POWER, INPUT);
digitalWrite(WALL_POWER, LOW);
pinMode(CAMERA_POWER, INPUT);
digitalWrite(CAMERA_POWER, LOW);
Serial.begin(9600);
Serial.println("Arduino Boot");
}
void loop() {
wall_power_state = digitalRead(WALL_POWER);
camera_power_state = digitalRead(CAMERA_POWER);
Serial.print("WALL POWER:");
Serial.print("\t");
Serial.print(wall_power_state);
Serial.print("\t");
Serial.print("CAMERA POWER:");
Serial.print("\t");
Serial.print(camera_power_state);
if (wall_power_state && !camera_power_state) {
//turn on the camera
digitalWrite(ON_PIN, HIGH);
Serial.print("\t");
Serial.println("Case 1");
}
if (!wall_power_state) {
//turn off the camera
digitalWrite(ON_PIN, HIGH);
Serial.print("\t");
Serial.println("Case 2");
// Power_Pin_Low_Z();
delay(3000);
// pinMode(ON_PIN, OUTPUT);
digitalWrite(ON_PIN, LOW);
delay(3000);
//delay(10000);
}
if (wall_power_state && camera_power_state) {
//bring the camera pin high-Z
digitalWrite(ON_PIN, LOW);
Serial.print("\t");
Serial.println("Case 3");
}
}
No comments:
Post a Comment