> > -----Messaggio originale----- > > Da: pic microcontroller discussion list > > [mailto:PICLIST@MITVMA.MIT.EDU]Per conto di Byron A Jeff > > Inviato: venerdl 15 gennaio 1999 22.23 > > A: PICLIST@MITVMA.MIT.EDU > > Oggetto: Re: SUNSET SWITCH WITH 12C508 > > > I have a similar project (to finish) to replace an old unsatisfactory > sunset switch. > > > > I used almost the same technique for hysterisis. I sample the 555 65536 > > times, counting the number of light and dark intervals. If either light or > > dark gets the majority of the samples (the other getting no more than 255) > > If you have the same number ,(a cloudy day ) how does it work ? The default action is that if there isn't a clear cut winner is to do nothing. Most cloudy days are light enough to trigger the lights off. However a deep cloudy/stormy day will trigger the lights on, which is OK. There is the possiblity of oscaillation at 2-3 minute intervals, but I haven't observed it yet. > > > then the relay is triggered. Otherwise it's called a wash and nothing is > > changed. > > > > It takes about 30 seconds for the circuit to register light and > > about 2 minutes > > for it to register dark. I threw in a 30 second or so delay after a relay > > change to make sure that the circuit doesn't oscillate. > > That is a good idea ! I had used the same time. > > >I solved this by paralleling a 33 Kohm resister with the LDR. > > Me too > I also have the problem to limit the low level of LDR to keep the A/D > conv. in acceptable range. I couldn't get my LDR to register under 100 ohms even under direct 300 watt halogen light. You could always series a resister to ensure that you have enough resistance to get it to register. BAJ