Arduino GoPro Hero2 Control

I wanted to do some time lapse photography where the camera would take 1 capture every 20 minutes or so of a race car chassis fabrication project. After looking around on the web, I decided the GoPro Hero2 would work. The GoPro has a built-in time lapse feature but it can’t handle long intervals between pics (I think 60 seconds is the max).

I learned that the camera has a one button mode that allows it to snap off a capture as soon as you turn it on. My project will take place over a period of weeks, so running it all off the internal battery of the GoPro was not an option.

The GoPro has a USB  port on the side for charging. I got a dual USB wall wart to power both the Arduino and the GoPro and will leave them plugged in, so I don’t need to worry about battery capacity. The Arduino likely would run a long time on a battery pack but I have found that the GoPro with the EyeFi SD card I will use seems to go through a fully charged battery pretty quickly. If I didn’t mind downloading the pics manually before the memory card got full, I could use a standard SD card instead of the EyeFi card and probably run the whole thing on a battery. A 32 GB SD card would hold a fair amount of 11 MP shots.

I also didn’t want to have to remove the SD card from the GoPro when it got full, so I got an Eye-Fi SD card that automatically transfers the images from the GoPro to a nearby computer that is on a wireless network.

I realized that if I could turn the camera on remotely, it would take one picture, then I could turn it off until the next time I needed a picture. With a 20 minute interval between pictures, the Arduino would be running the whole time, but the GoPro would be totally off except for when it was taking the picture or transferring it to the PC. Since both the Arduino and the GoPro are plugged into USB power sources, power consumption was not a consideration for my application. All I needed was a way to turn the camera on and off with the Arduino, and a connector to access the GoPro bus on the back of the camera.

Why you might ask, don’t I leave the camera on all the time as well, and just trigger the shutter remotely? The short answer is because there is no pin on the Hero2 bus that controls the shutter, as far as I have been able to determine. The only way I could figure to easily control the shutter was by using the 1 button mode, and that requires turning the camera on and off.

I also wanted to set this thing up at a fabrication shop and let it run without intervention. The camera will likely be placed in an inconvenient spot. Rather than capture a picture every 20 minutes 24/7, I decided that at least I could avoid taking pictures when the shop lights are off, or at night. I used one of the analog inputs of the Arduino board along with a CdS photocell as a light detector. The sketch within the Arduino checks to see if there is light, and only does the capture sequence when the lights are on.

I know it’s not the most elegant solution, but I am in a hurry and this will work for what I want to do. The Eye-Fi SD card transfers the photos to the PC in folders by date, so when it’s a weekend that no work is taking place, but the lights happen to be on and captures are taking place, I can simply delete the images in the folders for Saturday and Sunday. The Eye-Fi SD card supposedly will delete files when it gets full to a certain point, preventing it from ever filling up, but I have not tested that aspect yet.

Of course, you could add a real time clock to the Arduino and do the captures on a schedule set by programming, but I’ll leave that to someone else to figure out. If the Arduino was going to be close to the computer, I could create a program in Delphi to control the Arduino via USB using the PC internal clock, but the computer won’t be close enough to the camera for that to work in this case, so it will be a standalone Arduino Uno project.

I have an Arduino prototyping board, but I decided to cheap out and put the circuitry on a Radio Shack board instead, and save the Arduino board for another project down the road.

Here is a basic schematic of the circuit:

The relay is from RS, their part No. 275-0240, manufactured by TE Connectivity (manufacturer’s part number is OUAZ-SS-105D). It is a SPDT relay with a 5 VDC coil, contacts rated for 1 Amp.


The transistor is a 2N2222 NPN. The diode is a 1N4004. The resistors are all 1/4 watt. The photocell came out of my junk drawer and there’s no telling who made it. The LEDs have panel mount bushings so I can put them on the outside of the project box so I can tell at a glance if it is working.


The GoPro Bus connector is from Mouser, their part number 656-DD1P030MA1 made by JAE electronics. At $7.27 it is the most expensive part in the circuit, not counting the Arduino or the GoPro that is! There are probably other connectors that are better or cheaper, but this is the one that I used and it worked fine.

