snip–><–snip

Jump in to arduino

by on Nov.17, 2010, under Arduino, Coding, Electronics

So i spent the next evening converting the proof of concept over for use with the arduino.

I have added some extra bits:

1) A button for triggering the shutter.

2) A button to Increase the shutter open time.

3) A button to Decrease the shutter open time.

.

.

Parts used:

3 x small push buttons.

4x (insert ohms here) resistors

1x long breadboard.

1x npn transistor.

A ton of hook up wires.

.

The buttons were pretty straight forward to hook up, which was nice. The trigger button is connected to pin 12, the “add time / up” button is connected to pin 7 and the “reduce time / down” button is connected to pin 6.

.

second_go

The code to run the buttons looks like this:

</code>

/*
simple program for setting my canon cameras shutter time.

I do long welding glass exposures and this will come in handy so i
wont need to hold the trigger down for too long.
The arduino will do that for me.

*/

#define SHUTTER 13    // defines the shutter control
#define TRIGGER 12    // defines the trigger button
#define UP      7     // defines the +1 second button
#define DOWN    6     // defines the -1 second button
#define SECOND  1001  // defines how long a second is

int curTime = SECOND; // sets the current time to be one second at the
start of the program
int val = 0;           // this is the trigger button control

int upButton = LOW;
int downButton = LOW;

void setup()
{
 pinMode(SHUTTER,OUTPUT);
 pinMode(TRIGGER,INPUT);
 pinMode(UP,INPUT);
 pinMode(DOWN,INPUT);
 Serial.begin(9600);     // open the serial port at 9600 bps:
                         // so we can see what the arduino is doing
                         //before we attach the lcd screen later.
}
// the loop function
void loop()
{
 // get the vars.
 upButton = digitalRead(UP);
 downButton = digitalRead(DOWN);
 val = digitalRead(TRIGGER);

 if (upButton == HIGH)
 {
  // adds one second on to current time
  curTime = curTime + SECOND;
  Serial.print("up button\n");
  delay(200);
 }
 if (downButton == HIGH)
 {
  // removes one second from current time
  curTime = curTime - SECOND;
  Serial.print("down button\n");
  delay(200);
 }

 if (val == HIGH)
 {

  // takes the photo.
  Serial.print("Shutter will be open for: ");
  Serial.print(curTime);
  Serial.print(" miliseconds\n");
  digitalWrite(SHUTTER,HIGH);
  delay(curTime);
  digitalWrite(SHUTTER,LOW);
  Serial.print("shutter closed\n");
 }
 // delays the loop for a tad
 delay(200);
}

<code>

You’ll see that i have my “SECOND” variable set to 1001. I have been running into issues where the shutter open and close time doesn’t match a correct one second interval…. Which is really strange…

Also because i have no way at the moment to display the information, i’m sending debug prints to the serial, so i can view it on the serial monitor.

second_go

.

I found a really good explanation about the canon 3 pin connect Im interfacing with:

Canon N3 details.

.

To finish this project i have a few more steps to do:

a) Add another button to control the mode the device is in.

b) Get hold of a LCD to allow for real world use……

c) Refine the code,  I’m still learning the api,  so im sure i can clean this up a little and work out where my time is going.

d) Start to plan a durable storage case to house the project in.

second_go

.

:, , , , ,
No comments for this entry yet...

Leave a Reply


seven × 4 =

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!