3
\$\begingroup\$

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.

\$\endgroup\$
  • 5
    \$\begingroup\$ Sounds like a fun project. Good luck with it. When you have an actual question, feel free to edit it into this announcement. \$\endgroup\$ – Brian Drummond Dec 19 '17 at 20:30
  • \$\begingroup\$ Day / night type light level circuits exist, re-purpose one... \$\endgroup\$ – Solar Mike Dec 19 '17 at 20:35
  • \$\begingroup\$ OK so.. two issues I see. 1.) Sensitivity to natural flashing due to say wind blowing a tree branch around casting a changing shadow on the sensors. 2.) Once it is open.. then what.. does it stay open indefinitely or do let it close on a car that did not go all the way through? \$\endgroup\$ – Trevor_G Dec 19 '17 at 21:11
  • \$\begingroup\$ You do know someone waving their hand, or the dogs tail wagging, in front of the sensor will open the gate right? \$\endgroup\$ – Trevor_G Dec 19 '17 at 23:11
  • 1
    \$\begingroup\$ @Trevor - animals are on the inside hopefully, but waving a hand...hadn't thought of that but it's a bonus; easy secret way to manually trigger the gate. Thanks! \$\endgroup\$ – Hebekiah Dec 20 '17 at 10:57
3
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Wow, you must have been really bored! Surely there's a way to work a vacuum tube in there somehow. \$\endgroup\$ – Olin Lathrop Dec 20 '17 at 21:02
  • \$\begingroup\$ @OlinLathrop I'm perpetually bored ;) Ya but I like challenges too. Micro's are just too easy. \$\endgroup\$ – Trevor_G Dec 20 '17 at 21:04
  • 1
    \$\begingroup\$ Thanks so much, I'd figured on many of these components including the 555 as a timer (don't know why it's cheating) and your assumptions are entirely correct about voltage (12v basis) and having a scope (nope). Low voltage (<0.2mV) dual comparators are made for ambient light and battery/capacitor charging applications (with clocks and relays even!). It seems all the pieces are out there, prebundled chunks of what I need, the combination of them eluding me. Your contribution gives me hope to forge ahead and a map of what I need to get from A to Z. \$\endgroup\$ – Hebekiah Dec 23 '17 at 22:44
  • \$\begingroup\$ May take a couple weeks to assess and get back. Ought I to mark "answered"? \$\endgroup\$ – Hebekiah Dec 23 '17 at 22:44
1
\$\begingroup\$

Use a CdS photoresistor as a sensor, feed the result into a microcontroller A/D input, and the rest is firmware.

CdS sensors are slow but quite sensitive. You may need to change ranges by using different pullup resistors depending on the ambient light level, but that's very easy electrically.

The real work is the firmware that looks for changes in the light level and detects the appropriate pattern. A background algorithm low pass filters the light level value with a fairly long time constant. You consider the result of that the ambient level, and subtract it from any instantaneous reading. Then you look for the appropriate deviations in this current minus ambient light value.

Getting it to work in daylight will be tricky. Shading the sensor and blocking most of its view angle to only where the car headlights are expected to be will be important.

\$\endgroup\$
  • \$\begingroup\$ thanks, thought of the shading, plan to use short tubes pointing in the right direction, possibly with fresnel collectors (or just raid the small domes on PIR sensors). Figured I'd have a target, maybe a smiley face with sensors in the eyes, for headlights to aim in the direction of. Obviously plenty of fine tuning to do but trying to get the comparator to work with whatever it is that will look for 3 signals within a few seconds. Thinking there's got to be momentary button sensor things that do one thing if a single push, something else if push twice? \$\endgroup\$ – Hebekiah Dec 20 '17 at 10:31
  • \$\begingroup\$ "Thinking there's got to be momentary button sensor things that do one thing if a single push, something else if push twice?" That sort of function would be implemented by whatever the sensor is connected to, not the sensor itself. \$\endgroup\$ – Finbarr Dec 20 '17 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.