Transplanting project to Trinket

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

Re: Transplanting project to Trinket

Post by ranger9 »

Success, sort of!

(I apologize for my stream-of-consciousness posting technique, but it really does seem to help me organize my thinking.)

Re-reading my post above, thinking about the idea of "spill" possibly contributing to the transistor's base voltage, and noting the seemingly huge drop across the 100-ohm base resistor (2.62v going in, 0.81v going out), I decided to try bypassing the 100-ohm base resistor entirely. (I know you should always have a base resistor, but this was just for a test.)

And hey, suddenly my circuit works! It fires the 3.7v flash reliably, even when the master flash is several meters away from the photodiode.

There's still something flakey going on, because if I move the master flash even farther away, I can still turn on the Trinket output pin without getting the flash to fire. So apparently I'm still depending on the "spillage" mechanism (or whatever the heck it is.) All I've done is made it a little more sensitive.

I definitely want to have a base resistor for my final circuit, don't I?... especially considering I'll also want to use the circuit with the older 6v-trigger flash. And I would rather have the flash function controlled solely by the state of the Trinket output pin, without having the photodiode affect it. Still, it's nice to know the circuit CAN work, even if it isn't yet working really correctly.

Again, any ideas or suggestions for further direction are appreciated!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Transplanting project to Trinket

Post by adafruit_support_mike »

I just noticed something in your Fritzing diagram: you've drawn the photodiode in a forward-biased direction (+ side towards VCC, - side toward GND). You want it pointing the other way.

A photodiode basically acts like a small solar cell: when you shine light on it, it generates current.

The generated current flows backwards through the diode, which makes a little more sense if you think about an LED: sending current through an LED from the + terminal to the - terminal causes the diode to emit light, so reversing the direction of the light (absorbing rather than emitting) reverses the direction of the current (makes it flow from - to +).

To say the same thing another way, if you put a photodiode in parallel with a resistor, the voltage at the + terminal will rise when you shine light on it. For that to happen, current has to flow through the resistor from + to -. Current always has to flow in a loop though, so to close the loop the same current has to flow from - to + in the diode.
currents.jpg
currents.jpg (11.68 KiB) Viewed 308 times
The actual amount of voltage you get will be limited by the diode's logarithmic voltage-to-current ratio. Generating ten times as much current will only raise the generated voltage by about 60mV, and the usual voltage at 1mA is about 0.65v. If the parallel resistor is a 10k, shining enough light on the diode to generate 1mA of current won't produce 10v.. you'll still be stuck with the 0.65v limit and only use a small fraction of the current the diode could be pumping out.
diode-limit.jpg
diode-limit.jpg (16.34 KiB) Viewed 308 times
If you send external current through the photodiode, the generated current will push back against it. That reduces the amount of external current that makes it all the way through the diode, effectively increasing the diode's resistance.
uff-da.jpg
uff-da.jpg (9.25 KiB) Viewed 308 times
If you reverse-bias the diode, things get a little more interesting.

Almost no current flows through a reverse-biased diode, so almost no current will flow through the resistor in series with it. That means the voltage across the resistor will be close to 0v until we shine light on the photodiode. Then the generated current can flow through the resistor without being capped by the diode's 0.65v limit:
reversed.jpg
reversed.jpg (15.22 KiB) Viewed 308 times
The external voltage provides headroom so the resistor can use the photodiode's generated current more effectively. You get a better and more predictable voltage swing at the output, and the circuit responds faster due to the effects of reverse-bias on the diode's internal capacitance, which I won't explain unless you *really* want to know. ;-)

User avatar
Renate
 
Posts: 291
Joined: Tue Nov 13, 2012 3:21 pm

Re: Transplanting project to Trinket

Post by Renate »

A couple of suggestions, not necessarily a solution to your problem.

First, use an optoisolator as your output.
It never hurts to put in some isolation between units.
Also, if you plug in an old-fashion high voltage flash you will only vaporize a (socketed) $0.50 optoisolator.

Your current setup with 100 ohms base resistor is hitting that transistor pretty hard.
I really doubt that it needs 20 mA base current.
As a matter of fact, collector/emitter leakage could be what is killing you.

You got the voltage of the flash units by measuring with a DVM?
Put the meter on the current scale and measure what the current is.
(Of course the circuit could have some caps in it and the initial current could be more than the steady state.)

User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

Re: Transplanting project to Trinket

Post by ranger9 »

Hello, I'm back! Thanks for all the great ideas and suggestions. I've thought about them, tinkered with component values, incorporated some simplifications and changes, and am happy to say I now have a working circuit! I still need some help, though, to get it to be more dependable.

