User Tools

Site Tools


drexel_star_ir_camera

IR Camera Trigger Tutorial

A Remote Trigger for Your SLR Camera

Keywords: camera, transmitter, receiver, trigger, science, Arduino Tutorial by Kenneth Chaney and Leonard Chan IMG_0729

The photo depicts a wireless remote trigger which allows you to take pictures with Canon SLR (Single Lens Reflex) cameras from a distance. The trigger allows photographers to take pictures from safe distances away from any dangerous activities. This project features a simple, small unit capable for aerial, wildlife, and physically dangerous photography. This tutorial shows you how to construct this unit and takes approximately 4-6 hours to complete. 

How It Works

When the first switch is closed on the transmitter, pin 7 on the Arduino will be brought to low, which will transmit data through the IR LED with a 38 kHz carrier. The reason for the 38 kHz is so that surrounding noise is filtered out. The receiver will then receive and feed the data to the other Arduino which will send a high pulse through pin 7, setting the focus of the camera. Closing the second switch causes the same data to be sent to the receiver, sending a pulse through pin 8 instead, allowing the shutter to fire. Basically, closing the first switch sets the aperture and focus, and closing the second switch causes the camera to fire. You are essentially completing a circuit.

Motivation and Audience

This tutorial's motivation is to provide detailed instructions on how to design a remote trigger used for activating cameras from a distance. Readers of this tutorial assumes the reader has the following background and interests:
  • Know how to analyze and construct circuits
  • Also know how to program an Arduino
  • Also know how to solder and strip wires
  • Interest in photgraphy
  • Also interest in electronics and coding
The rest of the tutorial is presented as follows:

Parts List and Sources

US-based vendors to obtain material to complete this tutorial include:
  • DigiKey - Breadboards, Arduinos, IC's, LED's, etc.
To complete this tutorial, you'll need the following items:  Tools: soldering iron and solder; wire and wire trimmers; Arduino Shield Software: Arduino
TABLE 1: Parts needed to build transmitter
PART VENDOR UNIT PRICE ($) QTY
47 W DigiKey 0.09 1
100 W DigiKey 0.09 2
5k W DigiKey 0.09 1
10k DigiKey 0.09 2
Arduino UNO DigiKey 27.83 1
2N2222 NPN Transistor DigiKey 0.45 3
IR LED DigiKey 0.55 1
Switch DigiKey 0.68 2
Perforated Prototype Board DigiKey 5.35 1
TOTAL $36.98
TABLE 2: Parts needed to build receiver
PART DESCRIPTION VENDOR UNIT PRICE ($) QTY
100 W DigiKey 0.09 2
2N2222 NPN Transistor DigiKey 0.45 2
IR Receiver DigiKey 0.91 1
Arduino UNO DigiKey 27.83 1
Perforated Prototype Board DigiKey 5.35 1
TOTAL $35.17

Construction

This section gives step-by-step instructions along with photos to help guide you. Schematics to construct the transmitter and receiver are respectively shown here ir_serial_transmitterir_serial_reciever

Step 1

First prepare each circuit on a breadboard to make sure everything works and is in order. Be sure to test the transmitter and receiver, and make sure the receiver can operate the camera.  Plan out how you will transfer each component onto the Arduino Shield so that everything will look neat and tidy.  Be sure to use wire cutters to adjust the length of each wire used.

Step 2

Once you map out where everything will go, start transferring each units' components onto the Shields and prepare some solder and the soldering iron.

Step 3

Using a stand to hold a Shield in place, start soldering the individual wires onto each Shield.  Remember that when soldering, essentially, the idea is to have the iron heat up the wire and apply the solder onto the wire, not directly onto the iron itself.

Step 4

When done soldering, trim any excess wires sticking out of the Shield.  The purpose of the Arduino Shield is so you can use this circuit anytime you want by sliding it on and off the Arduino.  Headers on the Shield allow for the pins on the Arduino itself to be transferred through the Shield.

Step 5

Upload both programs onto their respective unit.  Once the uploads are completed, you can start using your remote trigger.  Notes that since both units communicate with infrared waves that they are easily affected by natural IR waves that come from light.

Programming

This code was written on Arduino and uploaded on an Arduino UNO. The source code to the transmitter and receiver are provided below:
Transmitter Code

// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

#define SYSCLOCK 16000000  // main system clock (Hz)
#define PULSECLOCK 38000  // Hz
#define IROUT 11

#define focus 7
#define shutter 8

uint8_t timer2top(unsigned long freq) ;

void setup() {

  pinMode(focus, INPUT);
  pinMode(shutter, INPUT);

  Serial.begin(2400) ;

  cbi(TCCR2A,COM2A1) ; // connect OC2A (COM2A0 = 1)
  sbi(TCCR2A,COM2A0) ;

  cbi(TCCR2B,WGM22) ;  // CTC mode for TIMER2
  sbi(TCCR2A,WGM21) ;
  cbi(TCCR2A,WGM20) ;

  TCNT2 = 0 ;

  cbi(ASSR,AS2) ;  // use system clock for timer 2

  OCR2A = 255 ;   // set TOP to 255 for now

  cbi(TCCR2B,CS22) ;  // TIMER2 prescale = 1
  cbi(TCCR2B,CS21) ;
  sbi(TCCR2B,CS20) ;

  cbi(TCCR2B,FOC2A) ;  // clear forced output compare bits
  cbi(TCCR2B,FOC2B) ;

  pinMode(IROUT, OUTPUT) ;  // set OC2A to OUPUT  
  OCR2A = timer2top(PULSECLOCK) ; 
  sei() ;
}

// main loop
void loop() {

  if (digitalRead(focus)==HIGH)
  {
    Serial.write('f');
  }
  else if (digitalRead(shutter)==HIGH)
  {
    Serial.write('s');
  }
  else 
  {
    Serial.write('o');
  }

  delay(10) ;

}

// return TIMER2 TOP value per given desired frequency (Hz)
uint8_t timer2top(unsigned long freq) {
  return((byte)((unsigned long)SYSCLOCK/2/freq) - 1) ;
}

Receiver Code

#define focus 7
#define shutter 8

void setup()
{
  Serial.begin(2400);
  pinMode(focus, OUTPUT);
  pinMode(shutter, OUTPUT);
  digitalWrite(focus,LOW);
  digitalWrite(shutter,LOW);
}

void loop()
{
  int n,i,ch;
  n=Serial.available();

  if (n==0)
  {
     digitalWrite(focus, LOW);
     digitalWrite(shutter, LOW);
  }

  if (n>0)
  {
    i=n;
    Serial.println();
    while(i--)
    {
      ch = Serial.read();
      Serial.print((char) ch);
      if((char)ch=='f')
      {
        digitalWrite(focus, HIGH);
        digitalWrite(shutter, LOW);
      }
      else if((char)ch=='s')
      {
        digitalWrite(focus, LOW);
        digitalWrite(shutter, HIGH);
      }
    }

  }
  delay(1000);
}

Final Words

This tutorial's objective was to aid you during construction. Though Arduinos were used to operate these units, encoders could be used instead to avoid the task of programming.  The original plan called for construction using an SM5021 encoder and SM5032 decoder, but Arduinos were used instead to meet a deadline. Click this link to see the original article. Click here to email Ken Click here to email Leo Yoda

drexel_star_ir_camera.txt · Last modified: 2016/11/09 18:39 by dwallace