SmaTrig - The smart 15-in-1 trigger for SLRs
The SmaTrig is a compact, AVR microcontroller based multi-function flash or camera trigger. Its 15 modes of operation make it come in handy in many situations. Besides the interval modes for time-lapse photography it is equipped with sensors for light and sound for capturing short-duration events or high-speed photography. It has a built-in sophisticated lightning trigger mode which reduces the shutter lag to the minimum by making use of the mirror lock-up function of the camera. The only connection with the camera is the external trigger plug. There is no need to modify the camera in any way. The low-power circuit is powered by an integrated coin cell.
- Manual trigger
- Bulb exposure (switch toggles state)
- Flash trigger
- 2nd flash trigger (TTL)
- Lightning trigger (uses mirror lock-up)
- Sound trigger
- Interval exposure 2.5 min
- Interval exposure 1 min
- Interval exposure 32 sec
- Interval exposure 16 sec
- Interval exposure 8 sec
- Interval exposure 4 sec
- Interval exposure 2 sec
- Interval exposure 1 sec
- Interval exposure 0.5 sec
Manual Trigger - This is the simplest mode of operation. The pushbutton works as an extension of the shutter button on the camera (only the fully pressed state is available).
BULB exposure - Pressing the pushbutton toggles the trigger between open and closed. Long time exposure is possible without holding the shutter button down continously. This function is practical for analog cameras where long exposure noise is not an issue.
Flash trigger - In this mode the camera is triggered directly by the photo-diode. This function can be used to trigger a servo flash or to build a light barrier with a laser pointer.
2nd flash trigger - In this mode the trigger responds to the 2nd flash in the sequence of two flashes such as the TTL flash sequence. The delay between the flashes must be less than 0.5 sec. This mode is primarily intended for servo flash control.
Lightning trigger - This function is similar to the flash trigger mode, but it's optimised to minimise the shutter lag, i.e. the delay between lightning detection and exposure begin. This is achieved by utilising the mirror lock-up mode of the camera. In the case of the Canon EOS 400D the pre-releasing of the mirror reduces the shutter lag from about 120 ms to 60 ms (see measurements) This is fast enough to capture lightnings easily. Check the gallery for reader's images.
The operation is explained in the following. It is assumed that in the mirror lock-up mode the mirror is released automatically by the camera after 30 sec if no triggering occurs (as for EOS).
- The camera is set to mirror lock-up mode by the user and the SmaTrig is in lightning mode.
- Pressing the push-button activates the lightning mode. The camera is triggered once and the mirror goes up. If a lightning is detected within 30 seconds, the camera is triggered for the second time and the exposure starts - a lightning was captured!
- After the exposure, for which a maximum duration of 4 seconds is assumed, the camera is triggered again and the mirror goes up as in step 2. The trigger waits again for a lightning...
- If no lightning was detected within 30 seconds and there was no trigger impulse to the camera, the mirror is released automatically. One second later the camera is triggered again and waits for a lightning as in point 2. During this second no lightning can be captured giving a probability of 1/31 to miss a lightning.
- Pushing the button again deactivates the function.
Effectively the camera is waiting for a lightning with a locked-up mirror. The SmaTrig tries to minimise the time where no capture is possible. During the second in which the camera is "reloaded" no lightning can be captured. This results in a probability of 1/31 to miss a lightning.
Sound trigger - Sound exceeding a certain pressure level triggers the camera or the flash. This mode is perfect for high-speed photography. Popping balloons or champagne bottles are the typical trigger sources. In the example below the flash was triggered with SmaTrig while the cam was in long exposure mode.
Interval trigger - As the name implies, the camera is triggered periodically with nine different time intervals. Shooting time-lapse or stop motion movies is the domain of this mode.
To make the handling more convenient and save battery life most of the modes must be activated by pressing the push-button. Activation is signaled by the SmaTrig with a single beep. Pushing the push-button a second time deactivates the function again, this is signaled by a double beep.
SmaTrig is based on the ATtiny2313V microcontroller by Atmel. This small and versatile chip is a low power device which works down to 1.8 V. It is perfectly suited for battery operated equipment. A lithium coin cell was chosen as power supply. The schematic of the trigger circuit is depicted here
The controller is connected to a 4-bit code switch, a push-button, the triggering
transistor and some sensor circuitry. The code switch allows to choose one of 16 modes of operation including
power-off. The photo-diode and the mic signals are amplified via low power op-amps.
The mic can be disabled by the microcontroller to save battery life.
The power supply of the circuit is a rather unusual solution. The microcontroller is supplied not through the VCC pin but via I/O pins! This untypical set-up uses the internal protection diodes of the I/O pins to source supply current to the chip and the rest of the circuit. The simplified schematic is shown in the sketch below.
The four output pins of the code switch are connected to I/O pins to allow detection of the
current operation mode. At the same time a connection to the battery is provided for at least
one I/O pin in all modes except for the off-position (position 0 - binary 0000) of the switch.
This way the power switch could be integrated into the code switch.
I discovered this effect accidently - it ruined my first design of the trigger. It just wasn't possible to switch it off because some I/O pins were connected to the battery and supplied the uC with 'parasitic' current. Keep in mind that a voltage drop of about 0.6 V across the protection diodes must be taken into account when supplying the chip this strange way. The minimum supply voltage of the uC rises form 1.8 V to about 2.4 V, which is still ok for a lithium cell.
The one-sided board is designed with Eagle. The minimum path width of 24 mils allows for reproduction even with the crudest home-brew methods. I used a double sided FR4 0.8 mm board and left the unused side blank to provide some screening. Drilling is not necessary - the few through-hole mounted parts are mounted like SMDs.
Low power considerations
As the circuit is supplied from a lithium coin cell (2032), the power consumption should
be as small as possible. Ideally the battery should last for the life time of the
SmaTrig or at least for many years.
The electret mic turned out to be the main power consumer with about 200uA supply current. Therefore I used a MOSFET to disable the mic if not in use. The power consumption of the controller itself depends strongly on the operation mode and the clock frequency. I used the internal 128 kHz oscillator which is a good compromise between speed and power consumption. In power-down mode, the mode used most of the operation time, the current ranges about a few uA. In active or idle mode it can rise up to 50 uA. It's possible to control the clock of the uC dynamically at runtime using the internal dividers, so each mode reduces the clock to the possible minimum. The op-amps are negligible with its 2 uA in total. Assuming a battery capacitance of 200 mAh and an average supply current of 20 uA a battery life of about 10000 hours or more than one year of continuous operation can be expected.
I tried to use standard parts. The most exotic one is the OPA2349 op-amp. This low power amp has a supply current of just 1uA per channel. Fortunately it has the standard pinout and can be replaced by any other low voltage (<2.5V) dual channel op-amp in an SO-8 package. Possible replacements are
|Type||I/Chan. [uA]||min. Supply [V]||Bandwidth [kHz]|
The SMD buzzer may be also hard to find and can be replaced by a wired part. The four bit rotary code switch is a rather common part, a version with a spindle may be hard to find. I found one manufactured by Hartmann. Be sure to use the "V" version of the ATtiny2313. Only this version allows to work down to 1.8 V. The photodiode can be replaced by any daylight type. A high sensitivity type is preferable. The microphone is an electret type. For triggering with bursting balloons any type will do. Mics with bigger diameters are usually more sensitive, look for a high dB number. This number ranges usually between -70 and -30 and describes the output voltage per one Pascal of sound pressure. Negative dBs correspond to attenuation, thus -30 dB means that the output voltage is higher than for -70 dB.
The circuit is mounted in a small pocket enclosure (50x38x13mm) with an attached hot shoe adapter. The mic and the light sensor are installed in the direction of the lens. The hot shoe mount is simply made of two plastic plates which are glued together. It has no electrical connection to the camera.
I designed a label for the rotary code switch with XFig. It can be found in the download section of the page as a PDF-file.
- Solder the SMD parts
- Solder the temporary programming wires
- Shorten the pins of the code switch depending on the enclosure hight and solder it to the board
- Shorten the pins of the pushbutton depending on the enclosure hight and solder it to the board
- Solder the battery wires
- Drill the holes in the enclosure for the code wheel spindle and the pushbutton (special care must be taken here!)
- Drill the holes in the enclosure for the buzzer, photo-diode, mic and trigger cable
- Thread the trigger cable through the hole in the enclosure
- Solder all remaining cables
- Set the code switch to '4' and program the uC
- Test the circuit
- If successful, desolder the programming wires and close the enclosure
The controller was programmed in AVR assembler. The source code and the hex file can be found in the download section of this article. To transfer the code into the uC I used a STK200 clone. The necessary wires have to be soldered directly to the programming pads on the PCB for the programming as shown in the picture below.
For programming the command line programming tool avrdude can be used.
I used the following options:
avrdude -p t2313 -c STK200 -i 500 -U flash:w:smatrig.hex
Important: The code wheel must be in position '4' to allow programming. The reason is that the code wheel and the programming wires share some uC pins. The option -i 500 must be used to slow down the programmer clock to allow communication with the uC running at just 128 kHz. The software was written to run properly with the power saving internal 128 kHz oscillator. The device is shipped with the internal 8 MHz oscillator enabled, so the fuse bits must be changed correspondingly before use. They are:
- efuse 0xff
- hfuse 0xdf
- lfuse 0xe6
Again avrdude can be used to program the fuses. The sequence is
avrdude -p t2313 -c STK200 -i 500 -u -t (set up communication with slowed-down clock)
>>write efuse 0 0xFF
>>write hfuse 0 0xDF
>>write lfuse 0 0xE6
After writing these values, the uC won't communicate with some programming tools due to the slow clock. The microcontroller is not dead! If you need to restore the original clock settings of 8 MHz with enabled divider, set lfuse back to 0x64
avrdude -p t2313 -c STK200 -i 500 -u -t
>>write lfuse 0 0x64
Now programming tools like PonyProg will work again.
smatrig.sch - Eagle schematics
smatrig.brd - Eagle board
smatrig-parts.txt - Part list
smatrig-board.pdf - Eagle board as PDF
smatrig.asm - Assembler source code
smatrig.hex - Assembler hex file
smatrig-code-wheel.pdf - Code wheel label as PDF
smatrig-code-wheel.fig - Code wheel label for xfig
smatrig.zip - All files zipped together
In this section images taken with the SmaTrig are presented. Your images are welcome!
Craig and Bob from Australia used the SmaTrig to shoot these fantastic lightning photos.
Philippe Furter from Switzerland build a copy of the SmaTrig in a slightly bigger enclosure. He used a 3.6 V lithium battery (1/2AA, 1200 mAh) instead of the 2032, so he doesn't need the 'V' version of the ATtiny2313.
PonyProg, AVR programming tool
2032 lithium battery discharge curve