Camera Controller Project with LCD Screen

in short,

I am looking to build a little box that I can tag along with me on my camera adventures that will allow me to take photos of lightning and such with a phototransistor or photoresistor as a light detection device.

I would like to use the screen to display status messages, and also as a method of changing the values for the delay (compensate for camera shutter lag) and output pulse on time.

This will hopefully be a very veratile controller that may also work with Film SLR and DSLR cameras. Mine happens to be a Nikon D60.

Im looking for a little guidance as far as creating a menu system with a dual line LCD that is compatible with the LCD4Bit library that i have added and played with already (thanks guys, that works great btw!)

Im thinking it will use an analog pin to watch the voltage from a photoresistor/transistor and when the voltage goes over a pre-set number (this value is adjustable via numerical value entry into the LCD) it will trigger a digitalpin High, then delay (delay for a set period of time that is also adjustable via LCD numerical entry.) and then reset itself back and wait to be triggered again.

As far as interface, I would like to have 3 or 4 buttons, one to "move" through menus laterally, another to change the value (each push increases a number at cursor position by 1), another to finalize (like an "Enter" key)

I am unaware of how to program this...I have a general Idea, but im wondering before I start if there is something that may make this project a little easier or anything that you guys think may be a good idea to implement into my project.

I appreciate all interest in my project, thanks!

Josh

Like this?

http://www.bmumford.com/photo/camctlr.html

Me too - message me.

