Electronic – How to avoid Relay buzzing noise? (LDR dependent)

ldrnpnphotoresistorrelay

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

Best Answer

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.