SONY DSC © 2011 admin. All rights reserved.

Arduino Timelapse IR remote for NEX-5

I have recently beeing getting into timelapse, My major problem was that i wanted to use the Sony NEX-5 to take the shots, the issue with this camera is it only has IR as a trigger. There are a variety of items out there that achieve this task (gentles ,  tempus , PclixXT) But they all are a tad large, have no real easy way to attach to the cameras sensor. I also wanted one now and didnt want to wait a month for it to arrive in the mail. I already had an IR controller for the camera ($5 ebay special) and I ripped it apart and crudely soldered two wires to the button, So when the wires completed the circuit the remote fired.

I then went to Jaycar and Purchased a timer, a friend at work soldered it up for me as i wasn’t confident in my abilities. I also mounted the timer in a case, this time ran off 8 AA batteries.

I bent the IR led in the remote towards the back and drilled a hole for it, i then velcroed this to the front of the camera. I took this out for our first official timelapse test, we wernt sure if we could even get the shots we were after but this is what we ended up with:

From this 2 hour test, I found a major issue. The timer i was using was mechanical and they don’t like low current (or so i read) and this caused the remote not to fire every now and then (Sometimes 3 times in a row). This just wouldn’t do, so back to the drawing board.

I was sitting at home and I stumbled upon an Arduino powered Nickon D80 IR Intravoltmeter . This site was great, I had an Arduino sitting in a box doing nothing, so all i needed was an IR LED and maybe a resistor. Sure enough it was pretty much a copy and paste job. Problem now was getting the IR code for the Sony NEX camera. Luckily there is a device called the Pronto that captures codes, and people share this freely (Phillips Pronto Code), and sure enough i found some . Now to figure out how to convert from pronto code to something i could use with the Arduino code from before. Originally I wrote some obscure excerl formulas to work it out, but in the end i build a script to convert. So if you want to convert pronto code into an on and off timing signal with IR Arduino Code give my script a whirl: Pronto Code to pulse converter + Arduino Code Builder.

 

The circuit for this code is fairly straight forward. I however wanted a low battery warning (What would be worse then shooting for 30 minutes only to run out of batteries) I found another ancient post explaining how to detect a low battery from a 9 volt battery. Here is the circuit:

A few things i dont show in the above image, 1. I wire the resistor and cable for the LED to a mono 3.5 plug. So I can easily plug and unplug the led. 2. i Put a switch on the positive so i can easily turn it on and off. This is a shot of the kit all put together:

At this early stage the LED looked like:

Problem i found here was it was impossible to mount with such a small field of view on the LED. And after 4 or 5 nights of use a dry joint formed on the resistor, i think this was due to the movement between shots. I built a new enclosure from an old IR mouse receiver:

Again this worked but I still found it hard to ensure the LED could be seen by the camera even tho it was stuck right on top. I had a rethink and found that there is a thing called a remote blaster, these use an IR blaster these can be picked up at Jaycar for $8 and look like:

Much smaller, professionally made, with the same 3.5 jack that will work with the female jack I used on my build. And It works great.

This is the end of the version 1 build. Version 2 will have LCD and motor dolly control, also adjustable timer without needing to reprogram.

Here is the final code for the Sony NEX Timelapse system:

Download

 

/*
LUCKYLARRY.CO.UK - IR Remote control for Nikon using Arduino
Mimics the infrared signal to trigger the remote for any Nikon camera
which can use the ML-L1 and ML-L3 remotes. Can be used as an intervalometer
for time lapse photography.
The IR sequence I used is originally taken from: http://www.bigmike.it/ircontrol/
You should be able to use my pulse methods to alter to suit other cameras/ hardware.
micros() is an Arduino function that calls the time in Microseconds since your program
first ran. Arduino doesn't reliably work with microseconds so we work our timings by
taking the current reading and then adding our delay on to the end of it rather than rely
on the in built timer.
*/
int pinIRLED = 12; // assign the Infrared emitter/ diode to pin 13
int LEDgreen = 13; // use onboard led for battery status
int batteryIn = 0; // set pin to get power data from
int batLevel = 0; // variable to get details on battery power level from analog input
int lowPower = 0; //count to keep track of lowpower state

