$17 Arduino-based nikon IR intervalometer + code


invervalometer_4

This is one of those projects I’ve been working on for quite a while now, but never well enough to actually put it in a box! Well.. it still has no box, but it’s much closer to a boxable form.

It is a RBBB arduino clone (but any arduinowillwork) with an ir led, a potentiometer, a resistor, and some perfboard. The perfboard is as much there to help provide a little bit of wire strain relief as it is to provide a place to mount the pot. The code simply reads the pot input and converts it into a delay() function. Then it fires the IR led with the nikon-specific magic to tell my d40 to shoot.

Here is an example of one of the timelapses I have shot.


IR invervalometer_3

Previous to this I have run both the nikon camera control software
on my laptop (or my hackintosh!) and used a grip/battery/intervalometer that had it’s own issues. This enables me to travel a lot lighter, set up quicker, look less conspicuous, and probably get better battery life (no more constantly transferring bits over the usb connection)

I really like this project because it doesn’t require much in the way of hardware. All told the rbbb was $12 and the rest was around $5. The next steps will probably include creating some granularity to the pot, making a case, and possibly adding a lcd screen to display the interval and number of shots fired. Does anyone else have any interesting additions to the software list? You can find the code below the pix.

Here are two more shots of the super simple wiring. Oh yeah! If you don’t have a SLR and you’re in the market for one – I have been pleasantly surprised with my D40. It’s not a pro camera, but it was cheap enough that I could spend my money on lenses and really have some fun. Here’s a link if you are interested.


invervalometer_1


invervalometer_2


Questions for the photographers out there:

What other features would you want this to have? The next steps for me include adding a LCD screen, a case, and a ‘range’ switch. I plan on it being a 3 position switch that will change the duration of the interval from 1-10,5-50, and 10-100 seconds. I am also coding the lcd so it will display the interval, # of shots fired, and length of video (if played back at 30fps)
I feel like that is a pretty good combination of functionality and simplicity. Does anyone else out there have any thoughts? Let me have ‘em in the comments!

Here is the code for the arduino!
Update – It seems like WordPress is mangling the code below. You can download a zip file of the .pde by clicking here Hopefully that helps!

// ----- C -------
/**
 * arduino Nikon IR remote
 * @license	Creative commons: Attribution-Noncommercial-Share Alike 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
 * @author Aurelien ANTOINE
 * version 1
 * date 20081217
 * found by ross here http://ilpleut.be/doku.php/code:nikonremote:start
**/
 
#define PIN_STATUS 13
#define PIN_IR_LED 12
#define FREQ 38400  // IR frequence
int hyst=20;
int PotVal = 0;
int count = 0;
int oldVal=0;
 
//shutter sequence (on,off,on,off ... in microsecond)
unsigned long sequence[] = {2000,27830,390,1580,410,3580,400,63200,2000,27830,390,1580,410,3580,400,0};
int seq_l;
 
//oscd is a delay in microsecond used at each oscillation.
int oscd;
 
void oscillate(int pin, unsigned long n, int shine){
	int ir_status=0;
	while(n>0){
		n--;
		delayMicroseconds(oscd);
		ir_status  =  !ir_status; 
		digitalWrite(pin,  ir_status && shine);  
	}
}
 
