Jump to content
43oh

GoPro Camera Controller


Recommended Posts

The GoPro HD Hero camera does not have a remote shutter input, but it does have an interface bus on the back designed for an add-on LCD display and other accessories not yet available.

 

I thought it would be interesting to interface an MSP430 to the camera to automate the taking of photos for time-lapse photography, and to add a remote control and motion detection.

 

The easiest way to do this turned out to be the PWR/MODE button which is brought to the connector on the back. The camera has a one-button mode which will take a photo or start a video recording when the camera is powered on.

 

I elected to use the EZ430 F2012 because I had one that I got for free a while back.

controller1.jpg

The interface to the camera is via two wires - the pullup on the input for the power button provides enough power to run the MSP430. A 1,000 microfarad cap provides power for when the processor grounds the input to turn the camera on and off.

 

GoProControllerSchematic.gif

 

The program only has to do a few things. After initializing the output and setting up the watchdog timer to interrupt every 256 mSec, it goes to sleep.

 

On interrupt, it decides what to do next which depends on where it is in the picture taking cycle. A cycle consists of: Turn on the camera with a 250 mSec low pulse. Wait 3 seconds for the image capture. Turn off the camera with a 3 second low pulse. Flash the LED to show things are working. Wait until it is time to do it all again.

 


//******************************************************************************
//
//  GoPro HD Camera Control using BUS connector
//  for MSP430F2012
//
//  Uses PWR/MODE button to wake camera up and take photo in One Button Mode
//
//  Set SHOT_RATE for number of seconds between shots
//  If not using xtal control, time requires CALIBRATION
//
//  closes PWR button for 250 mSec to wake up camera
//  waits  3.75 seconds for snap and store
//  closes PWR button for 3 seconds to turn camera off
//  flashes LED to indicate start of next cycle
//
//  Peter Jennings  http://benlo.com/msp430
//
//******************************************************************************

#include "msp430.h"

#define SHOT_RATE 60    //   seconds between shots
#define CALIBRATION 7  //   calibration to improve accuracy


#define WAITING 0    //   waiting for next cycle
#define STARTING 1   //   button down to start
#define WAITING_CAMERA 2  //   waiting for camera to take pic
#define STOPPING 3   //   button down to stop

static int tick;
static int state;

static int time;  // seconds since last save


void main(void)
 {
 WDTCTL = WDTPW + WDTHOLD;           // Stop watchdog timer

 P1SEL |= 0x00;                      // P1.1 option select - just I/O
 P1DIR |= 0x11;                      // Set P1.0 P1.4 to output direction
 P1OUT |= 0x10;                      // LED off, GoPro button off

 BCSCTL2 |= DIVS_3;                  // SMCLK/8
 WDTCTL = WDT_MDLY_32;               // WDT Timer interval 32mS

 tick = 0;
 time = 10;                       // wait for cap to charge up
 state = WAITING;

 IE1   |= WDTIE;                  // Enable WDT interrupt 256 mSec
 _BIS_SR(LPM0_bits + GIE);        // Enter LPM0 with interrupt
 }

// Watchdog Timer interrupt service routine

#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
 {
 if ( (state == STARTING) && (tick >= 1 ) )  // start takes .25 seconds
     {
     state = WAITING_CAMERA;
     P1OUT  |= 0x10;           // button up
     }
 if ( tick & 0x03 )            // most of the time
    {
    P1OUT &= ~0x01;            // LED off and go back to sleep
    }
 else                          // about once very 1.024 seconds
    {
    time++;
    if ( (state == WAITING) && (time >= SHOT_RATE+CALIBRATION) )  // time for photo
        {
        P1OUT &= ~0x10;             // button down
        time = 0;
        tick = 0;
        state = STARTING;
        }
    else if ((state == WAITING_CAMERA) && (time >= 4) ) // time to turn off
        {
        state = STOPPING;
        P1OUT &= ~0x10;             // button down
        }
    else if ((state == STOPPING) && (time >= 7)) // should be off now
        {
        state = WAITING;
        P1OUT  |= 0x10;             // button up
        P1OUT  |= 0x01;           // LED flash to indicate done cycle
        }
    }
 tick++;                  // 256 mSec ticks
 }

 

I have written no more than a few lines of code for this processor in my life and am basically unfamiliar with it. I would appreciate any pointers from those who are more familiar with the chip, both with regards to the hardware interfacing and the software program. I am sure I am missing some basic details and it would be good to correct them before other users implement these instructions. Feedback is encouraged.

 

The complete writeup is at http://benlo.com/msp430/GoProController.html

 

Peter

Link to post
Share on other sites
  • 2 weeks later...

Cool 8-) . Where can I get one of those mated connector? Are you able to squeeze the connector and MSP430 into the GoPro housing case?

 

I flew my RC copter with the GoProHD on board to water once and my GoPro HD almost went under water at which time I didn't have the case. The copter crashed onto the edge of a pond and the camera flew off to the grass while the copter sank to the water. Since then I wouldn't leave the camera without the case. Even when on a desk, it's easy to flip the camera onto the desk surface and scratch the big lens.

 

You can use timerA instead of watch dog timer and you can have a lot better time resolution. I believe the power consumption is also less. I was building several security lights that only flashes once per 10 seconds using AA battery, and the power consumption was around 6uA when the MSP is sleeping if I remember correctly (it's been a while)

 

-Thanh

Link to post
Share on other sites
Cool 8-) . Where can I get one of those mated connector?

 

There is a link on my web page to the supplier.

 

Are you able to squeeze the connector and MSP430 into the GoPro housing case?

 

Yes, it fits in the waterproof back with the small connector, using the wider backs that comes with the LCD display. The one pictured works with the open back after a little Dremel work.

 

You can use timerA instead of watch dog timer and you can have a lot better time resolution.

 

In fact, I just built a second one with a crystal for accurate time resolution and lower power by setting the ports to output.

 

Peter

Link to post
Share on other sites
  • 2 months later...

I bought a total of 3 connectors from the part number and from Ridax link from your home page. The one from Digikey is the one that has the lowest profile but it won't fit inside the water proof housing. The other two connectors bought from Ridax: SD-Q (male) and SD_K (female). The SD_Q is even taller than the one I bought from Digikey.

 

Which one did you say that would fit inside the waterproof housing? I read you said the high profile one can be use with the case with some dremel work, but does that make hole on the case? It rains a bit here and I need the case sealed

 

Thanks

 

-Thanh

Link to post
Share on other sites
I read you said the high profile one can be use with the case with some dremel work, but does that make hole on the case? It rains a bit here and I need the case sealed

 

To fit the controller into a completely waterproof case, I use the back that comes with the LED back. That has sufficient extra room for everything with any of the low profile connectors.

 

I also sealed the top of the LED back cover that has holes in it for sound. That makes a water resistant - i.e. open at the bottom but not at the top enclosure so I can run a cable out the bottom holes for USB power on the bus plug. Good for making very long time lapses.

 

It has the added advantage of not steaming up when the temperature changes drastically, so I also use it on my helmet when flying. High altitude flights used to steam the lens as the temperature changed rapidly.

 

Peter

Link to post
Share on other sites
...

To fit the controller into a completely waterproof case, I use the back that comes with the LED back. That has sufficient extra room for everything with any of the low profile connectors.

...

Thanks for the info Peter!

Did you actually mean "LCD back" cover? That seems to add a lot of space

 

Regards

 

Thanh

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...