Step 5Communicating With the Camera
We will be using the IR emitter to send a signal to the camera. The upshot of this is it's wireless and there is NO WAY you can damage your camera (unlike connecting things into the camera's ports). If you manage to damage your camera by pointing an IR emitter at it, then I sure as hell hope you don't take your camera outside!
Software
There are two states that we need to emulate, and this is true for all cameras (indeed more or less all IR communication). Communications are sent as ones and zeroes, highs and lows.
First is the on state, when we send a logical one, we must turn the emitter on and off rapidly. We modulate the signal. Different manufacturers have different requirements for this. Nikon is 38.4kHz, Canon is somewhat less. 38k is around what most cameras use. To get this modulation we work out the period (1/f) to know that for, say, Nikon we need an on/off cycle every 26 microseconds. The modulation is symmetrical so on takes 13uS and off takes 13uS.
The Nikon sequence is (kudos to BigMike.it):
On for 2000uS
Off for 27830uS
On for 390uS
Off for 1580uS
On for 410uS
Off for 3580uS
On for 400uS
The sequence is pulsed once, there is a 63ms delay, then it is pulsed again and the shot is taken. Notice that most of those numbers are divisible by 13.
For Canon it is (with 32kHz modulation - thanks to http://www.doc-diy.net/photo/rc-1_hacked/index.php):
16 cycles (30uS each)
Pause for 7.3ms
16 cycles (30uS each)
Much simpler.
Using an accurate delay library in the code, as most of the Nikon sequences are multiples of 13, we can just use for loops to go through them to get the relevant amount of on time (off time is just a normal delay). There are some guides that suggest you use assembly to get the timing precise, but as the doc-diy link shows, the timing can be pretty far off and still produce a valid trigger signal.
The delay library i use bases its delays from clock cycles (knowing the clock frequency, and the number of clock cycles it takes to execute a given function) so it's very precise, but limited to your crystal accuracy.
Other Manufacturers
If you have a different camera, simply modify the shoot(); function in the final C code. It should be fairly easy if you know the modulation and the pulse sequence.
Olympus: http://olyflyer.blogspot.com/2007/07/how-to-make-your-own-rm-1-compatible.html
Pentax: http://sourceforge.net/projects/prcf/ look at the source code for the sequence
Hardware
As we're going to be using a high current emitter, we can't simply draw that current through the microprocessor (see the datasheet for absolute maximum ratings). What we're going to do instead is draw it straight from the battery with an electronic switch, the MOSFET.
Unlike a transistor which involves fiddly calculations to get collector and emitter currents, gain and so on, MOSFETs are surprisingly easy to use.
The 2N7000 i recommend you buy is a basic low power 'FET. There are many variety of 'FET that can be used to switch many Amps using microcontrollers that would just frazzle if they tried to draw that kind of current. There are three parts to the 'FET, the Source, the Gate and the Drain.
The source lead is connected to ground and the gate is connected to the microcontroller pin (i just connect them straight up, but you could always put a resistor in just in case - check the threshold voltage). The components you want to turn on are connected to the power rail and to the drain lead. When the threshold voltage is reached on the gate - i.e. when the micro turns on the pin - the 'FET starts conducting and acts like a wire to complete the circuit between the power rail and ground. For the 2N7000 the threshold is a maximum of 3V, minimum of 0.8V.
We also note that the drain-source resistance (the 'FET acts like a resistor bridging the components to ground) is very small - in the order of 5R max. Whilst this is very small, it could mean a noticeable drop in current across the emitter - you can compensate by lowering the value of the resistor that's in series with the emitter. This resistor, using the very useful LED Calculator () with 3V in, a forward voltage (check the emmiter's datasheet) of 1.7V and a current of 80mA to be 18R. You could get away with a 12R, but i would stick with 18R to be on the safe side. Image 1 shows how the circuit is wired up
V+ in this instance is our 3V rail. As the gate is seeing 5V, the LED would currently be turned on.
If you want to look into how MOSFETs actually work and more detailed technical information:
http://www.irf.com/technical-info/appnotes/mosfet.pdf
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|




























