The prototyping board layout is a top view of the board. The copper traces are actually on the bottom of the board, but are printed on top for convenience. The blue dotted lines represent the input and output connections as well as jumper wires that complete the circuit. The LEDs and the CdS cell connect to the proto board via 4-pin headers that I had in my parts bin. Unused pins are marked with an x.

In summary, the parts list is as follows:

  • 5V Relay – RS p/n 275-0240 or TE Connectivity p/n OUAZ-SS-105D $4.69
  • 1N4004 Diode ~40 cents
  • 1K Resistor, 1/4W ~25 cents
  • 10K Resistor, 1/4W ~25 cents
  • 470 Ohm Resistors, 1/4W  (2 ea) ~25 cents each, 50 cents total
  • 2N2222 NPN Transistor 37 cents
  • LEDs (2 ea) 15 cents each, 30 cents total
  • 30 pin GoPro bus connector – Mouser p/n  656-DD1P030MA1 $7.27
  • CdS Photocell ~ 80 cents
  • 4 pin headers for LED and CdS connections (optional – could be hard wired) $?
  • Prototyping board RS p/n 276-150 $2.20
  • Arduino UNO $25 Mouser
  • Dual USB wall wart $10 Ebay
  • Various hookup wire & solder
  • Total cost (less 4 pin headers) approximately  $52

The Arduino and the dual USB wall wart can be taken out of this device and used for other projects when the time lapse trigger is not needed, so I have mixed feelings about listing them in the cost of the project. Without those two items, the dedicated time lapse components total around $17. Whatever enclosure you put them in is additional. I plan on using a plastic project box of some kind.

I will probably add a toggle switch on the front panel of whatever enclosure I put it into so that the USB power to the Arduino and the proto board can be switched off as needed without having to unplug anything.

Here’s a photo of the completed proto board. As you can see I made one change with the routing of the 5V supply from the USB wall wart, bringing it in from the top since the pin header was obscuring the hookup point on the end and I didn’t want to run the jumpers on the back side of the board.

Here are the pigtails for the LEDs and the CdS cell. The LEDs are a panel mount model that came with the molded part and a short pigtail, but you could just as easily use a bare LED and drill the right sized hole in the enclosure, put a dab of hot glue on it and you’re set. The CdS cell will probably be fitted in a hole in the enclosure that faces the ceiling mounted lights. If I put the CdS cell in my closed hand, the camera will not cycle, but when I open my had, it gets enough ambient light to trigger the sequence and start taking pictures. The sensitivity is adjustable through the trigger threshold in the Arduino sketch.

Here is the 30 pin GoPro bus connector pigtail ready to be connected to the proto board. It has spring loaded tangs on each side that lock it in place once it is inserted into the GoPro. I used needle nosed pliers to pull out all of the pins except the two that I needed (after making sure it worked properly) to make soldering to the tiny pins easier. I found that if you are careful and don’t bend the pins they can be reinserted, so pulling the ones you don’t think you will need might be a better solution than snipping them off, especially if it turns out you were wrong and cut off the pins you need! It’s been reported that you can supply USB power through the bus connector as well, but I decided to stick with the side connector for this project, and only use the bus connector for the power on/off function.

I will have to cut a slot in the GoPro plastic housing to clear this connector. I’m not using mine near water, so it’s not really a problem. I may just take the back off the housing and secure the camera in place with rubber bands, who knows.

The Arduno sketch controls the timing of events. According to others who have experimented with the GoPro cameras, pulling pin 12 low (connecting pin 12 to a ground pin on the GoPro bus) for 250 milliseconds turns the camera on, and pulling pin 12 low for 3 seconds turns the camera off.

I am using the delay(nnnn) function to control the timing. The nnnn is supposed to be the number of milliseconds to wait before executing the next line in the sketch. Unfortunately, it doesn’t seem to correspond exactly. When I programmed the Arduino for a delay of 3000 which should have been 3 seconds, it was closer to 2 seconds, and sometimes failed to trigger the camera to shut off. After some experimenting, I determined that a delay value of 1250 to 1400 per second is more realistic. You could do an experiment with a stopwatch to get a more accurate calibration, but trial and error works too.

