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

ericgibbs

Joined Jan 29, 2010
21,463
hi john,
A rough plot showing how the spread on the LDR specification as indicated by the d/s.
One shows the 3 LUX range and the other the 15 LUX range.
Note the possible LDR voltage for a given LUX.
E
EG 1943.png
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
hi john,
A rough plot showing how the spread on the LDR specification as indicated by the d/s.
One shows the 3 LUX range and the other the 15 LUX range.
Note the possible LDR voltage for a given LUX.
E
View attachment 361493
So, the bottom line question is, would this make sense regarding the 15k that I intend to use for R7? I really appreciate all of the detailed information.
John
 

ericgibbs

Joined Jan 29, 2010
21,463
would this make sense regarding the 15k that I intend to use for R7?
hi john,
Bottom line No.
Using a 15K for R7 all the PCB's, with the d/s plotted 12 LUX possible spread from a batch of LDRs, will mean the Light/Dark switching could be different for each PCB.

You should check say at least 20 LDR's, using a 15k and measure the LUX at the Light/Dark switching levels.

E
EG 1945.png
 
Last edited:

bertus

Joined Apr 5, 2008
22,940
Hello,

@lichurbagan , the circuit has no hysteresis, so it may jitter.
In this thread the hysteresys is added to avoid the jitter.

There is also an error on the given page.
The light and dark sensors show the same circuit.

Bertus
 

ericgibbs

Joined Jan 29, 2010
21,463
hi @lichurbagan

In addition to the problems in that link circuit, pointed out by @bertus, is the fact that the Comparator switching voltage can be adjusted.

The TS on this Thread intends to make and sell many hundreds of his PCB/Circuit, BUT without any means of the user setting the LUX point switching levels.
If you check the d/s graph I posted for the LDR he is using, it shows a very wide spread in LUX versus LDR resistance, which could result in his PCB modules switching at very different LUX levels.
EEG 1941.png
 

LesJones

Joined Jan 8, 2017
4,509
Even if an LDR with closely defined characteristics was used the end user would need to be able to adjust the light level at which the light switched on. This would depend on how much shielding the device had from a clear view of the sky.
Les.
 

LesJones

Joined Jan 8, 2017
4,509
Hi Eric, I thought if enough people told him the same thing he might listen. I don't understand what the ATtiny 85 does as it does not have an input that will control the PWM duty cycle. I don't even see the need to control the brightnes of the LEDs that it is driving. Re reading his response in post #51 he talks about ideal light level but does not say what that light level is.
Les.
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
hi john,
Bottom line No.
Using a 15K for R7 all the PCB's, with the d/s plotted 12 LUX possible spread from a batch of LDRs, will mean the Light/Dark switching could be different for each PCB.

You should check say at least 20 LDR's, using a 15k and measure the LUX at the Light/Dark switching levels.

E
View attachment 361505
I think that may be the best approach. How can I measure LUX?
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Hi Eric, I thought if enough people told him the same thing he might listen. I don't understand what the ATtiny 85 does as it does not have an input that will control the PWM duty cycle. I don't even see the need to control the brightnes of the LEDs that it is driving. Re reading his response in post #51 he talks about ideal light level but does not say what that light level is.
Les.
To clarify what this light is for, I created the light for watching deer or hunting hogs at night. The high power LED slowly brightens from very dim to very bright when motion is detected. The PWM function is intended to avoid spooking the animals like a bright light that flashes on suddenly would. The light stays bright for two minutes, then slowly fades until motion is detected again. The 5mm red LEDs come on at night to show that the unit is powered on. They blink five times to indicate that motion has been detected. The ATTINY has an Arduino sketch loaded that controls all LEDs behavior. The unit needs to power on at dusk. Light level is not critical. If these LDRs vary in resistance, so be it. Again, I value all of your input, assistance and recommendations being provided.
 
Last edited:

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Providing further clarification, I have several of these units currently. They all function perfectly in regards to led behavior, power consumption, reverse polarity protection, etc.
My original issue here was to eliminate the led chatter when the current was sent to the mossfet at dusk. I was told that I needed to add hysteresis to my circuit, which has been done. Subsequent testing shows all chatter is gone now. I also asked how I could eliminate the initial bright flash of the high power LED at power on at dusk. I was provided a circuit to eliminate that. I have not tested that yet.
 

bertus

Joined Apr 5, 2008
22,940
Hello,

You could measure the light intensity with the light meter or app at dusk.
You could simulate the light intensity in a dark box with a regulated light source.

Bertus
 

ericgibbs

Joined Jan 29, 2010
21,463
hi john,
You do not need to measure the absolute Lux light level, you need a method of measuring the relative intensity of a light source. ie Dark On, Light Off point.

I would choose an LDR located on the PCB as the reference.
Using the outdoors Dawn/Dusk method, set the PCB , R7 value to switch at the light levels you require.
This is now your empirical relative lux measuring standard PCB.

Use a 12V variable bench power supply with say a 12V low wattage vehicle lamp/bulb and then calibrate the PSU setting using the 'standard PCB' observing and recording the switch On/Off PSU voltages of the PCB.

You can now use the recorded settings of the PSU to check other LDR/PCB units and SOT [ select on test] the required R7 value.

Double-check that the PCB units operate correctly outdoors.

Do you follow, OK.?
E
 

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
hi john,
You do not need to measure the absolute Lux light level, you need a method of measuring the relative intensity of a light source. ie Dark On, Light Off point.

I would choose an LDR located on the PCB as the reference.
Using the outdoors Dawn/Dusk method, set the PCB , R7 value to switch at the light levels you require.
This is now your empirical relative lux measuring standard PCB.

Use a 12V variable bench power supply with say a 12V low wattage vehicle lamp/bulb and then calibrate the PSU setting using the 'standard PCB' observing and recording the switch On/Off PSU voltages of the PCB.

You can now use the recorded settings of the PSU to check other LDR/PCB units and SOT [ select on test] the required R7 value.

Double-check that the PCB units operate correctly outdoors.

Do you follow, OK.?
E
Yes sir, thx.
All light testing is now being done in real world conditions outside at dusk. So far, the 14.7k for R7 seems to be the best result as compared to 22k and 12.2k. I will set up 3 more with the same 14.7k and see how much time passes as each one comes on. If within 10-15 min either way, I will call it good and I don't expect it to be that much.... I will post results tomorrow. Thx again to everybody!!
 
Last edited:

Thread Starter

johnaustinkaty

Joined Jul 16, 2021
284
Results from this evening's test:
I had three lights set up outside, 4' apart with LDRs oriented up to the sky. There were no artificial lights nearby. At 6:01pm, the first unit turned on. The second one turned on two minutes later and the third came on three minutes after that. Only a five minute time span separated the three. I will add one more unit tomorrow and see what my results are. Again, this is using a 15k @ R7(actually a 14.7k because I need to order 15k SMTs). Great results!!
 
Last edited:
Top