(BTW, pity you don't have a Canon - CHDK will do a lot of this stuff for you)

You ought to check the Exhibition section occasionally...neat projects in there. One of them was a Nikon camera controller that works over USB. It can control a lot of parameters as well as trigger shots from external stimulus. And it will work on cameras that don't have a bulb connector (D40 etc). Here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1243973647

It doesn't do exactly what you need, but hey, the source code is right there.

yeah, the white box one looked pretty close. lol.

it even controls the flash as well!

but does somebody have some sample code that i can check out to see how to code a menu type deal with c? using buttons and what not?

im new at coding with C.

thanks!

Oh and btw, another question a little off subject:

Is there anything known that will allow me to code my project in Visual Basic, and then compile it and have the arduino understand the code? i imagine it would have to somehow convert it to C, then compile it.

just wondering

Here is the Code that I am currently lookin at,

I started this yesterday, and it is nowhere near finished, please hit me with all the tricks and tips you guys have!

//Josh Nolan
//
//Rookie Camera Timer Project:
//
//Arduino ATMega328p on Duemilanove,
//Date Started: 6/4/2009
//
//  External Parts List so far:
//  ---------------------------
//  10K Variable Resistors x3
//  SPST momentary NO Pushbutton x1
//  Photoresistor or Phototransistor x1, havent decided yet lol


#include <LCD4Bit.h> 
LCD4Bit lcd = LCD4Bit(2);     //number of lines in display=2


int pbSens = 3;               //Pushbutton for displaying actual values from light sensor
int pbValue = 0;              //Variable to store button state if needed...

int SensorPin = 0;            //Analog, reads photosensor Voltage and uses that value for threshold comparison later on
int ShutterTrip = 13;         //DigitalPin for Shutter release pulse

int DutyValue = 1;            //Analog, Has 10K Variable to GND and + to provide a value for the on pulse time, to be stored in PulseTime Variable
int DutyTime = 0;             //Duration of on-time of Shutter release pulse (more for film cameras with a manual shutter control)

int TriggerThreshold = 2;     //Analog, Has 10K Variable to GND and + to provide a value for the trigger level. stored to TriggerTime
int TriggerLevel = 0;          //Variable to store value from the analog reading of triggerThreshold pin

int LagPulse = 3;             //Analog, Has 10K Variable to GND and + to provide a value for the Shutter Lag time (time between trig and actual shuter release)
int LagTime = 0;              //Variable to store value from Lagpulse





void setup() {    //preSet all default values (to prevent errors) and Pin States to Origin
  pinMode(pbSens, INPUT);
  pinMode(ShutterTrip, OUTPUT);
  digitalWrite(ShutterTrip, LOW);

  Enter = 0;
  Back = 0;
  Up = 0;

    lcd.init();
  //optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()
  //lcd.commandWrite(0x0F);//cursor on, display on, blink on.  (nasty!)
}

void loop() {  
  SensorVal = analogRead(SensorPin);
  DutyTime = analogRead(DutyValue);
  TriggerLevel = analogRead(TriggerThreshold);
  LagTime = analogRead(Lagpulse);
  
  if(SensorVal < TriggerLevel){     //Case: Sensor is less than trig level                                                                                                                                                                           
    lcd.clear();
    lcd.cursorTo(1, 0);
    lcd.printIn("Ready...");
    return;
  }
  else{     //Trigger level is High! release shutter!
    delay(LagTime);
    digitalWrite(ShutterTrip, HIGH);
    lcd.clear();
    lcd.cursorTo(1, 0);
    lcd.printIn("Triggered!");
    PulseTime = analogRead(DutyValue);
    delay(PulseTime);
    digitalWrite(ShutterTrip, LOW);                                                                                                                                                                                                                                                                                                                                                          
    delay(2000);
    lcd.clear();
    lcd.cursorTo(1, 0);
    lcd.printIn("Reset in 3...");
    delay(1000);
    lcd.clear();
    lcd.printIn("Reset in 2...");
    delay(1000);
    lcd.clear();
    lcd.printIn("Reset in 1...");
    delay(1000);
    lcd.clear();
    lcd.cursorTo(1, 0);

Ok, that last code was full of errors, This one compiles fine, apart from the issue of converting a numeric value to a string. anyone know how to do this?

Here’s the code now:

//Josh Nolan
//
//Rookie Camera Timer Project:
//
//Arduino ATMega328p on Duemilanove,
//Date Started: 6/4/2009
//
// External Parts List so far:
// ---------------------------
// 10K Variable Resistors x3
// SPST momentary NO Pushbutton x1
// Photoresistor or Phototransistor x1, havent decided yet lol

#include <LCD4Bit.h>
LCD4Bit lcd = LCD4Bit(2); //number of lines in display=2

int pbSens = 3; //Pushbutton for displaying actual values from light sensor
int pbValue = 0; //Variable to store button state if needed…

int SensorPin = 0; //Analog, reads photosensor Voltage and uses that value for threshold comparison later on
int SensorVal = 0;

int ShutterTrip = 13; //DigitalPin for Shutter release pulse

int DutyValue = 1; //Analog, Has 10K Variable to GND and + to provide a value for the on pulse time, to be stored in PulseTime Variable
int DutyTime = 0; //Duration of on-time of Shutter release pulse (more for film cameras with a manual shutter control)

int TriggerThreshold = 2; //Analog, Has 10K Variable to GND and + to provide a value for the trigger level. stored to TriggerTime
int TriggerLevel = 0; //Variable to store value from the analog reading of triggerThreshold pin

int LagPulse = 3; //Analog, Has 10K Variable to GND and + to provide a value for the Shutter Lag time (time between trig and actual shuter release)
int LagTime = 0; //Variable to store value from Lagpulse

void setup() { //preSet all default values (to prevent errors) and Pin States to Origin
pinMode(pbSens, INPUT);
pinMode(ShutterTrip, OUTPUT);
digitalWrite(ShutterTrip, LOW);

lcd.init();
//optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()
//lcd.commandWrite(0x0F);//cursor on, display on, blink on. (nasty!)
}

void loop() {
SensorVal = analogRead(SensorPin);
DutyTime = analogRead(DutyValue);
TriggerLevel = analogRead(TriggerThreshold);
LagTime = analogRead(LagPulse);

if (HIGH == digitalRead(pbSens)){ //May need debounce?
digitalWrite(ShutterTrip, LOW);
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(“SENS LIGHT VALUE”);
lcd.cursorTo(2, 0);
while (HIGH == digitalRead(pbSens)){
SensorVal = analogRead(SensorPin);
lcd.cursorTo(2, 0);
lcd.printIn(SensorVal); //****problem: need to convert the Sensor val to string so it can be printed
}
}
if(SensorVal < TriggerLevel){ //Case: Sensor is less than trig level
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(“Ready…”);
}
else{ //Trigger level is High! release shutter!
delay(LagTime);
digitalWrite(ShutterTrip, HIGH);
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(“Triggered!”);
DutyTime = analogRead(DutyValue);
delay(DutyTime);
digitalWrite(ShutterTrip, LOW);
delay(2000);
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(“Reset in 3…”);
delay(1000);
lcd.clear();
lcd.printIn(“Reset in 2…”);
delay(1000);
lcd.clear();
lcd.printIn(“Reset in 1…”);
delay(1000);
lcd.clear();
lcd.cursorTo(1, 0);
}
}

Before you put a lot of work into this, do some research on the web: I'm about 90% certain that what you have in mind won't work. By the time you register the lightning, and fire the shutter, it'll be gone.

For night lightning shots, I've had some good luck (and a lot of blank frames) by doing a time exposure and hoping that lightning strikes while the shutter is open. My mid-range "consumer" non-SLR has a "fireworks" setting that cranks down the ISO equivalent and does a long exposure. When it works (i.e., I get lucky on the timing), it works pretty well. When it doesn't, happily, it's digital, so there are no lab bills for envelopes full of black prints :)

Ran

Thanks for the reply.

I have thought of that, and i did look around online and see some other's projects as well. Some very detailed with issues and test values as well.

I understand that the time that a lightning bolt is visible is only a few microseconds, and I have seen arduino stuff trigger things faster, so I believe it is possible.

Maybe what i have as far as code works may slow it down, (including the LCD) i might have to keep the sketches as small as possible to keep the loop a little faster. but hey, you gotta start somewhere!

the sensitivity on this project is also adjustable, with your finger over the photoresistor, it reads about .8V on the analog pin. i can have the arduino trigger at just about any voltage, so the lower the trigger voltage is, the more sensitive it will be. Lightning flashes start off small and get longer, so if the device is set as sensitive as it can be, i believe that it may save a litle more time for the shutter lag time.

I see that your more expierienced than me with photographing lightning shots, i've never even tried it yet. Are there any other suggestions you could offer me to help this project out?