You might have noticed the Slaveflash I built with an Attiny 24, the instructable can be found here: Slaveflash-trigger-for-digital-with-Attiny24


After building the first prototype I collected all my old flashes I got over the years and had four more slaveflash-triggers to built. 
I already figured out an PCB-Layout for the SOIC-version of the attiny 24. But the biggest parts in the design are actually the hex-switch and the optocoupler, so it would make no sense to substitute only the microcontroller by a smaller one. Instead I replaced the hex-switch by a learning mode in software and also replaced the power source.

By replacing the 7805 voltage controller by a button cell with 3V, the power consumption was reduced from 2mA to below 0.5mA without the LED on. 

So here it is: Let's got started!
Remove these adsRemove these ads by Signing Up

Step 2: The software

Picture of The software

Also the software has changed a bit. The function to read out the hex-switch was omitted, instead two small if-statements were added in the timer overflow interrupt routine. And this is how it works:

After startup the variable "flashesneeded" is zero, that means unset. As long as this is the case the trigger waits to learn how many flashes there will be. The trigger will detect every flash and count it. After firing your real flash once you have to wait for the timer overflow (~1s). Then the if-function will recognize that there were flashes detected while the flashesneeded-variable is still zero. In this case the number of flashes detected will be written to flashesneeded and the learning mode is done. Now the variable differs from zero and no more learning occurs. To learn another number of preflashes only hit the reset button to restart the microcontroller.

It's so easy and simple!
And it saves you a lot of money!
Adler442 years ago
Adler44 say:
Thanks Andy, you are absolutely right. My mind was playing tricks on me; I was reading slaveflash.h file as an hex file. Sorry for your time and thanks again.
Adler442 years ago
thanks for your circuit. I hope it works with my sony dsc w300 PS camera. One question though, in the list of include files is the slaveflash.h. It is not listed in my avrstudio4 or winavr installations. How do I get this for compiling and programming?
thanks a lot.
andyk75 (author)  Adler442 years ago
You have to download the file slaveflash.h from step 2!
Just where you got the c-code!
Have fun and enjoy the slaveflash!
nixon roy2 years ago
sir i copied ur c file and pasted it on avr studio and buil but its showing many error around 24 error
andyk75 (author)  nixon roy2 years ago
You also need to include the header file (*.h)!
And make the correct settings in the avr-studio für the attiny 24. Unfortunately I'm not using avr-studio any more, so I can't help you with that. You could try a avr-forum for specific questions.
diy_bloke3 years ago
Could be just me, but yr code generates many many errors in compiling. I am no expert on libraries, but is just a header file (slaveflash.h) enough for compiling?

What compiler have you used?
andyk75 (author)  diy_bloke3 years ago

this code works well with the AVR-Studio 4.something and the winAVR-gcc compiler. I had no error and not even a warning left when compiling.
I set up the workflow long ago.
AVR-studio is the editing-environment that takes care of the makefile and the includes and everything. While the winAVR provides the compiler, the libraries and the rest of what is needed. winAVR works completely in the background, I don't know if there is even a gui for it.

Hope that helped!
Thanks Andy, I already presumed it was depending on the compiler. Guess I will get AVR
diy_bloke3 years ago
Great design. The 'learning' mode is a great addition. There is another design of a 'learning' slave unit in the public domain (from Pavel Janko), based on a PIC, but this one might be easier coz the Attiny24 is probably somewhat easier to program.
No let me correct that, it is easier in my experience to build an attiny programmer than it is to build a PIC programmer.

I may build this one. I think though that the optocoupler is not really necessary as the unit is self contained. A Thyristor or even a transistor (if the sync voltage is not to0 high) will suffice.