My gran keeps turning her internal light on in the car and then forgets to turn it off again. She has flattened the battery 5 times in the last few months.

I've been looking at how integrated circuits work and am hoping to go to university next year and study computer science. I was thinking this could be my first project!

The light has 3 switch positions:

  • always on
  • on when door open
  • off

What I want to do is fit a buzzer in the light that will buzz if the light is on and a door is open. I've come up with a circuit that I think should work. It's the first time I've attempted anything like this so I was wondering if you can see any problems with it or if it will actually work!

Circuit Diagram

If you think it will work what type of transistors do I need to buy? Are there different types?

The 'from switch' wire will be live or not depending on what position the switch is in.

Also if there's a better way feel free to tell me!

  • \$\begingroup\$ Did you measure the voltages that you wrote in your schematic? Many cars doors switch to ground when opened. \$\endgroup\$ – jippie Jun 11 '12 at 6:50

Yes, you are on the correct path, you just need to add base and collector current limiting resistors. What you are trying to achieve is called AND gate. Picture is taken from http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/trangate.html#c1

enter image description here

  • \$\begingroup\$ So does the resistance of the resistors at A and B (the bases?) depend on the voltage that's sent down the wire to the bulb? \$\endgroup\$ – Tom Jenkinson Jun 10 '12 at 22:40
  • 1
    \$\begingroup\$ here goes a bit of transistor basics. a small current on base-emitter path makes big current thru collector-emtter path to flow - something like 100-200 timer bigger. But you have to limit those currents as otherwise they will be as big as your battery allows and it will melt the transistor. current = voltage/resistance. start by figuring out what is your buzzer current requirements. this will define max current capability of transistors and values of resistors. \$\endgroup\$ – miceuz Jun 10 '12 at 22:48
  • 2
    \$\begingroup\$ oh, yeah, sorry, this is a logic level circuit, 4.7 is there to make a voltage to drop over it and get voltage at the output point. what you need is to put your buzzer in series with resistor. \$\endgroup\$ – miceuz Jun 10 '12 at 22:51
  • 2
    \$\begingroup\$ yes, it's called collector current, base current and source current for mosfets. start by defining current needed by buzzer, then look for a transistor capable of doing collector current twice buzzer current. base resistor is irrelevant in this situation, you want transistor to be fully on, so, base resistor has to be big enough not to kill a transistor, but small enought to put it into saturation. \$\endgroup\$ – miceuz Jun 10 '12 at 22:56
  • 4
    \$\begingroup\$ No, there is no point to the base resistors in this case. Note that both transistors are being used as emitter followers. The base current will self-limit. Extra base resistance will only cause more voltage drop. \$\endgroup\$ – Olin Lathrop Jun 10 '12 at 23:22

miceuz has a nice circuit, but mine is better! ;-) Seriously, his has a few disadvantages, one being that if you also try to OR signals this way the transistor may go kaputt.

I'm not sure it was intentional, but what you've drawn is a combination of an NPN transistor and a PNP transistor (maybe it was just an indication of the current flow):

enter image description here

Left is the NPN, right the PNP. The arrow indicates the direction of the base current: from base to emitter for NPN, from emitter to base for PNP. In both the base current will cause a larger collector current, again to the emitter for NPN, from the emitter for PNP. The base-emitter junction, as it's called, behaves as a diode: it will have 0.7V across it when there's current flowing through it. We'll use the NPN.

So the base current will cause a larger collector current. How much larger is given in the transistor's \$H_{FE}\$ parameter. For small transistors often minimum 100 to a couple of hundreds, for power transistors often not more than a few tens. Let's pick a not-so-random transistor, a BC337. This has an \$H_{FE}\$ between 100 and 600. It's the minimum we're interested in. And let's take this buzzer which will need 40mA at 12V, according to the datasheet.

enter image description here

If we want 40mA from the collector, and \$H_{FE}\$ is 100, then we need 0.4mA into the base. We play safe and choose 1mA, we'll see what the consequence of that is. Input A and B are at 12V when they want to switch the transistor on. The base of T2 is at 0.7V, so there's 12V - 0.7V = 11.3V across resistor R2. To have 1mA through it we apply Ohm's Law: V = I\$\times\$ R, or R = 11.3V/1mA = 11.3k\$\Omega\$. We can use 10k\$\Omega\$ here.

OK, so you make input A high, 12V, and nothing happens. T2 wants to draw 100mA, but T1 doesn't cooperate. If we do the same for input A and T1 then there will flow 100mA. Well, not quite. The buzzer consumes 40mA at 12V, that's 300\$\Omega\$ (Ohm's Law again). If we would start with 10mA that would cause a 3V drop (10mA \$\times\$ 300\$\Omega\$) across the buzzer, and T1's collector would be at 12V - 3V = 9V. 20mA would give 6V across the buzzer, and the 6V remaining on the collector. And so on, until 40mA, which gives 12V drop and zero on the collector. We can 't increase the current further because we're at the bottom with our voltage, we can't go negative. So even if the transistor wants to draw 100mA it's limited by the load's resistance, the buzzer that is. That's why you can safely have a little higher base current, so that we certainly don't have too little collector current.

Now why is this circuit better than miceuz's? Here we control a 12V load with a 12V input, but you'll often see that for instance a 5V input from a microcontroller will switch a 12V relay. That's perfectly possible with this circuit. The transistor doesn't care about the collector voltage, all it wants is current. (That's not completely true, the voltage is also limited, often to 45V or 60V, but there are transistors which can switch 1000V, even with 5V input.
miceuz's circuit can't do that. If you apply 5V to the input the emitter will set at 4.3V, or 0.7V lower. Even if the buzzer's power supply would be 12V. The difference, 7.7V would cause heating of the transistor.

  • \$\begingroup\$ Aren't car electr(on)ics usually switched to ground? In that case the circuit should be the other way around and built with PNP's. I remember creating such a circuit for my brother using only diode(s) and a buzzer. \$\endgroup\$ – jippie Jun 11 '12 at 6:48
  • \$\begingroup\$ Where does the output cable go in this circuit? Also I'm still a bit confused from looking at the diagram what has changed from miceuz's circuit. Also thanks for explaining the difference between NPN and PNP. \$\endgroup\$ – Tom Jenkinson Jun 11 '12 at 8:56
  • \$\begingroup\$ @Tom - Yes, that's confusing, I'll remove it, you don't need it. In an amplifier the buzzer would be a resistor, and by varying the current the transistor would change the output voltage, which could go to a speaker for instance. Remember how I explained the 10mA, 20mA and so on, how they caused a 3V drop, a 6V drop etc. \$\endgroup\$ – stevenvh Jun 11 '12 at 9:01
  • \$\begingroup\$ I still don't understand though what the difference is between your circuit and miceuz's though. The diagrams look identical to me. \$\endgroup\$ – Tom Jenkinson Jun 11 '12 at 11:11
  • 1
    \$\begingroup\$ His has the output at the emitter below, mine at the collector at the top. For his you make the base high, so that there will flow current from collector to emitter and through the buzzer. There will be about 11.3V at the lower emitter. If it would go higher you wouldn't get the required 0.7V and the current would stop. So it stops automatically at 11.3V, and you have to make the input a real 12V. In mine the base current only sees the 0.7V diode, so 0.7V is enough to get the thing running. The buzzer could work at a higher voltage if needed, what the other circuit couldn't. \$\endgroup\$ – stevenvh Jun 11 '12 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.