Electronic – Switch triggered by flashing light

light-sensorswitches

I'd like a simple switch that triggers when a flashing light is detected. Purpose is to open gate by flashing car headlights (say 3 times).

I have looked at comparators and photoresistors and various MOSFET devices that compare ambient light to further input (point photoresistors in different directions so headlights will trigger a detectable difference even in daylight – they are very sensitive), read about optocouplers and many other devices but get lost in it all and no solution yet for how to accomplish this.

I've looked at comparators the most and they have become really sensitive and cheap, and are adjustable to trigger at determined millivolt difference. They have a lot of use in quality control devices.

Switch would have to be tolerant of different light intensities and flashing rate, basically just measuring 3 discrete voltage differences within, say, 5 seconds as a trigger and then sent to a relay, I suppose. I'd adjust the comparator until I found the sweet spot between noise and intentional flashing.

Seems like there's got to be similar devices for momentary switches; push once for one action, twice for another, etc, within a given time. Seems so familiar but I can't remember a specific device. Many small things (like my circuit tester, mp3 player) scroll through a menu with each button push (which would be like the comparator sending a signal). I could leave the first couple menu items blank, have 3-4 signal events (like button pushes) have the open gate command. But what CMOS or MOSFET can be set up for that?

I would like it to be simple and rugged for outdoor use on the gates. I've heard of strobe detectors used by emergency services to change traffic lights but only word of mouth on that. Security isn't an issue as this would be an additional switch that could be turned on/off and mostly the gates are used for animal control.

Oh, and purpose is also to not have to give everyone an RF module and to allow guests to use it without anyone else activating gates or having to get out of car (some places are quite muddy, narrow, dark, steep edges, no good place for input code box to be mounted). Motion detectors or garage door type light beam won't work because animals can trigger it.

I'm a novice but have repaired many devices, built LED drivers, battery chargers, RC vehicles, large & small appliances, heavy equipment. I was inspired it was doable when we built a game device (Family Feud style with two buttons, first to press activates lights and buzzer and locks out the other button) and the plans online were very complex with multiple transistors and CMOS chips but we did it using just two off the shelf automotive relays.

Best Answer

Olin's suggestion of micro-controlled system will definitely provide you with the most control and flexibility but if you want to mess around with a linear solution the following circuit sort of works in the simulator at least.

enter image description here

PHOTO-TRANSISTOR

Note I picked a photo-transistor for this model. Actually, for the simulation I used an opto-coupler so I could manipulate the signal levels. That may be over-sensitive for your needs and a simpler photo-diode may be sufficient. It is important you set it up so it works with the area lit in full sun, with the sensor itself in shade. If you can get it to work under those conditions it should work in the dark without issue. There are a lot of choices of devices on the market, most of them are relatively cheap, so you may want to buy a variety of types to test for the best results.

DIFFERENTIAL CHANGE SENSOR

I decided to go with a differential input using the photo-transistor. The amount of illumination present is supposed to change how much current bypasses R3 changing the voltage difference across it. The change in voltage here when the headlights flash is passed through the two high-pass capacitor C2 and C3, the output of which are biased at half-rail. The bonus of this differential method is you can mount the sensor remotely from the rest of the circuitry through appropriate twisted pair shielded cable.

LOW PASS DIFFERENTIAL AMPLIFIER

This block takes the differential edges than make it through the sensor circuit, filter out high frequency noise, and amplify the result to produce a waveform biased around half rail that will modulate when light transients occur at the sensor.

SCHMIDT EDGE DETECTOR AND INTEGRATOR

This section uses a comparator with a threshold value to detect when the waveform generated by the above is strong enough. The edges of that are extracted by C1 and R20 and fed to the integrator U5.

As each flash occurs the voltage at the output of U5 will grow in steps.

THRESHOLD DETECTOR

This comparator is set up to generate a low level output that will trigger the 555 timer when the voltage on the integrator reaches the threshold level and will maintain it low till the voltage drops back close to mid-rail.

1 to 3 MINUTE GATE OPEN TIMER

I decided to use a standard 555 one-shot circuit to generate a long pulse output suitable to flip a relay to drive the gate. Since you did not seem to have any information regarding what was needed to do the latter, I kept it simple. (Before I get yelled at for using a 555... yes I know.. it's cheating.. but hey, for something simple like this they are still the cheapest, less fuss, way to do it.)

OUTPUT DRIVER

As you can see, the output driver uses a MOSFET that, for not, turns on an LED, but you can hook in a relay coil, with a fly-back diode, in parallel to R24 and D2.

VIRTUAL GROUND REGULATOR

I decided you probably want to use a simple power supply for this and I chose 12V for the simulation. It will however work on a variety of voltages though some tweaking of values may be required. In order to make it single supply, this little circuit generates a virtual ground, basically half-rail which is used in a few places as indicated by VG.


As I say, the above seems to work in LTSPICE, but whether it works in practice in your actual setup conditions is not guaranteed. The circuit seems quite sensitive, but in no way is optimized, and without actual parts and conditions it is impossible to tell if it is even close. I definitely suspect you will need to play with R1,R2 and R3 with the actual devices and in sunlight vs darkness to get some sort of compromise. Be aware though, circuits like this are notoriously finicky, and unless you are up to the challenge and have the appropriate equipment, including a scope, it may be beyond your current ability. Either way, the circuit may give you some ideas of where to start. Anyways, good luck.

Related Topic