XOR gate for dual TTL trigger of a scientific camera

Hi all,

I have a single camera plugged into a device, which is then mounted to a microscope. The device to which the camera is mounted has a bypass mode. In normal mode, the device triggers the camera with a TTL signal (SMA connector). In bypass mode, the device doesn’t trigger the camera, and there would be an opportunity to trigger the camera independently from the device (to perform other tasks with the camera alone). The camera has a single input trigger.

I was told it isn’t a good idea to simply connect the two triggers (one from the device, one from a data acquisition board I programmed) to the camera through a T connector. Although it wasn’t explained to me exactly why it isn’t a good idea, just that it could damage all the devices involved. I can imagine a case where by mistake, the two triggers come high at the same time, but I struggle to understand why that would be an issue. In my mind the maximum voltage would remain at 5V since its virtually the same cable through the T connector.

In any case, I remembered my electronics classes and thought perhaps we could use a XOR gate. That way, when the two triggers are high, the output to the camera remains low, and only when a single trigger is high the output to the camera trigger (input) will be high.

Has anyone done that before? Is it still a bad idea, and if so, why? Also, any recommendation regarding the choice of an appropriate XOR gate would be appreciated.

Thanks a lot and take care,

Omni

The problem occurs when one source is trying to pull the line to 5V and the other is trying to bring it to 0V. If they are well designed then they will have a maximum current that is less than their damage threshold so the stronger source should not burn out the weaker source. The final voltage on the line to the camera could also end up somewhere between 0 and 5V which would probably confuse the camera.

You mention a DAQ card. Depending on it’s capabilities the easiest thing might be to connect the device to the DAQ card, then connect the DAQ card to the camera. When you want the device to trigger the camera you’d set the DAQ card to pass the trigger pulses through to the camera. An approach like this, or using an Arduino or equivalent micro-controller, instead of an XOR provides more flexibility at a relatively moderate increase in price.

1 Like

Thank you for the answer @Hazen_Babcock. Two follow-up questions. First, do I understand correctly that a XOR would work as well from your answer (although less flexible)? Second, how would you pass the trigger with the DAQ in a timely manner? I would only have budget for a cheap DAQ and it would most-likely not support retriggerable tasks.

Thanks again for your help and take care,

Omni

Hi Omni,
@Hazen_Babcock is right that if for example the DAQ goes high and at the same time the “Device” goes low, then the “device” will have to be able to sink all the current from DAQ and this might destroy both as the DAQ might not be able to source this much current and the “device” might not be able to sink it.
A simple solution would be to either add a couple of resistors in series to reduce the current to below what they can source/sink or (since they will only be outputs) use a small signal diode (1N4148) in series, before the inputs of your 74LS86 XOR gate.
Something like this would work, I think.


Don’t forget to tie the unused inputs of the chip to ground or 5V to prevent them from floating and adding noise.

1 Like

The details would depend on the specifics of the DAQ card, but basically it would monitor the input from the device and reflect that onto an output line. If you had a National Instruments DAQ for example you might configure a counter to output a single pulse each time it detected signal change on it’s input.

This wouldn’t be an XOR but you could also consider using a pull down approach like this:

I’d think about an Arduino though because unless you have the power supply, etc. you might end up spending more on parts, etc. than a microcontroller would cost.

1 Like

Thank you @Ipanagis, could you explain the role of the diodes in your schematic?

Take care,

Omni

@lpanagis I’ve implemented your circuit, but I had to reverse the orientation of the diodes for it to work. Is it possible?

As a side remark, our electronics store at my University had all the components in stock. I didn’t imagine those components would be so standard.

Thanks for your help and take care,

Omni

Hi Omni,
This is what happens when you try to make a quick reply and run maintenance on your confocal microscope at the same time! :grin:
This schematic was supposed to be two different schematics, let me explain:

Schematic 1 below:


Shows the simplest, and cheapest solution. Basically an OR gate made of two very common (as you discovered yourself) diodes. This just makes sure that if a 5V signal comes from either of your trigger outputs, or both, the camera will be triggered. There is a 0.6V voltage drop across the diodes, but since any voltage over 2V is considered a logic High, it should work without a problem. The resistor pulls the camera input low, in case one of the devices is OFF or disconnected, making sure that noise will not trigger it.
Its big advantage is that it is very small (you could even fit it in a cable!) and requires no voltage input to drive it.
If you really want to make sure that if both the DAQ and the device go High, the camera is NOT triggered then you need schematic 2:

Again, this is using a very common logic gate, but it requires a small perfboard to put together and a stable, filtered 5V supply (a phone charger with a 10uF capacitor across it should be fine).
As I remember to mention above, you must connect the unused logic gates to ground (or 5V) to stop them from floating and creating noise.
Both circuits assume that you are triggering your camera with a logic High (5V)! Even the simple circuit will work fine with negative logic, you just need to add a logic inverter like a 74LS0 between the resistor and output.

Thanks and sorry for the mess in the last email :smiley: but it looks like you got it working!!

2 Likes

@lpanagis

Thank you for your answer. If I understand correctly, in schematics 2, I do not need diodes. But out of curiosity, why did I get it to work with the diodes inverted? Using schematics 2, is there really no risks of damaging the devices? Shall I keep the diodes just in case and would they really prevent current flowing back to the devices?

Thanks again for your precious help and take care,

Omni

Hi Omni,
Right, you do not need the diodes.
The inputs of the logic gate are in fact the gates of the input MOSFETS that make up the logic gate and they are not directly connected to each other. Even if one of your trigger sources goes high and the other low, there should be no current flowing from one to the other. Anyway, the current that flows from your sources to the gates is almost zero, since their inputs are very high impedance. In fact, they have so high impedance that the orientation of the diodes, might not even matter, as there is practically no current flow. However in real circuits, with real components many things
What I think is happening is that with the diodes oriented as in the “Frankenstein” schematic, as soon as one source goes high, the voltage on the input of the gate will also go high but when it goes low, the small charge on gate of the MOSFET cannot be dissipated and I would expect it to stay ON at all times and the output of the gate should go low as soon as the second input also goes high and stay there.
Inverting the diodes might actually allow this charge to to dissipate while the tiny leakage current of the diode still allows the gate to go High.
Not sure, but this is my best guess…

2 Likes

Thank you @lpanagis. Its been really informative, and helpful.
Have a great weekend,

Omni