Slaveflash-trigger for Digital Cameras With Attiny24




Introduction: Slaveflash-trigger for Digital Cameras With Attiny24

About: I like to explore new things and try out stuff. At the moment I'm in to electronics, BLE and LEDs.

This instructable explains how to built a slave flash with pre-flash rejection.

When flashing with digital compact cameras, the camera usually uses several small flashes before making the actual picture. This is o.k. if the built-in flash is the only flash you have, but if you want to use an external second flash you have a problem: The second flash, also called slave-flash, fires if the master-flash fires. But most of the flashes are to slow to provide three or more flashes in such a short period of time as the digital camera fires them. The digital cameras use not all the energy on the measuring flashes and expensive modern flashes do it the same, but hey we don't need this over-priced stuff, we built them ourself.

With this device you can chose how many pre-flashes you want to ignore until the slave-flash should fire. So it is suitable for nearly all cameras and all flashes.

With a slave flash you can make really crazy pictures.

But let's start!

Step 1: What You Need

Well this instructable is something between electronics, photography and software. In just the right portions, oh I like it...

You need experience with the Atmel AVR microcontrollers and a possibility to flash them with a programmer. Getting startet with AVRs is really easy because there are a lot of good tutorials on the web. The Arduinios are just AVRs with a special bootloader to make it even more easy to programm them, but the extra bootloader costs some cents extra. So I decided to go for the real thing.

Then you need an old, but still working flash and some small electronic parts like resistors and so on. A soldering iron would be helpful too.

The complete material list is:
Part Value

