1
\$\begingroup\$

I have the following circuit where I'm switching a relay based on whether it's day or night. I made a voltage divider using a pot and an LDR, which leads to the NPN transistor. So when it's dark the NPN will switch, which then causes the relay to switch.

Problem: I am getting a buzzing noise whenever there is a gradual decrease in light, which is a problem since I'm going to be placing this outside. My guess is there is a threshold where the voltage causes the relay to switch back and forth quickly, causing the buzzing noise. How do I ensure the relay only switches once when light slowly fades? Is there some latching device I could use?

Also, my DC power source is via a full-wave rectifier without a capacitor, so there seems to be very small fluctuations in the DC voltage. Would that be the problem?

EDIT: I read about relay hysteresis, but so far I only read about solutions using microcontrollers, which I want to avoid.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$

3 Answers 3

3
\$\begingroup\$

my DC power source is via a full-wave rectifier without a capacitor, so there seems to be very small fluctuations in the DC voltage. Would that be the problem?

Yes. Without a capacitor to smooth out the rectified AC, the voltage will go up and down at twice the mains frequency. This is why the relay 'buzzes' - it is turning on and off in time with the rectified AC.

enter image description here

How do I ensure the relay only switches once when light slowly fades?

Most relays have a large hysteresis (pick-up voltage > 3x drop-out voltage) which in your unity gain circuit should be sufficient.

\$\endgroup\$
1
  • \$\begingroup\$ Reselected this as best answer since the capacitor fixed the problem. \$\endgroup\$ Commented Jul 2, 2015 at 20:59
6
\$\begingroup\$

You need what is called a Schmitt trigger. And yes, you definitely need to put a capacitor on your power supply. Try something on the order of 1000 uF to start. Then measure the supply voltage, and it had better be more than 24 volts, although it almost certainly will be.

Then you need to get a comparator IC - an LM311 will do fine. You also need to get a cheap DMM to read voltages and resistances with - eBay will get you a basic unit for less than $10. Now measure the resistance of your LDR at the sort of light level where you want your lights to come on. Let's call this 1 Megohm, just to have a number to work with.

This circuit

schematic

simulate this circuit – Schematic created using CircuitLab

should work pretty well.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ you have the comparitor inputs backwards, your curcuit turns the relay on in the light, sorry to misdirect. \$\endgroup\$ Commented Jun 16, 2015 at 1:21
  • \$\begingroup\$ @Jasen - Dang! I always do that. Edited to fix. \$\endgroup\$ Commented Jun 16, 2015 at 1:22
  • \$\begingroup\$ that looks better. \$\endgroup\$ Commented Jun 16, 2015 at 1:25
1
\$\begingroup\$

Maybe not so much a definite answer, but a nice step into the good direction allowing to gain yourself some knowledge.

The problem you face is two-fold:

  1. Most of the buzzing will be solved by adding a capacitor to the power supply. Rule of thumb is 2200µF/A drawn by the load, so order magnitude 470µF should be sufficient, 4700µF is somewhat overdone (but not necessarily bad).
  2. The other cause is that the transistor as you use it delivers an approximately unity voltage gain. While the surrounding light slowly increases, the voltage on the relay coil is changing slowly with it. You can partially solve this by moving the relay from emitter to collector line. So connect emitter to ground and the relay goes between +20V and collector. The relay may have enough hysteresis of its own to nicely switch on and off. The advantage is that you actually use the transistor as (voltage) amplifier.

The advantage of 2. is that you already have all components required and it is easy to test. The disadvantage is that the thresholds will probably change substantially. You may want to increase R1 to 2k2 or so to protect the transistor base. I agree with the other answer that you really need something like a schmitt trigger although I would personally probably opt for an all transistor solution.

See also: Use bipolar transistor to power LED from a certain power on?

\$\endgroup\$
1
  • \$\begingroup\$ interesting, will consider it \$\endgroup\$ Commented Jun 16, 2015 at 22:30

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.