void snap(){
	int i;
	digitalWrite(PIN_STATUS,  1);  
	for(i=0;idigitalWrite(PIN_STATUS,  0);
}
 
void setup() {
	int min=1, max=100, i;
	int last_oscd=0;
	unsigned long before, intervalle;
	oscd=max;
 
	seq_l = sizeof(sequence)/sizeof(unsigned long);
 
	pinMode(PIN_STATUS, OUTPUT);
	pinMode(PIN_IR_LED, OUTPUT);
	Serial.begin(28800);
 
	//this "while" will process the best "oscd"
	Serial.println("Ready");
	while(last_oscd!=oscd){
		last_oscd=oscd;
		oscd=(min+max)>>1;
 
		before=millis();
		oscillate(PIN_STATUS, FREQ, 1);
		intervalle=millis()-before;
 
		if(intervalle >= 1000) max=oscd;
		else min=oscd;
 
		Serial.print(intervalle);
		Serial.print(" : ");
		Serial.print(min);
		Serial.print("<->");
		Serial.println(max);
	}
 
	Serial.print("oscd: ");
	Serial.println(oscd);
 

	//rewrite the sequence array, we replace all values in microsecond by the number of oscillation
	for(i=0;i<seq_l;i++){

		Serial.print(sequence[i]);
		Serial.print("->");
		sequence[i] = (sequence[i] * FREQ) / (intervalle * 1000);
		Serial.println(sequence[i]);
	}


}
 
 
void loop() {	
	//make a photo, wait 10 seconds

PotVal=0;
  for (count = 0; count < 10; count++) { //loops 10 times
    PotVal = (PotVal + analogRead(1))/100; //adds the pot readings together
  }
  //PotVal = (PotVal / 100); // finds average of readings 
  Serial.print("Interval is ");
    Serial.print(PotVal);
    Serial.println(" seconds.");
    
	snap();
delay(PotVal*1000);
 
}


26 Responses to $17 Arduino-based nikon IR intervalometer + code

  1. This would be a GREAT use of the interrupts driven by a long delay – that way you could adjust the interval without waiting for the long delay. Keep making adjustments in the main loop while the background interrupt fires the shot as necessary.

  2. Great article, seems like a fubnd project, Would love to try this on my D90, cheap and effective!!

  3. Is that a bug/typo on line 78?

    for(i=0;iSerial.print(sequence[i]);

    Either way, feel free to delete this comment. Thanks for the write-up, I’m going to try this on my D70!

  4. Dave – Yes!

    It should be as follows:
    for(i=0;i”);
    sequence[i] = (sequence[i] * FREQ) / (intervalle * 1000);
    Serial.println(sequence[i]);
    }

    Thanks for the heads up!

  5. hmmmm… that came out weird. I think the comments field strips out characters. I’ll correct it in the post. Thank you for noticing!

  6. Excuse me the dumb question, but I could not understand it from the page description… What you do exactly in your project? There is the ir for shooting… and the pot is for decidinghow often shooting? Am I right or I miss something? Thanks a lot

  7. Federico – The ir led sends a signal to the camera that tells it to fire. The pot is a dial that controls how long to wait in between shots. The end result is that you can make a movie out of all of the stills!

  8. Have you ever tested how fast can be the ir signal? I mean, I think that with the right setup my D40 can take about 5 photo for sec. Can I do this with the ir command? Thanks again, I think that your is a nice project. The idea of the potentiometer is cool :) Fede

  9. hmm… I’m not sure I understand your question. The ir command can be sent several hundred times a second. The camera is limited by it’s design to a few shots a second. Even if I have the intervalometer set as fast as it can go, my d40 shoots 3 frames per second until the card gets bogged down, and then it slows down.

    To get back to your question: yes I think you can shoot just as fast with the ir as by holding down the button, but not any faster.

  10. What about replacing the pot with a rotary encoder. you could count the pulses to increase or decrease time with 2 buttons. It would be like setting the clock on a car radio.

    Just to clarify 2 buttons and a rotary encoder.
    one button for increase time, one for decrease time

    hold button spin encoder to increase or decrease time depending on what button is held. could then use the LCD to display the current/changing delay.

    just my crazy idea.

  11. mage2: that’s not a crazy idea. It is more complicated (code and hardware-wise) than just using a pot though. There are definitely many ways to skin this cat…

  12. Ok I am fine with your reply, I know everything I wanted to know :) Now I have just to build one!

  13. Hello,
    My Arduino program tells that there is something wrong with the code:
    void snap(){
    int i;
    digitalWrite(PIN_STATUS, 1);
    for(i=0;idigitalWrite(PIN_STATUS, 0);
    }
    Is it the “idigitalWrite” that’s wrong? Any help?

  14. Hey MakeA!

    For whatever reason wordpress is mangling the code. I will try to upload a zipped version of it this weekend. If you are in a rush, compare it to the source link that I put in the top of the code. It is 98% the same as the one I referenced.

  15. Hello.
    I’m in no rush, and not much of a coder either so I’ll wait for your code. :)
    Thanks in advance.

  16. hI Tiny,
    does the frequency for the ir matter? or is it just a ir burst that sets the camera off.

    would this work on a canon do you think?
    thanks in advance bc

  17. Hey BC!

    Yes- the frequency and the signal timing are very important. It’s really easy to mess it up and not have the camera fire. I do know that there are many similar projects out there for canon cameras. The frequency and signal will change for this to work on a canon, but it is very doable. Let me know if you get it working!

  18. Wow, this is fantastic– thanks, farkinga!! Good thing I have some old Sony remotes– my TiVo and Denon remotes produce only errors– I got codes for every button! Nice clean code– I am munging it with excellent results…:) BTW are you sure you’re using 10K resistors for the LEDs and not 100s? With 10K, you wouldn’t get much (if any) light.

  19. I m also currently working on something like this. For yours, some suggestions would be to add a pb to just remote fire the camera, with or without a time delay. I have also obtained an inexpensive motion detector to trigger the remote.

  20. hi there ! Very nice project and ideas. I started a Intervalometer Gadget too. I am using an LCD (Now a 20×4 Backlighted but on the final gadget i will use a green 16×2 w/backlight). :)
    When finished and polished i will post the source code/scheme. :)
    I am polishing the UI and code. That’s is the hardest part for me, the wiring and riging of the electronic parts was easy. UI is painful ! lol. It’s all about to do ANY dumb people to use my gadget, so it has to be very clear using few letters (LCD is tiny).
    I am usint a POT as general encoder for all menu settings. The same pot adjust all the settings. This is nice but a bit hard to implement on the Code (for me). I am a 3D Animator, not a Coder. lol

    Here’s a pic of my prototype :
    http://www.flickr.com/photos/msouza/4325255232/

  21. Hi, I’m not too familiar with this type of equipment. I was looking for the ir led, potentiometer, and resistor and am finding that there are all kinds for these parts. What brand (part#) did you buy for those parts?

    Thanks for the article.

  22. Great work!

    unfortunately I have a Canon, I’m one of the other side of the river…

    but a friend of mine has a Nikon, and I want to make a gift to him. Your code looks pretty good, but I experience some little troubles in debugging probably for browser/wordpress issue. The link for the zipped code seems not to work…

    Thank you a lot!

  23. Hi this are my questions:
    Can you post a simple schematic of this work if possible?
    What resistor do you have use? and where? and, if you dont have schematic, can you give me a simple explanation of where i have to link this components? Ty

  24. YitIRp
    (pronounced Wyatt Earp)

    By N6VMO

    Our big off-road riding season kicks off at Thanksgiving. We gather with family and friends as well as several thousand other off-road enthusiasts in the western Mojave.

    This has been a project on my list for some time. I have wanted to create a time-lapse movie of the entire weekend event. This requires the camera, a Nikon D40 DSLR, to snap photos every 6 minutes or so, over the course of 5+ days. It also means the camera needs to be hidden on a remote hilltop to encompass a large area.

    I have envisioned using my laptop and DIYPhotoBits, http://www.diyphotobits.com, but this requires the laptop to be connected to the camera and enough power to run both for 5+ days. Not to mention leaving my expensive Nikon and laptop unattended in the middle of the desert.

    Recently, I stumbled across an IR project that used an Arduino microcontroller to pulse an infrared LED to trigger a Nikon DSLR. This project simulates the Nikon ML-L3 Wireless remote control, but without human intervention.
    http://blog.tinyenormous.com/2009/09/30/17-arduino-nikon-ir-intervalometer-code

    Not being familiar with the Arduino, but knowledgeable using PIC microcontrollers, I decided to adapt it to a PIC16F648A, with an enhancement.

    The Arduino project uses a potentiometer to set the time interval between shots. My PIC version uses 5 SPST (single pole/single throw) switches to set the time interval using a binary coded decimal scheme.
    Switches 1 through 4 allow the photographer to select any number between 1 and 15, while switch 5 selects either seconds or minutes. The minimal interval is 1 second and the maximum interval is 15 minutes.

    As an example, turning on switches 1 and 3 sets the interval to 5 seconds. The same switch settings and turning on switch 5, sets the interval to 5 minutes. This modification to the Arduino project simplifies and provides a faster, more accurate means of setting the interval.

    The entire project can be downloaded from:
    http://www.n6vmo.com/YitIRp/YitIRp.zip

    The .zip file includes the PIC software files, schematic, PCB, and list of materials.

    N6VMO

Leave a Reply

Your email address will not be published. Required fields are marked *


four × = 4

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>