Dark sensor circuit using LM393 question.... unstable OFF/ON... flickering

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Hi,
This is a clip of a test I am running using 8 LDR's, showing the ADC count.
The values are sampled once per second and an average of 10 results plotted.

It is a dull and wet day.
Note the difference in the basic LDR resistance, which is giving different ADC values.
E
View attachment 361976
With this result, what would be your guess as far as the time difference from min to max resistance between LDR's?
I can set up 6 LDRs on a breadboard in conjunction with 8 LEDs and resistors. I will connect 12v and set the breadboard outside just before dusk. I will note the time the first one comes on as compared to the last. If they all come on within a 15 min span, I will measure the resistance on the third and fourth one that comes on. The average of those two will be the resistance to use for the design. Sound good?
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Then why change it?
Question, how do you know when the LDR as sensed it's dark enough to activated the PIR?
With my current circuit/PCB, for testing, I manually soldered on thru hole resistors to eliminate the chatter when the unit energized (hysteresis). Another resistor eliminated the "flash" of the high power LED when unit powered on..... etc
As far as the level of darkness needed to turn on, I tried several different variable resistors on my current board until I settled on a 15k. These tests were made in several of the units in real world conditions.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
I'm speaking of using the LDR with the ATtiny to sense when it's dark enough.
Oh ok. We are trying to simplify the circuit and reduce the number of components on the board. Hopefully that can be accomplished easily while eliminating the LM393 and a few resistors. If not, I will keep the LM393.
 

ericgibbs

Joined Jan 29, 2010
21,464
hi john,
Based on the result of 8 LDR's, I would use a revised Lower Limit of 600 and an Upper Limit of 700, when using the ADC method.

The Red and Blue lines show the previous limit values
E
EG 1970.png
 
Last edited:

ericgibbs

Joined Jan 29, 2010
21,464
hi john,
To help you follow the plots,
By changing to those revised limits, 600 and 700 , the time between the 1st LDR and last LDR switching will be shorter and better defined.
E
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
hi john,
To help you follow the plots,
By changing to those revised limits, 600 and 700 , the time between the 1st LDR and last LDR switching will be shorter and better defined.
E
So using 8 LDRs, the first LDR reached the desired resistance at 15:57 and the last one at 16:11, so a difference of 14 minutes:seconds? seconds:hundredths? Is that military time? 3:57pm and 4:11pm?
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
OK, so you are saying the code that's in the micro now is based on using the LM393?
The code that I created and sent to Eric, which is the code I have been tweaking for several months now is for a circuit using the LM393. Eric is now trying to establish code for allowing the ATTINY to replace the duties of the LM393. Fingers crossed.
1768353679442.png
 

Attachments

Last edited:

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Still want to use the mini 360?
The 78L05 regulator rated 100ma is another sound choice.
View attachment 362018
I actually used a through hole version a while back (LM7805) and have a few dozen somewhere. I was hoping to get thoughts about that linear circuit from the others too.... whether I should just stick with the mini360 or change to the LM7805 with caps..... I don't believe I got any feedback on that question. Maybe others will chime in.... Thx!
 

sghioto

Joined Dec 31, 2017
8,634
The 10uf caps are fine.
The 7805 is way overkill as the mini 360 which is why I suggested the LM2936 originally but a 78L05 either surface mount or through hole will save a lot of space on the board as well.
It kind of irks me :mad: when a regulator draws more quiescent current then the load which in this case is miniscule, just saying.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Awesome!! I will read up on the 78L05 and place it in the space taken by the mini360. Thx as always guys!! My schematic is attached in post #276.
So, can I use my 10uF caps in all cases?
 
Top