LDR circuit causing Relay chatter

Thread Starter

coderatlarge

Joined Jan 11, 2021
1
I have a LDR board that has been connected to a 5v electromechanical relay board through a Digital Out pin. Both the LDR board and relay board are connected by the Digital Out pin going from LDR to relay. When the light is really low, this works very well but when the light is just fading (dusk), it creates a relay chatter till the light becomes low enough. How do I solve this? Is capacitor a solution?
 

jpanhalt

Joined Jan 18, 2008
10,963
Welcome to AAC.

The term for what you need is call "hysteresis" (https://en.wikipedia.org/wiki/Hysteresis). That is, when the light gets low enough that it turns off, it takes a significantly brighter lighter to turn it back on and visa versa.

Comparators can be set to do that. There are lots of resources for how to do that. Here is one: http://rohmfs.rohm.com/en/products/...mp_linear/comparator/gpl_cmp_hysteresis-e.pdf

If you are using an MCU, it can also be done in firmware or simply add a delay function. For example, when the light gets low enough to first turn it off or on, require that level or lower to be maintained for some period, e.g., 3 minutes, before it turns off/on.
 

dl324

Joined Mar 30, 2015
12,256
Welcome to AAC!

You'll get better results if you used an analog input to read the LDR voltage and add some hysteresis in software.

Schematics and/or block diagrams are preferred to verbal descriptions of circuits.
 
Top