2
\$\begingroup\$

I'm still fairly new to electronics and have been teaching myself as a hobby. Currently I'm working on a project that detects a red laser beam, and once detected will turn AC lights OFF if they're already on, or ON if they're off.

I've got everything working except 2 things: * open relay if it is closed, close relay if it is open * not require constant laser source

At the moment it will only turn on while the laser is pointed at the detector.

How would I go about activated or deactivation the relay once the laser is detected for say 200ms? In other words how do I set it up to not require a constant laser source.

Secondly, what would be a good way to detect if the relay is already on or not? I mean I can check and see if the light sensor is active or not, but I'm trying to do this all without an Arduino or other micro controller. So how would I detect if the relay or light sensor is active or not from inside the same circuit, and then perform the opposite action to turn the lights on or off.

Am I going about this the right way or am I missing something?

Any help on this is greatly appreciated.

Thanks

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Sounds like you want a T flip-flop. \$\endgroup\$ Commented Jun 23, 2015 at 20:33

1 Answer 1

1
\$\begingroup\$

A T-flip-flop memorizes a 1bit state until the next clock edge, and inverts that bit at every clock edge. You can easily build one by putting an HIGH level at both the J and K inputs of a standard JK-flip-flop like the old-fashioned 4027 or the 74HC73.

On the other hand, I don't see why you would want to check whether the relay is excited or not, since it is your detector circuit that controls it, so your circuit "knows" whether it is energizing the relay coil (unless you need to detect failures).

If you use a comparator connected to a circuit which detects the LASER beam, the output of the comparator can be connected to the T-flip-flop input, generating a clock edge every time the beam is detected. For any detection the T-FF will toggle its output, which can be connected, using a suitable interface (a simple transistor used as a switch will do), to the relay. Note that the T-FF will keep its output in the same state (ON/OFF) until the next detection.

EDIT (To incorporate a suggestion from Peter Bennett)

To have a circuit which is reliable and doesn't behave erratically, you should disable the clock of the T-FF for a small time interval after a detection, this to avoid a possible burst of ON/OFF events in the case the beam is waved over the sensor. This can be achieved with a so-called monostable multivibrator (one-shot) between the output of the comparator and the T-FF clock input. The comparator output triggers the one-shot which produces a pulse of given duration and becomes insensible to other transitions until that duration has elapsed. Therefore the T-FF can receive a new clock pulse only after the one-shot delay has ended. You may consider using a 74HC123 for the job.

\$\endgroup\$
5
  • \$\begingroup\$ Well where I'm stuck is getting the detector circuit to activate the relay and keep the relay activated. Because right now as soon as the laser is removed, the detector will stop exciting the relay. I'm thinking maybe I need some sort of soft on/off switch that gets switched by the detector, allowing the detector to only be on for a few ms at a time.. \$\endgroup\$ Commented Jun 23, 2015 at 21:28
  • \$\begingroup\$ The T-flip-flop does this. See my edit. \$\endgroup\$ Commented Jun 23, 2015 at 21:45
  • \$\begingroup\$ Just seen your edit. What you describe sounds like what I'm needing so I will look further into that. Thanks for the help! \$\endgroup\$ Commented Jun 23, 2015 at 21:59
  • \$\begingroup\$ You might want to add a one-shot or monostable multivibrator (73LS123, for example), so the flip-flop won't toggle several times in quick succession as you wave the laser around the detector. \$\endgroup\$ Commented Jun 23, 2015 at 23:37
  • \$\begingroup\$ @PeterBennett Yep, thanks. That's definitely to be done. I just threw a bunch of ideas into this answer and didn't work out the details. That's definitely a must for reliable operations. I'll update my answer. \$\endgroup\$ Commented Jun 23, 2015 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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