Build an inexpensive and customizable ML-L3-like infrared remote control

Designed for Nikon D70, it should work with every camera supported by ML-L1 and ML-L3.

 

2006/03/03 - Remote control reliability improved

I have received a new waveform recorded directly from the original Nikon ML-L3 remote control and have verified that it increases my project's dependability.

Click here to see the updated page

 

The story
Searching for an alternative to buying an expensive remote control for my Nikon D70, I found a small program for the Palm. It works well, but the Palm isn’t really comfortable for that kind of use.
At this point I decided to build a pocket circuit, using a micro-controller, to release the camera’s shutter. The choice of which processor to use was simple: I’ve been working for many years with the ST6 family, but recently, I discovered the AVR micro-controllers. Why not use one of these? It would be a great way to learn how to create a real application with these amazing chips.

 

Some theory
Using an infrared demodulator and a digital oscilloscope I captured the wave generated by the Palm. Fortunately the waveform is quite simple, so hardware and software are easy to develop. The captured data was something like reported in figure 1


Figure 1

Note: High levels show when the transmitter’s led is on, low levels when the led is off. The same waveform is repeated a second time after about 63 msec. The diagram is not in scale.


I think that the receiver of the DSLR is built with software and not with some hardware decoder, and it should work as follows:
- Wait for a start pulse (about 2,25msec)
- There must be no pulse for 27,6msec (pause)
- Receive a pulse (650usec)
- Pause (1,375msec)
- Receive a shorter pulse (575usec)
- Longer pause (3,35msec)
- Receive last pulse (650usec)

If one step fails, reception is aborted.
Before concluding this paragraph, I must say a few words regarding the transmitter. Most infrared transmissions operate by modulating the led with a relatively high frequency (in most cases 38 or 40KHz). This means that when we have to send a bit value “1” the led is turned on and off 38000 or 40000 times in one second. When we have to send a bit “0” the led remains turned off. My Palm uses a frequency of 40KHz, but I don’t know what frequency the original Nikon ML-L3 uses. In this case however, it isn’t really a problem: everything works fine!
Now that we know how the remote control works, we are ready to start the developing phase.

 

Hardware
As mentioned above, I decided to use an AVR 8-bit RISC MCU. I chose the ATTiny2313 model for various reasons: low cost, easy to find, and I have it in my toolbox. If you prefer, you should be able to use every AT90, ATMega and ATTiny simply recompiling the software. An SMD version of the chip would help reduce dimensions, but I wanted to keep the circuit simple to build, so my design uses a DIP version.
To be compact a small battery must power the circuit: a lithium battery like CR2032 could be a good choice. A battery holder like the one I used is easily found on most old PC motherboards.
We will see in the next paragraph that we need a precise clock to generate a good 40KHz square wave, so a quartz crystal is needed as oscillator. I have a lot of 8MHz, so I selected this as clock frequency. Someone could think that this “high” frequency causes too much battery consumption, but we must remember that transmission is very short and the power absorbed by the led is much higher compared to the MCU. By the way, it’s possible to reduce the frequency carefully reading the next paragraph.
Hardware details outlined; it’s time to write down the program.

 

Software
First of all, we need a precise time-base reference to make the led blink at 40KHz. This implies that the led is powered on for 12.5usec and then turned off for the same time. To do this, we need to know exactly the processor’s clock frequency and how many clock cycles are needed to reach the 12.5usec. The clock frequency is 8MHz, so every clock cycle requires 125 nanoseconds or 0,125usec. Obviously, after 100 clock cycles the requested time has been reached. Considering that the “CALL” instruction, “RET”, “SBI” (led on) and “CBI” (led off) spend cycles, we can write the following routine:

delay125:
; This is a 12.5 uS delay (100 cycles @ 8MHz)
;
; sbi/cbi = 2 cycles
; rcall = 3 cycles
;
ldi DelayReg,30 ; 1 cycle
delay125_0:
dec DelayReg    ; 1 cycle
brne delay125_0 ; 2 cycle if jump to label, 1 if not
ret             ; 4 cycles

Now, with this routine, it’s as if we had a clock with a period of 12.5 microseconds: why not use this for the global waveform generation?
I can explain the idea with an example: the start pulse needs the led blinking for 2.25msec or, in another way, 180 * 12.5usec. If we count 90 times “led on for 12.5usec, led off for 12.5usec” the start pulse has been generated!
Here’s the code:

;(Start pulse)
ldi R17,90      ; (12.5 uS * 2 ) * 90 = 2.25 mS
startpulse:
sbi PORTD,0     ; Led on
rcall delay125  ; Wait 12.5 uS
cbi PORTD,0     ; Led off
rcall delay125  ; wait 12.5 uS
dec R17
brne startpulse

After writing a few more loops like the one above, we’re done. Remember, the processor must send a complete “train” of pulses twice, and then stop. For battery saving, use the “SLEEP” command.
For the complete, operational, source code, take a look at the download section.

 

Final considerations
In the title I wrote “inexpensive and customizable”. Why? Well, “inexpensive” is easy to explain: with only10 USD (about 10 Euro), maybe even less, you can build a perfectly functional remote control for your Nikon.
For “customizable” imagine the following situations:
- You’re a few meters behind your camera, maybe hidden by a tree or a wall.
- Your camera is mounted on a tripod and you want to take a shot without touching the equipment. It’s uncomfortable having to stretch your arm to the front of the DSLR.
- You want to stay 50-100 meters away from the apparatus and the IR led doesn’t have such a long range (make sure no one can steal your jewel).
- You want to take a picture every 1, 2, 5 or 10 minutes automatically.

You have the hardware (with schematics), you have the software (with source code), you have a brain (with some neurons): use them and you will find a solution for all your needs!

If you have no ideas, here are some suggestions:
- Connect a long, flexible, electric cable from the pcb to the pushbutton switch and position the remote control somewhere in the front of the camera.
- Connect a very supple, not too long, electric cable from the pcb to the IR led. Fasten the led (maybe using the camera’s strap) to the front and take the box with the pushbutton in your hand.
- Use a radio remote control to activate the IR remote control. An NPN transistor in open-collector mode can be used to simulate the switch press.
- Build a programmable timer with relay or open-collector output. Remember that after 15 minutes of inactivity the camera deactivates the IR receiver. An even better alternative is modifying the micro’s software allowing it to send two-pulse sequences at regular intervals. The latter requires a superior-quality battery.
- You can also connect a second switch to the micro and altering the program, send a non-stop sequence. This way the camera operates in continuous mode until you release the button.

 

Special thanks:
- Gerhard Schmidt (DG4FAC) – AVR tutorial - http://www.avr-asm-tutorial.net/index.html
- Brian Hammill - Basic idea for 40KHz routine - http://www.ipass.net/~hammill
- Pitronics - SP12 AVR programming software - http://www.xs4all.nl/~sbolt/e-spider_prog.html#programmer
- Tamiko for english document revision

 

For any question, send a message to : ir-control [NO] @ [SPAM] bigmike.it
(remove [NO] and [SPAM])

 

Comments? Greetings? Please visit my guestbook: