# Dark Sensor LDR Circuit

#### Rip

Joined Apr 28, 2016
12
How would I go about designing a dark sensor circuit using an LDR and transistors? The LDR value for light is around 7k ohms and when its dark it is around 1M ohm. The transistors are 2N3904. The circuit has a 5V buzzer and a 2V (10mA) LED. The circuit should work as follows: when there is sufficient light falling on the LDR, the transistor should be in saturation and the LED should be lit and when there is not sufficient light falling on the LDR then that transistor is in cutoff and the LED is not lit and the buzzer should sound. How would I go about designing this circuit? Any help is greatly appreciated

#### Marley

Joined Apr 4, 2016
387
You have correctly stated how the resistance of the LDR changes with light level. So, if you make a potential divider with the LDR and a fixed resistor what will the divided voltage do?

Does your transistor circuit need to sound the buzzer when this voltage is high or low? Is you transistor circuit inverting or non-inverting?

Homework, so better not say more!

#### Rip

Joined Apr 28, 2016
12
I'm having trouble designing my alarm circuit. I can get the buzzer to sound when there is not sufficient light, but the LED stays on and I can not figure out how to design the circuit to make the LED shut off when there is not sufficient light. The LDR value for light is around 7k ohms and when its dark it is around 1M ohm. The transistors are 2N3904. The circuit has a 5V buzzer and a 2V (10mA) LED. The circuit should work as follows: when there is sufficient light falling on the LDR, the transistor should be in saturation and the LED should be lit and when there is not sufficient light falling on the LDR then that transistor is in cutoff and the LED is not lit and the buzzer should sound.

Attached is a picture that shows the general design of what I'm doing. The differences are that I am using a 9V source, the LED is right below R1 and the buzzer is where the LED is. The resistor R4 is not in my circuit and R3 is 300k ohms. How can I design this circuit to get the LED to shut off when there is not sufficient light and the buzzer to sound?

#### Attachments

• 72.1 KB Views: 27

#### bertus

Joined Apr 5, 2008
21,054
Hello,

Bertus

#### Rip

Joined Apr 28, 2016
12
it shouldn't be in homework help, so if you could please move it. That would be greatly appreciated

#### tracecom

Joined Apr 16, 2010
3,944
Schematic diagrams are the language of electronics. Make a drawing of what you have built. Hand drawn is okay. Use the drawing you posted in #3 as a reference of how to draw your circuit. There are lots of people who will be happy to help.

Rip

#### Rip

Joined Apr 28, 2016
12
Attached is a copy of the circuit.

#### Attachments

• 68.5 KB Views: 18

#### tracecom

Joined Apr 16, 2010
3,944
Good schematic. Move the resistor and the LED to be parallel with the buzzer. In other words, move the cathode of the LED to the collector of Q2.

#### tracecom

Joined Apr 16, 2010
3,944
Sorry, I reread your first post. You want the LED to light when it's light and the buzzer to sound in the dark. Correct?

#### Rip

Joined Apr 28, 2016
12
Sorry, I reread your first post. You want the LED to light when it's light and the buzzer to sound in the dark. Correct?
Yes, you would be correct

#### Jony130

Joined Feb 17, 2009
5,212
Try this circuit

R1 < 100kΩ
Or try your old circuit but you need to replace the 300kΩ resistor with a lower one (lower then 100kΩ). If that want help, try add a resistor in parallel with the LED.

Last edited:

#### Rip

Joined Apr 28, 2016
12
I just tried both of your ways and I could not get it to work. My question is why did you add the 1M ohm resistor R6 to the circuit?

#### Rip

Joined Apr 28, 2016
12
Now when I go back to my original design the alarm and LED are both on when the light is on and also when it is off

#### tracecom

Joined Apr 16, 2010
3,944
Here's a circuit that works even though it is not a good engineering design. Its major attribute is that it's cheap.

#### Rip

Joined Apr 28, 2016
12
I just tried the circuit, but it seems to light the LED and it stays on, but the buzzer doesn't sound. Ill mess around with the resistors and see what happens. Thanks for the help

#### Jony130

Joined Feb 17, 2009
5,212
But did you try "my circuit"?
My question is why did you add the 1M ohm resistor R6 to the circuit?
This resistor adds some positive feedback (hysteresis), in order to "force" the circuit to work as a bistable circuit (T1 ON -->T2--OFF and vice versa).
The lower the valuer the larger the hysteresis.

EDIT And from what I see you need R1 < 10kΩ (instead 300kΩ)

Last edited:

#### Rip

Joined Apr 28, 2016
12
well I tried your circuit and the LED lights up and the buzzer sounds, no matter if its light or dark. Any suggestions?

#### tracecom

Joined Apr 16, 2010
3,944
I just tried the circuit, but it seems to light the LED and it stays on, but the buzzer doesn't sound. Ill mess around with the resistors and see what happens. Thanks for the help
What buzzer are you using and are you sure you have the polarity correct?

#### Rip

Joined Apr 28, 2016
12
I'm pretty sure the polarity is right. I do also have 2N3906 transistors, if that could help in any way. The buzzers are sold on amazon and are:
12mm Dia 5 Pcs DC 5V 2 Terminals Electronic Continuous Sound Buzzer
Brand Name Amico
Material Type Plastic
Part Number s14070200am6908
UNSPSC Code 39121432

Last edited:

#### tracecom

Joined Apr 16, 2010
3,944
I don't actually have the buzzer you used, so I simply connected a second LED and 1k resistor instead of the buzzer, and the circuit works just as I posted it. So, why doesn't it work for you? Here are some possibilities.

wiring error
erroneous pinout used for Q1, Q2
buzzer connected with reverse polarity
buzzer burner out because it is rated for 5v and you are running it at 9v
buzzer draws more current that Q2 can supply