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.
simulate this circuit – Schematic created using CircuitLab