Here’s the sketch to control the camera.


* Photocell as trigger for GoPro Time Lapse
* Copyright 2012 ETC, Inc.
* All Rights Reserved

int PhotoCellInput = 0; // Input pin for the photocell
int PhotoCellValue;     // Resulting analog value from photocell
int ledPowerPin = 10;   // Power on to circuit
int ledStatusPin = 11;  // GoPro is Taking a Picture
int goProControlPin = 12;  // GoPro On/Off Control

void setup(void) {
  pinMode(ledPowerPin, OUTPUT);
  pinMode(ledStatusPin, OUTPUT);
  pinMode(goProControlPin, OUTPUT);
  //Serial.begin(9600); // monitor serial value via the Serial Monitor

void loop(void) {
  digitalWrite(ledPowerPin, HIGH);
  digitalWrite(ledStatusPin, LOW);
  digitalWrite(goProControlPin, LOW);
  PhotoCellValue = analogRead(PhotoCellInput);
  if (PhotoCellValue > 200) // it’s not dark, so take a picture.
      digitalWrite(ledStatusPin, HIGH);   // Turn on LED to show its working
      digitalWrite(goProControlPin, HIGH); // Engergizes relay and takes control pin LOW
       //for 250 mS – corresponding to a delay more like 350
      digitalWrite(goProControlPin, LOW); // De-energize relay. GoPro should now be
      //turned on
      digitalWrite(ledStatusPin, LOW); // turn off status LED after turn on pulse is
// one shot mode will take a picture. The delay is needed to allow for the picture to be
// taken and uploaded to PC via Eye-Fi card
// delay interval is to make sure camera has had enough time to transfer the picture
// delay needs to end before the camera takes another picture
// my GoPro is set for 60 seconds between pics.
      delay(50000); // delay for around 40 seconds, figuring a delay of 1250 per second
      // now turn the camera off by taking control line low for 3 seconds
      digitalWrite(ledStatusPin, HIGH); // turn on LED  
      digitalWrite(goProControlPin, HIGH); // energizes relay and takes control pin LOW.
      delay(3800); // 3 seconds to turn off
      digitalWrite(goProControlPin, LOW); // done with turnoff process
      digitalWrite(ledStatusPin, LOW); // turn off LED
      // now delay until the next picture needs to be snapped.
      // I want the delay to be 20 minutes or so, so 20 x 60 = 1200 seconds x 1250 mS/sec  
      // or  1,500,000 mS
      delay(1500000); // 20 minutes worth give or take – adjust to your liking       
  //Serial.print(“Photocell Value: “);
     // comment out the if statement above and use these 
     //lines to see in the serial monitor what the analog value is from the photocell
    // under various conditions of light and dark so you will know what value to use
    // to  determine if a pic should be shot or not
 //Serial.println(PhotoCellValue); // the input reading from the Photo Cell


This sketch worked for me. You might have a better way to do it. This should allow for some interesting time lapse sequences, at least where a power outlet is handy.

Posted in Uncategorized | 2 Comments

LCD Display Custom Character Generator

I came across the Arduino platform recently, and I thought I would create a place to share information about various projects. I bought an Arduino Mega 2560 and got it working very quickly. I completed a couple of projects with it, including driving an LCD display and making some stepper motors spin.

The LCD project was interesting. I bought the LCD117 Serial Display Board and 16 x 2 LCD Display from along with some other stuff. I read some of the tutorials on the web about how to create and display custom characters. I whipped up a Windows based program in Delphi to assist in creating the code for custom characters, and I have posted the installer for the program in a zip file. Click on the screenshot to download the installer, then post comments with feedback after you have a chance to try it so I can implement changes and/or improvements.

Click the Screenshot to Download the 5x8 LCD Custom Character Designer program

Posted in Uncategorized | 4 Comments