Camera Intervalometer for Bulb Ramping

A new project I’ve just finished using an Arduino Mega, Lithium battery pack, TL230R frequency to light convertor IC and the DS1307 RTC and a 20x4 LCD display. It uses non-blocking timing code and and an interrupt with MsTimer2 so that the buttons remain fully functional when taking images rather than using the easier delay() function. It’s been done a thousand times before but as a photographer I do like the control this system is giving me when using the camera in bulb mode and modifying the pulse length to adjust the shutter speed.

It is based on a system developed on the OpenMoco site but I’m very pleased with the end result. It can also be used as a simple intervalometer with interval and pulse adjustments.

Details can be seen here http://www.photosbykev.com/wordpress/2010/05/20/arduino-intervalometer-for-digital-cameras/

best regards
Kev

Where's the case from?

Looks very professional... Hats off to you :)

Mowcius

It's from Maplins in the UK http://www.maplin.co.uk/Search.aspx?menuno=69743&MenuName=Instrument%20Cases

The one I purchased has rails to take a 100x150mm vero board. It also has removable ends and one side panel slides off which makes the machining very simple.

I didn't know maplins did them that cheap. I will have to pop down and buy some...

Maplins is still pretty sh*t though most of the time ;)

Mowcius

Not going to disagree with that statement lol although they are useful for the occasional plug and socket and they have some really nice aluminium enclosures :)

What I do want to add to the programme is a way to remember the last used values so that the system can be restarted with the previously used values.

Any pointers to do this would be appreciated

regards Kev

right. Still don’t quite understand what values it is but you will want to look up EEPROMwriteanything. Just do a search for it and there is some info on it. It’s pretty simple to use.

That should solve your value storage issues.

Mowcius

I looked over the code you posted briefly, but could not find where you are doing the frequency input processing for the TL230R frequency to light convertor IC ? Probably just old eyes at this end. ;)

I bought this IC from SparkFun some time ago, but haven't come up with a application for it and it does not seem that simple a task, depending on if you want to utilize the full range of the sensor.

Lefty

Retrolefty: this page gives you the code and the details for the conversion http://roamingdrone.wordpress.com/2009/03/25/lightrails-dynamic-external-exposure-control-for-time-lapse/

Mowcius: thank you for the link, it's exactly what i want. If I change any of the presets in the software on the fly it will allow me to save those values rather than changing the values in code and reloading the programme.

Mowcius: thank you for the link, it's exactly what i want. If I change any of the presets in the software on the fly it will allow me to save those values rather than changing the values in code and reloading the programme.

Well not quite a link cos I was feeling lazy :P

I thought that would be what you wanted :)

Mowcius

Ok so it wasn't a link but without the keyword "EEPROMwriteanything" I would of been chasing ghosts for a long time lol

Using the EEPromwriteanything routines I added a routine to monitor a button press on power up , If the button is pressed the EEprom values should load from memory but nothing seems to happen

I’ve added these functions before the setup()

// functions for memory read/write
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
  const byte* p = (const byte*)(const void*)&value;
  int mem;
  for (mem = 0; mem < sizeof(value); mem++)
    EEPROM.write(ee++, *p++);
  return mem;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
  byte* p = (byte*)(void*)&value;
  int mem;
  for (mem= 0; mem < sizeof(value); mem++)
    *p++ = EEPROM.read(ee++);
  return mem;
}

// values to read/write to Eeprom
struct config_t
{
  long INTERVAL_TM;
  long EXPOSURE_TM;
} configuration;

INTERVAL_TM and EXPOSURE_TM are the values I want to read and write from memory.

in the setup() loop I’ve added this to check for a button press on power up and if pressed load the variables from memory. If not pressed the default values are used.

  // check if Centre button is pressed on startup. If HIGH load values from memory
  if( digitalRead(B_CT) == HIGH)
  {
    EEPROM_readAnything(0, configuration);
    
    lcd.setCursor(0, 1);
    lcd.print("Saved values loaded");
    delay(1000);
    lcd.clear();  
  }

Everytime I vary the values of the two variables I use this code to write the new values to memory

    // update memory
    EEPROM_writeAnything(0, configuration);

but it doesn’t work :frowning: I know the programme is seeing the button press as I get “saved values loaded” but the values that get used are the default ones defined earlier in the programme.

Any thoughts or obvious errors I’ve made would be appreciated.

I am tired so I can't really think properly but are you sure you can do it that way? I thought you would have to do a different one for each value you want to save and read.

I have no really looked into it that much. The most I have done is saved a floating point variable with it :P

Mowcius

I'll strip it back to basics and get it working on it's own before trying to integrate it into the programme lol

My mistake I wasn't assigning the data EEPROM_readAnything was getting to my own variables and likewise I wasn't assigning my data to the configuration.variables before using EEPROM_writeAnything to write to the EEPROM.

The revised code in setup() is:

  // check if Centre button is pressed on startup.
  // If LOW load values from memory and overwirte default values (default is to load memory values)
  // if HIGH use default values
  if( digitalRead(B_CT) == LOW)
  {
    EEPROM_readAnything(0, configuration);
    INTERVAL_TM = configuration.INTERVAL_TM;
    EXPOSURE_TM = configuration.EXPOSURE_TM;

    lcd.setCursor(0, 1);
    lcd.print(" Saved data loaded");
    lcd.setCursor(0, 2);
    lcd.print("Press FIRE to reset");
    delay(1000);
    lcd.clear();  
  }
  else
  {
    lcd.setCursor(0, 1);
    lcd.print("Default data loaded");
    delay(1000);
    lcd.clear();    
  }

the "press FIRE to reset" is a visual prompt if I want to reset the system i.e. press and hold the FIRE button and turn the arduino on for default values

and the code to write to EEPROM now looks like:

    configuration.INTERVAL_TM = INTERVAL_TM;
    configuration.EXPOSURE_TM = EXPOSURE_TM;
    EEPROM_writeAnything(0, configuration);

a very useful capability now I've figured out how to use it :)

Ahh yes I see what you mean.

Glad you worked it out

Mowcius