Background: I'm building a trigger to use in flash photography -- one that will let me use wireless TTL flash and big AC-powered studio flash units together. Normally this is a problem because wireless TTL emits a stream of control flashes (up to 12 in the case of the Olympus RC system) and all those control flashes confuse the simple optical slaves built into studio flash units. I'm using a Trinket to build a slave trigger that will learn and then ignore any number of control flashes. (I'm not the first person to think of this -- there's a great instructable on how to build one using a PIC -- but I wanted to use a Trinket to make it easy to build and keep the parts count down.)

Here's a schematic I drew in Fritzing. I couldn't find a photodiode, so just used a regular diode, so the arrows are wrong:
schematic.jpg
schematic.jpg (65.4 KiB) Viewed 293 times
Backing up to a previous comment: Mike, I deliberately used my photodiode in the "reverse biased" configuration -- I read several other projects for flash triggers and that's what everybody seems to use -- presumably for fast response. Also, the trigger part of my circuit (which uses a 2N2222 transistor) is inspired by the design of the classic Wein "peanut" slave, which has almost no parts in it but works reliably with a wide range of flashes. The peanut triggers the flash via the transistor and doesn't use an optocoupler or other isolation component.

How it works (I think): Trinket pin 2, which is the interrupt pin, is connected through the 39k resistor (yeah, no 39K in Fritzing either, so ignore the label) to the Trinket's 3v output pin. I tried several resistor values, and 39K gave the best sensitivity. Pin 2 also is connected to ground through the reverse-biased photodiode. When the photodiode senses a light pulse, it pulls pin 2 toward ground, and the interrupt registers a "falling" pulse. My sketch counts these pulses until it has ignored all the pre-flashes, then switches pin 0 high.

Pin 0 is connected to the base of the transistor through a 2.2K resistor (I got this value from an online calculator.) The + side of the external flash unit's trigger circuit is connected to the transistor's collector. Its emitter is connected to ground, as is the - side of the flash unit's trigger circuit. So, when the transistor switches on, the external flash unit fires.

I wanted to get started using this for actual photography, so built one on a small-mint-tin size perma-proto, which I chose because it's about the same size as a 3-AAA battery case, making a tidy package:
P1030483.jpg
P1030483.jpg (783.59 KiB) Viewed 293 times
Now here's the part where I'm still struggling:

-- I have two kinds of AC flash units with which I want to use this. One is an older unit with analog power controls and a trigger circuit with a no-load voltage of about 6 volts. My circuit works great with this one: it's sensitive, it's reliable, and so far no Magic Smoke has gotten out.

-- My other flash unit is a modern one with digital power control and a lower-voltage trigger circuit: about 4.7 volts with no load. My circuit's performance with this one is much more sporadic: sometimes it works very well, other times it won't fire the flash unit. It seems very sensitive to how much light from the master flash hits the photodiode: there's a very narrow window within which it works, but give it too much OR too little and it stops working.

It's important to note that the SENSING part of the circuit works fine with either flash. My sketch is set up to light the Trinket's red LED when it sets pin O (the transistor pin) to HIGH. The flash unit SHOULD fire whenever pin 0 goes high -- but sometimes it does and sometimes it doesn't. I can see the red LED come on, but the flash doesn't fire.

Anybody got any insights as to how to get the circuit to switch more reliably when using the more modern, lower-trigger-voltage flash unit? And/or why it doesn't always fire even though the pin driving the transistor is set HIGH? Thanks!!!

User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

Re: Transplanting project to Trinket

Post by ranger9 »

Fixed it! I looked at a newer version of a Wein "peanut" slave (the inspiration for the transistor part of my circuit) and saw that it has a capacitor on the collector side. The one in the peanut was 0.47 microfarad, which I couldn't find at Radio Shack -- the closest I could find was 0.22 microfarad, so I tried that and it works.

Now that I've added the capacitor, my circuit reliably fires either the older analog-control, higher-trigger-voltage flash unit, or the newer digital-control, lower-trigger-voltage flash unit. I wish I understood what the capacitor actually does to make that happen, but I'm happy to have a circuit that works!

I did have to compromise on the value of the transistor's base resistor. My original 2.2k resistor worked well with the old analog-control flash, but only sporadically with the newer digital-control flash. (Oddly, it would work when the master flash was far away from the photodiode, but would stop working when I got closer.) I tried a lot of values and found that a very high value, 470k, worked best with the digital-control flash. I spent most of the afternoon doing trial-and-error substitution, hoping to find a compromise value that would work well with both... but never did, so finally I resorted to including BOTH resistors and a slide switch to select one or the other. Probably somebody who knows more about electronics than I do could calculate an optimum value, but this was the best I could do. I expect I'll be building some of these triggers for friends, and when I do I'll probably ask them what type of flash unit they have and just include one resistor or the other.