void setup() {
  pinMode(pinIRLED, OUTPUT);                            // set the pin as an output
}
// sets the pulse of the IR signal.
void pulseON(int pulseTime) {
  unsigned long endPulse = micros() + pulseTime;        // create the microseconds to pulse for
  while( micros() < endPulse) {
    digitalWrite(pinIRLED, HIGH);                       // turn IR on
    delayMicroseconds(13);                              // half the clock cycle for 38Khz (26.32×10-6s) - e.g. the 'on' part of our wave
    digitalWrite(pinIRLED, LOW);                        // turn IR off
    delayMicroseconds(13);                              // delay for the other half of the cycle to generate wave/ oscillation
  }
}
void pulseOFF(unsigned long startDelay) {
  unsigned long endDelay = micros() + startDelay;       // create the microseconds to delay for
  while(micros() < endDelay);
}
void takePicture() {
  for (int i=0; i < 2; i++) {
pulseON(2336);
pulseOFF(646);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(646);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(572);
pulseOFF(646);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(11008);
pulseON(2336);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(646);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(572);
pulseOFF(646);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(11008);
pulseON(2336);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(646);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1168);
pulseOFF(621);
pulseON(1093);
pulseOFF(696);
pulseON(572);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(572);
pulseOFF(621);
pulseON(572);
pulseOFF(1218);
pulseON(497);
pulseOFF(1292);
pulseON(422);
pulseOFF(1367);
pulseON(373);
pulseOFF(11803);
pulseON(298);
pulseOFF(2659);
pulseON(199);
pulseOFF(1590);
pulseON(174);
pulseOFF(1019);
pulseON(174);
pulseOFF(1615);
pulseON(174);
pulseOFF(1615);
pulseON(149);
pulseOFF(1044);
pulseON(149);
pulseOFF(1640);
pulseON(124);
pulseOFF(1093);
pulseON(149);
pulseOFF(1044);
pulseON(124);
pulseOFF(1665);
pulseON(124);
pulseOFF(1068);
pulseON(124);
pulseOFF(1665);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1093);
pulseON(99);
pulseOFF(1118);
pulseON(99);
pulseOFF(1093);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1690);
pulseON(75);
pulseOFF(1715);
pulseON(75);
pulseOFF(12101);
pulseON(149);
pulseOFF(2833);
pulseON(75);
pulseOFF(1715);
pulseON(75);
pulseOFF(1118);
pulseON(75);
pulseOFF(1715);
pulseON(75);
pulseOFF(1715);
pulseON(75);
pulseOFF(1118);
pulseON(75);
pulseOFF(1715);
pulseON(75);
pulseOFF(1118);
pulseON(99);
pulseOFF(1093);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1093);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1093);
pulseON(99);
pulseOFF(1118);
pulseON(99);
pulseOFF(1093);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(1690);
pulseON(99);
pulseOFF(646);
  }                                                     // loop the signal twice.
}
void batterytestdelay(unsigned long delaytime){  // Function to check battery level and flash the led if its low battery
  long tempdelay = 0;
  while(delaytime > tempdelay){
    delay(100);
    tempdelay = tempdelay + 100;
     batLevel = analogRead(batteryIn);
    if (batLevel < 720){
      lowPower++;
    }
    if (lowPower > 100){
      lowPower = 0;
    }
    if (lowPower < 50){
      digitalWrite(LEDgreen, LOW);
    }
    else{
      digitalWrite(LEDgreen, HIGH);
    }
  }
}

void loop() {
  digitalWrite(LEDgreen, HIGH);
  takePicture();  // take the picture
  digitalWrite(LEDgreen, LOW);
  batterytestdelay(33000);                                          // delay in milliseconds which allows us to do timelapse photography - 1 second = 1000 milliseconds. This delay has been passed to the battery testing function
}

 

Did you like this? Share it:

5 Comments

  1. Marc

    Thanks a lot! It really helped me.

    • admin

      Point of interest is i invested a few hours a month or two back and i actually tightened the timings better, I can let you know when i put that code up if you want.

    • Emanuele

      Thank’s a lot.
      I’m trying to control a roomba (vacuum cleaning robot) with this Pronto Code I found on Internet:
      0000 0069 0000 0008 0071 0027 0023 0071 0023 0071 0023 0071 0071 0027 0023 0071 0023 0071 0023 030B

      I have an Arduino Board, with one IR led in series with a resistor (100OHM).

      Set Pin 13 as per your script..

      Now your script would start with an OFF Signal, and I think that is wrong. It seems that it change OFF and On sequence with right timing. But also if I invert this sequence the script doens’t works.. Where I get wrong?

  2. I would like that updated code, if you don’t mind. Also, you can make the arduino sleep between shots, that might save a ton of battery life if you are running into that wall.

  3. Mayank

    Great Job, had been hunting for the Pronto Codes or a way to run it via Arduino, this is perfect :D Any chance of controlling other stuff via IR? what other camera functions can be accessed?

3 Trackbacks

  1. By DIY Timelapse Dolly rig powered by Arduino and OpenMoco Part 1. 19 Sep ’11 at 10:10 pm

  2. By Opendolly, primi passi | massMakers 26 Nov ’12 at 6:17 am

  3. By IR emitter for my Camera 6 Feb ’13 at 7:46 pm

Leave a Reply

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

*


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>