# Help in understanding the math behind the schematic.

#### jackorocko

Apr 4, 2010
1,284
Ok. little background on myself. I am a high school graduate with no formal electronic education. I read books and tutorials etc online. I think I am above the curve when it comes to understanding electronics, but where I struggle at is the design of circuits. I think a lot of this comes from a lack of knowledge of the math behind the design.

So what I want to accomplish is to teach myself effectively how to design circuits.

I was asked if I could make a simple trip laser security alarm that a friend had seen online, here http://www.wonderhowto.com/how-to-home-laser-beam-security-system-251050/

Now, afaik, The way this circuit works is that the laser upon hitting the photocell causes the resistance to decrease enough so that the flow of current is higher threw the photocell to ground. this effectively keeps the 2n3904 in an 'off' state. As soon as the laser is interrupted the resistance threw the photocell now is very high causing the flow of current to the transistor to increase, effectively putting the 2n3904 into a 'on' state. This completes the siren circuit and causes current to flow threw the load across the collector-emitter and to ground.

Now if all I said above is correct and I understand the principle of the circuit, how do I go about figuring out the math? What is important to know about this circuit that I would need to know from the datasheets of the components?

I am under the assumption the transistor works on current, if enough current is applied to the base, the transistor will turn 'on' But, I can not for the life of me figure out the values needed for the resistors. This is where I have major problems. I though I read somewhere that I need to break down the circuit into it's sub-circuits to do the math. I see two sub-circuits in this design, the alarm circuit and the photocell circuit. Does the variable resistor work as a voltage divider in this instance?

So I'll end there for now. I hope someone can help me with some insight, even if it's to post a link to a website where I can read and learn the exact procedure for doing this sort of stuff. I WANT to learn.

Also, isn't there some easy electronic simulation software I can use to design this circuit and tinker with it in simulation? I tried 'solve elec' , but that program seems to be severely lacking or I am just completely incompetent.

#### Laplace

Apr 4, 2010
1,252
The referenced schematic is drawn in an unconventional manner which makes it difficult to understand. It appears that the transistor base-emitter junction is forward biased across the power supply. Can't see how this will work, and the transistor will burn out shortly after the power is turned on.

#### jackorocko

Apr 4, 2010
1,284
Laplace, well I appreciate your answer. But, you haven't really left me with anything to understand or even attempt to learn.

Is there another way that would be better? Can you explain how the transistor would blow? That is all part of what I am trying to figure out. I am really glad that you see how this won't work, But I am still at a lost...

I tried to complete this circuit in multiple simulation programs now and I haven't been able to accomplish it at all. I tried the yenka program, it pretty much showed what you stated, the transistor would blow because of too much current across the C-E. What I didn't understand about the yenka program was the C-E current was 2 kA. which doesn't make any sense to me since I only have a 9v battery as the source.

I did actually make a working model of this schematic, the alarm surely was working. So the circuit does work or at least part of it does. What I was not capable of was getting the alarm to shut off once the laser was pointed at the photocell.

#### Laplace

Apr 4, 2010
1,252
I have never seen a datasheet that shows parametric curves for a diode that is forward biased going out to 9 volts. It is just not done since it would lead to a massive amount of forward current flow. The base-emitter junction of a transistor acts like a forward biased diode. Your modeling program obviously did not know your power supply was a 9 volt battery, and assumed the power supply was capable of providing an infinite amount of current.

If I were to try to make that circuit work I would connect the resistor from the power supply to the base of the transistor, and connect the photocell across the base-emitter junction. (That is assuming the photocell conducts current when illuminated.) So when the photocell is dark and no current is flowing, all the resistor current flows into the base of the transistor, turning the transistor ON and sounding the alarm. When the photocell is lighted it will shunt current from the base, and if it shunts enough current to lower the base voltage below about 0.5 volt then the transistor will turn OFF and the alarm will go quiet.

#### jackorocko

Apr 4, 2010
1,284
Ok, well i took your advice and re-arranged the circuit or so I think I did. What I got now is a voltage divider across the base of the transistor.

I tested my photocell out and I get fluctuating numbers, but the most consistent numbers I got was 500 Ohms when the PC was illuminated and 33k Ohms when the cell was just sitting on my desk in a dimly lit section of my room. So I used these numbers in the simulation. As you can see below in the images. Please tell me if I am on the right track now.

#### Attachments

• dark_photo_cell.png
23 KB · Views: 261
• illuminated_photo_cell.png
19.6 KB · Views: 260

#### Laplace

