Jump to content
43oh

Camera Intervalometer


Recommended Posts

Hello all

 

This is my first MSP430 project. I'm an AVR person, but I'm trying to switch to MSP430 because TI really seem to be trying with some excellent support and a brilliant product line up. That, and I also seem to have Launchpads taking over my den. :lol:

 

Anyway, this originally started out as a simple IR based shutter remote for Nikon cameras. I then upgraded it to an intervalometer. I then added 7 segment displays.

 

I built it using the "build then do schematics later" method. ;) I'll get some schematics drawn up and tidy the code. Once that's done, I'll publish it all here.

 

Currently:


  • MSP430G2231
    IR LED driven by 2N2222 transistor
    2 x 7 segment displays driven by 2 74HC595 shift registers
    Has shutter override so the external trigger sources can be implemented (lightning detector etc)

 

To do:


  • Add extra input to configure shutter interval without doing it in code
    Support more cameras
    Shutter control using Chronos (hmmm :think: )
    Anything else I might think of

 

Sorry about the quality of the video. I filmed it with a Sony Bloggie which is great for outdoor stuff but useless inside.

post-2194-135135508714_thumb.jpg

Link to post
Share on other sites

Yes, yes! Of course the code will be shared. I started doing the schematics last night but got carried away with the latest TIDeals.com offer. ;)

 

I'll still post code/schematics for the above implementation, but the design is about to change. I'm going to do away with the 7 segments and one of the shift registers and instead use an 8 x 2 LCD. This will give way more flexibility for displaying relevant information.

Link to post
Share on other sites

Here is the schematic for the version of the intervalometer posted above. I won't be posting the Eagle files as this design is currently changing significantly. I will be implementing an LCD and adding more buttons.

 

Code will follow shortly. ;)

post-2194-135135509001_thumb.png

Link to post
Share on other sites

Code, as promised.

 

Again, the code is defunct and will be changing soon. It's also very heavily commented. :oops:

 

#include "msp430g2231.h"

#define SHUTTERIND BIT0
#define SHUTTERBUTTON BIT3
#define IROUT BIT4
#define STATUS BIT6
#define SCLOCK BIT6
#define SDATA BIT7
#define SLATCH BIT7

#define SHUTTER nikonShutter()
//#define SHUTTER canonShutter()
//#define SHUTTER pentaxShutter()
//#define SHUTTER sonyShutter()

volatile int i;
volatile int shutterInterval = 30;
volatile int intervalCounter;
volatile int delayAcc = 0;

unsigned char digits[10] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};

void nikonShutter();
void shiftOut(char w, char latch);

void main(void)
{
intervalCounter = shutterInterval;

WDTCTL = WDTPW + WDTHOLD;      // stop WDT

DCOCTL |= DCO0 + DCO1;
BCSCTL1 |= RSEL0 + RSEL1;
BCSCTL1 &= ~(RSEL2 + RSEL3);

BCSCTL2 |= DIVS0 + DIVS1;

P1DIR |= IROUT;
P1OUT &= ~IROUT;
P1SEL &= ~IROUT;

P1DIR |= SHUTTERIND;
P1OUT &= ~SHUTTERIND;
P1DIR |= STATUS;
P1OUT &= ~STATUS;

P1REN |= SHUTTERBUTTON;
P1OUT |= SHUTTERBUTTON;
P1IE |= SHUTTERBUTTON;
P1IES |= SHUTTERBUTTON;
P1IFG &= ~SHUTTERBUTTON;

P2SEL = 0x00; // User XIN/XOUT as output (P2.6, P2.7)
P2DIR |= SCLOCK + SDATA;
P1DIR |= SLATCH;

TACCR0 = 46;
TACTL = TASSEL_2 + MC_1 + ID_0;
TACCTL0 = CCIE;

_EINT();
}

void nikonShutter() {
P1OUT |= SHUTTERIND;

// 628, 8798, 119, 496, 125, 1128, 122, 19973
for (i = 0; i < 2; i++) {
	P1SEL |= IROUT;
	__delay_cycles(628);
	P1SEL &= ~IROUT;
	__delay_cycles(8798);
	P1SEL |= IROUT;
	__delay_cycles(119);
	P1SEL &= ~IROUT;
	__delay_cycles(496);
	P1SEL |= IROUT;
	__delay_cycles(125);
	P1SEL &= ~IROUT;
	__delay_cycles(1128);
	P1SEL |= IROUT;
	__delay_cycles(122);
	P1SEL &= ~IROUT;
	__delay_cycles(19973);
}

P1OUT &= ~SHUTTERIND;
}

void shiftOut(char w, char latch) {
P1OUT &= ~SLATCH;
for (i = 0; i < 8; i++) {
	if ((w & 0x80) == 0x80) {
		P2OUT |= SDATA;
	} else {
		P2OUT &= ~SDATA;
	}
	P2OUT |= SCLOCK;
	w <<= 1;
	P2OUT &= ~SCLOCK;
}
if (latch) {
	P1OUT |= SLATCH;
	P1OUT &= ~SLATCH;
}
}

#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{ 
SHUTTER;
P1IFG &= ~SHUTTERBUTTON;
P2SEL = 0x00;
}

#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
delayAcc++;
if (delayAcc == 836) {  // Near as damn it 1Hz
	P1OUT ^= STATUS;
	shiftOut(digits[intervalCounter % 10], 0);  // 1's
	shiftOut(digits[intervalCounter / 10], 1);  // 10's
	intervalCounter--;
	if (intervalCounter == -1) {
		intervalCounter = shutterInterval;
		SHUTTER;
	}
	delayAcc = 0;
}
}

Link to post
Share on other sites

Just a quick update.

 

I had some project stalling issues, but I picked this up again last night. I've got an LCD working via a shift register now, saving precious I/O. I'll now be getting back on with updating the software and will post here accordingly.

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

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...