Anyway, in case anybody has been following along, here's an update of my janky Fritzing schematic:
Screen Shot 2014-08-02 at 9.48.17 PM.png
Screen Shot 2014-08-02 at 9.48.17 PM.png (42.54 KiB) Viewed 275 times
And here's a picture of my no-longer-so-tidy protoboard:
P1030490.JPG
P1030490.JPG (392.81 KiB) Viewed 275 times
Next step is to hammer on it for a while to make sure the Magic Smoke stays inside, and if it does I'll post up some kind of demo showing why it's useful.

This has been a lot of thrashing so far, but to me it's worth it because as far as I know, you CAN'T just go out and buy a commercially-made photo slave unit that does what this one does. There are some that use a rather flakey variable-delay system, but nothing that automatically learns and then discretely counts the preflash sequence. But by using the Trinket I was able to build my own for about $20 in parts cost. Thanks, Adafruit!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Transplanting project to Trinket

Post by adafruit_support_mike »

ranger9 wrote:Fixed it! I looked at a newer version of a Wein "peanut" slave (the inspiration for the transistor part of my circuit) and saw that it has a capacitor on the collector side.
Hunh.. that's something I wouldn't have thought to suggest.
ranger9 wrote:I wish I understood what the capacitor actually does to make that happen, but I'm happy to have a circuit that works!
The capacitor will slow the signal at the collector down a little, so it's possible that you were getting some noise on the connection between the flash and the controller. That's just a guess though.. this is the point where you have to haul out the oscilloscope and see what the signals are actually doing.
ranger9 wrote:I did have to compromise on the value of the transistor's base resistor. My original 2.2k resistor worked well with the old analog-control flash, but only sporadically with the newer digital-control flash. (Oddly, it would work when the master flash was far away from the photodiode, but would stop working when I got closer.) I tried a lot of values and found that a very high value, 470k, worked best with the digital-control flash.
Again, that runs contrary to what I'd expect, but electronics is an applied science.. we test the circuit to see what happens, *then* try to make up a story that fits the facts.
ranger9 wrote:This has been a lot of thrashing so far, but to me it's worth it because as far as I know, you CAN'T just go out and buy a commercially-made photo slave unit that does what this one does. There are some that use a rather flakey variable-delay system, but nothing that automatically learns and then discretely counts the preflash sequence. But by using the Trinket I was able to build my own for about $20 in parts cost. Thanks, Adafruit!
We supplied the parts and some suggestions. You did the work. You have an awesome device that is very much yours. ;-)

User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

Re: Transplanting project to Trinket

Post by ranger9 »

adafruit_support_mike wrote:The capacitor will slow the signal at the collector down a little, so it's possible that you were getting some noise on the connection between the flash and the controller. That's just a guess though.. this is the point where you have to haul out the oscilloscope and see what the signals are actually doing.
I'll bet that's right. The flash unit that was causing me trouble is an inexpensive unit from a "no-name" Chinese OEM, and it wouldn't surprise me if it had a noisy trigger circuit. I don't have an oscilloscope (and wouldn't know what to do with one if I did!) so this guess will have to do.

Maybe eventually somebody who has more experience with flash triggering will notice my circuit and suggest some improvements and simplifications. I'd love to be able to get the parts count down in case any other photographers want to build one of these -- needing three resistors of different values is kind of a PIA when you have to order them in onesies!

Thanks again for the help. I wouldn't have had the confidence to try this if it weren't for the fact that most of the "smarts" are built into the Trinket.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Transplanting project to Trinket

Post by adafruit_support_mike »

ranger9 wrote:needing three resistors of different values is kind of a PIA when you have to order them in onesies!
Don't even bother. 1/4-Watt carbon film 5% resistors cost, like, $4 per 200 at Mouser and Digikey.

You don't need every value under the sun, but 1k and 10k are so common I think they count as a food group. Most projects include smaller circuits that use common values, so pick up a small handful whenever you find yourself needing a value you don't have. Before long, you'll discover you just happen to have everything you need to build a new idea.
ranger9 wrote:Thanks again for the help. I wouldn't have had the confidence to try this if it weren't for the fact that most of the "smarts" are built into the Trinket.
Helping people get started is *exactly* why we're here. We get almost as much charge out of seeing the "IT WORKS!" post as the builders get from seeing a project fail to fail for the first time. ;-)

User avatar
ranger9
 
Posts: 52
Joined: Tue Nov 23, 2010 8:05 pm

Re: Transplanting project to Trinket

Post by ranger9 »

Finally got my project video done! Check it out...

http://youtu.be/jtC0vjCOqVI

Also a text-based writeup with crude schematics and a Github link for downloading the code:

http://strobehacker.tumblr.com/post/943 ... th-a-smart

The reason it took so long to get these done is that I've been too busy using my project for actual photography. Even though the design is weird, because I didn't really understand what I was doing, the way it actually works is kind of slick!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Transplanting project to Trinket

Post by adafruit_support_mike »

Nice!

That Promaster D200R is a serious piece of hardware.. I wasn't thinking quite that far up the scale as you described the project.

Once again though: you've done a great job!

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”