Apr 4, 2010
1,252
You are on the right track; however, your placement of the photocell will give maximum collector current when the photocell is illuminated. I thought the project specs called for maximum collector current when the photocell is dark. If I were to mention measuring the Thevenin voltage of the network driving the transistor base, would that make sense to you?

#### jackorocko

Apr 4, 2010
1,284
your placement of the photocell will give maximum collector current when the photocell is illuminate

You're exactly right, I was interpreting the simulation wrong. When the alarm is 'on' the voltage should drop across the load, as such, there should be less then 3 volts potential on the collector of the transistor since the load works from 6 - 14 volts.

How does this look now?

Couple more questions if you don't mind. Why am I seeing current even when the transistor is in the 'off' mode? Is this standard leakage or am I seeing the current being drawn by the voltage dividing circuit? I guess this is where the math would help explain to me exactly what is going on a little better.

If I were to mention measuring the Thevenin voltage of the network driving the transistor base, would that make sense to you?

No, but I WANT to learn. So I will find out what I can. please feel free to expand upon whatever knowledge you think that will help me at my current stage.

Just FYI, I got bigger plans for this project. What I would really like to do is expand the alarm circuit to instead of just sounding the alarm, I want the alarm to sound continuously and at the same time short a button on a cell phone keypad for a set number of seconds to make a phone call to myself. Maybe you see where I am going with this??? I really haven't thought about this much, but I am guessing I would need some sort of switch to turn on a sub-circuit and then have a way to keep it on. I had also plans on using some sort of timing circuit for the speed dial on the phone.

#### Attachments

• dark_photo_cell_2.png
24.9 KB · Views: 235
• illuminated_photo_cell_2.png
23.3 KB · Views: 216
Last edited:

Apr 4, 2010
1,284

#### Laplace

Apr 4, 2010
1,252
You seem to have it under control. There is nothing more I can suggest.

#### jackorocko

Apr 4, 2010
1,284
I really appreciate the time you took to help me Laplace.

I have a working model sitting on my kitchen table now. Works exactly as it should!

#### neba3939

Mar 15, 2012
9
I need help...

I am new to building circuits, but i have basic knowledge of electronics..
I built the circuit as it is shown in the schematics.. and if i am not mistaken the alarm was suppose to go off when the laser light was cut off but in my case when i turn on the laser light the alarm starts to sound and when i take it off it get quite(it works reversely) so can you please point out my mistake.. thank you.

#### Attachments

• lser2.jpg
23.5 KB · Views: 184

#### duke37

Jan 9, 2011
5,364
The photocell conducts when it is illuminated, providing current to the transistor as you have found.

The resistor and photocell need to be interchanged to get the opposite effect. Some change of resistor value may be necessary.

#### (*steve*)

##### ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
the problem is that the LDR supplies base current to the transistor to turn it on.

When it is illuminated by the laser it can supply a lot of current and the transistor is turned on (Buzzzzz).

When the light it interrupted the LDR's resistance increases and the base current is reduced greatly. THe transistor turns off (no buzzzz).

The naive solution is to swap the position of the LDR and the 1K resistor, but in practice you'll have to play around with the value of the 1K resistor. Try starting with 4k7.

#### neba3939

Mar 15, 2012
9
Thank you guys for the quick help. And I interchange the photo cell and the resister. And I changed the 1k resister with a 5k and it work perfectly but once the laser is interrupted the alarm start to sound but when the laser comes on the alarm will stop. Is it possible to make the alarm sound continuously without non stop unless it is stopped manually? Thank you again

#### Sid723

Jan 28, 2010
57
Is it possible to make the alarm sound continuously without non stop unless it is stopped manually? Thank you again

To do that, you will have to add another two transistors to your design and make a flip flop type configuration. This will cause the output to the transistor in your circuit to stay on once the laser beam is tripped.

Here is an example of a flip flop using two transistors:

http://en.wikipedia.org/wiki/File:Flipflop_by_trexer.png

#### jackorocko

Apr 4, 2010
1,284
Well this was my original thread. This was one of the first projects I ever took on. The link below is what I ended up with. It uses a flip flop and will sound the alarm for a set time period based on the 4060. Check it out, it is fully functional and easily up-gradable. You could even use magnets and reed relays for windows and such.

http://gurutechy.wordpress.com/2011/09/14/laser-alarm-circuit/

#### neba3939

Mar 15, 2012
9
thank you for telling me additional two transistors are needed, and could you please tell me where i should insert the two transistors in the design. thank you... I am new for this so i was not able to understand the flipflop picture

Replies
26
Views
1K
Replies
11
Views
798
Replies
3
Views
1K
Replies
2
Views
747
Replies
6
Views
1K