by pebe » Sat Sep 03, 2011 3:06 pm
Here is a circuit that should do what you want.
The XOR gates are two of a package of four in the CD4070. The first one is used as a level trigger and the second as the pulse generator. Both circuits use the feature of an XOR, whereby if the two inputs are the same, then the output is low but is they are at different levels then the output is high.
The resistance of the LDR at the switchover light level is assumed to be about 800ohms. With R1 set to that resistance, pin 5 will be about half the supply rail. During daylight, the resistance of the LDR will be lower so pin 5 is high. As pins 5 and 6 are at different levels, pin 4 will be high. Pin 1 will be high and C1 is charged so pin 2 will equal pin 1. Pin 3 will be low and the relay will be off.
As it gets darker the voltage on pin 5 will drop, until at about 6volts pin 5 changes from high to low. Both input pins will then be low and pin4 will go low. As it does so, current will flow through R2 pulling pin 5 slightly lower. This to give a Schmitt trigger effect to stop the slowly varying input going high again with noise.
Pin 1 will go low but pin2 will still be high until C1 has discharged through R3 down to about 6V. During that time pin3 will go high turning on the relay. The relay will be on for about 6secs.
When the LDR starts to increase in resistance at dawn, the reverse action will take place and the relay will again be switched on for about 6secs.
C1 should be a low leakage electrolytic or preferably a tantalum. If pin 4 oscillates due to noise at changeover, decrease R2 as necessary. You may need to go down to 22K.
When setting R1 for the changeover level, measure the voltage on pin4 – because relay changeover will have a delay.
I hope that all make sense.
- Attachments
-
- Double Pulse.GIF (4.67 KiB) Viewed 12959 times