R1 100k   near the photo-diode
R2 10k    pull reset pin high
R4 300    to the opto-coupler
R5 470    to the LED
R6 1k      to the reset-button (I didn't use this)
R7 1k      to the hex-switch (I didn't use this)

C1 2.2n   between the photodiode and the pin PB2
C2 100n  Voltage regulator
C3 100n  Voltage regulator
C4 10u    Voltage regulator
C5 10u    Voltage regulator

IC1 ATTINY24/44/84-PU The microcontroller
IC2 7805TV the voltage regulator

LED1 green the green LED
OK1 MOC3021M an opto-coupler
PHOTODIODE BP104 the sensor

S1 4bit rotary selector

an female flash-shoe with a tripod connector, no special function needed, take the cheapest you can get.

Step 2: Start With the Flash-shoe

There are two possibilities to interface a flash:
The first: Open the flash and directly solder small wires to the parts that release the flash. Advantage: Very elegant way to interface the flash. Disadvantage: Most flashes are hard to open and contain really harmful things inside them (a loaded capacitor for instance).

The second: Use an adapter to interface the flash. Advantage: The flash itself is not altered, you don't lose warranty and you can still use it with you camera. And you can use various flashes with the same slaveflash-trigger, but not at the same time of course. ;-)
Disadvantage: It's a bit of a hustle to get this working.

How is the flash triggered?
If you look at the flash, there are two small connectors in the flash shoe. One on the side and one in the middle.
So we have to get two cables connected there. Look at the picture to see how I did it.

Now you can already test your adapter. If you turn on the flash and mount the flash shoe you should be able to fire the flash when you connect the two wires. If this is not working you have made something wrong.

Step 3: Start With the Circuit

Before I start to solder such a circuit I usually test it on a breadboard.

If you provide a voltage of 5V and below from a battery then you can skip the part with the 7805-voltage regulator and directly source the microcontroller. The whole circuit uses 2mA in standby, so a small coin cell would be empty very fast, that's why I chose to power the flash and the controller from the same source, making it less complex.

I cant't help with the circuit itself, because everybody has other parts in different sizes and you have to figure out which pins you need to connect by yourself.

 A funny thing actually happened when I tested the device. When working with the breadboard I usually did tests in the evening under rather dim lightning conditions. But I soldered (and tested) the board under a bright lamp at my workbench. So it turned out, that it didn't recognize any flash I made, even when I flash it directly in front of the photodiode. It took me a while to find out, that the photo-diode was much so sensitive and I had to cover up some of it. So I used some sticky tape and painted it black, and voilá it worked!

Step 4: Program the Micro-controller

Now that the controller and the board is ready it is time to program the micro-controller and add it to the board. As you can see there is no way to program the microcontroller inside this circuit. But because I tested the software on the solderless breadboard before I don't need this, and it makes the device much easier.
You can either use the provided code or write your own, it's not that hard.

How does it work?
The main part is the photo diode which is used as a sensor here. When there is no light or only a little bit, the diode will block. But when a flash-light hits the diode it will become conductive for a short period of time. Together with the 100k resistor it forms something called an voltage divider.
So while the diode blocks, its resistance is much higher than 100k and the pin PB2 will have nearly ground potential.
When a flash is detected its resistance becomes much lower than 100k for a short period of time and pin PB2 will recognize a high signal. This triggers an input-interrupt in the software.
The capacitor is necessary to decouple the pin from the diode. Without the capacitor the small current delivered by the diode during the flash would not be sufficient to trigger the interrupt. Maybe someone has a better explanation for this effect. Anyway it works.

When a flash is recognized by the micro-controller, it is counted and if the number of flashes counted equals to the number of flashes needed, then the slave-flash fires.

The number of flashes needed is read in after start-up from the 4bit rotary switch, with it we can set up to 16 preflashes.

The opto coupler is needed because flashes often have more than tens of volts at their connectors. and this would surely kill our small micro-controller. It is in principle another photo diode together with an LED in a closed housing. If you light up the internal LED, the diode gets conductive and shortens the two outputs which then fires the slave-flash.

As an extra bonus a timer/counter was enabled to reset the whole device if more than one second without a flash is recognized. This has the following reason: If you take pictures at a party and other people take pictures and flash, your flashcounter gets preloaded and doesn't flash at the right time. After some flash just wait for 1s and the flashcounter is reset.

Step 5: Putting It All Together

Now it's time to put it all together and test it.

I added two videos showing you how it works.
The first one shows the start up procedure. After hitting the reset button, the status-led indicates the number of flashes needed. This is three in this case. With the third flash, the slave-flash also fires.

In the second video you see what happens when you wait to long between the flashes. Then the current number of counted flashes is reset and the counting starts a new.

Have fun and upload some pictures!

Step 6: Examples

The pictures of this step show some examples what can be done with a slave-flash.

Of course you can do much more, but this is to your own creativity.

When using a slave-flash, most of the time you have to manually adjust the aperture and exposure time. I hope you can do this with your camera. Or you adjust the flash if this is possible. But keep in mind that when flashing, the exposure time is not relevant any more. The flash is so short, that every flash, the complete light reaches the film or sensor. You have to work with aperture and for digitals with the sensitivity (i.e. ISO 100 - ISO 800).
Maybe I write another instructable how to use a flash the right way...

But for now, go out an have fun! And don't forget to vote for me!!!

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Science Fair Challenge

      Science Fair Challenge
    • Electronics Contest

      Electronics Contest
    • Stick It Challenge

      Stick It Challenge



    10 years ago on Step 4

    Interesting project.
    Just a few remarks:
    The optocoupler is not really necessary. Yes there can be a high voltage on an old flash, but instead of an optocoupler, a Thyristor would also work, so if you have that, don't buy an optocoupler.

    Using a microcontroller is quite handy, but if you have no access to a programmer, it is a big obstacle. If your camera has only 1 preflash (like in most compacts), there is a simple schedule that works with a CD4001 and just a few other compounds that can be built pretty small. (See picture)

    If you have a PIC programmer and not an Atmel tiny programmer, you may consider a PIC based schedule, such as developed by Pavel Janko (Google). The advantage of that one is that it has a 'learning mode' so there is no need to even know how many preflashes the camera has.

    Not trying to put down yr effort, not at all, I could never have come up with it, just trying to point out some more possibilities to those looking for preflash ignore


    Reply 10 years ago on Introduction

    Thanks very much for your comment. The digital counter is really some kind of yesterday and much too inflexible.

    But the idea of the learning mode is good. I'm working on a second version of it and didn't have any more of the hex-switches, so I tried to implement the learning version and it worked quite well!
    Result: Smaller board, less parts and saved 2$ for the hex-switch!

    I will soon publish the second version as an own instructable, because it really has a lot of improvements!


    Reply 10 years ago on Introduction

    looking forward to it ;-)