# Driver circuit. How do you figure out what transistor and resistor values to use? Need help

O

#### obliquez

Jan 1, 1970
0
Hiya, i'm new to this group, so i have no idea where i should post this
thread. So hopefully im posting in the right place.

Anyway, my problem is, i've got to connect a temperature sensor to a
buzzer. Sounds simple? Not so, i've gotta use a driver circuit to
connect the components. The sensor uses TTL logic output, so a driver
circuit has to be used to connect it to the buzzer, which runs on a
3-24V input.

Frankly speaking, i have no idea what i'm supposed to do. I don't know
how to figure out the values of the resistor or what transistor to use

It's part of my final year project, so it's really important that i get
help asap. Will be utterly grateful to anyone who can provide some
help.

In case my summary is not very clear, what i need to know now is just,
what kinda driver circuit should i use? And what are the values of the
components, i.e resistor, transistor, that i have to use to get that
driver circuit.

Argh! I'm not explaining very well. I hope you guys know what i'm
trying to say

J

#### John Popelish

Jan 1, 1970
0
obliquez said:
Hiya, i'm new to this group, so i have no idea where i should post this
thread. So hopefully im posting in the right place.

Anyway, my problem is, i've got to connect a temperature sensor to a
buzzer. Sounds simple? Not so, i've gotta use a driver circuit to
connect the components. The sensor uses TTL logic output, so a driver
circuit has to be used to connect it to the buzzer, which runs on a
3-24V input.

Frankly speaking, i have no idea what i'm supposed to do. I don't know
how to figure out the values of the resistor or what transistor to use

It's part of my final year project, so it's really important that i get
help asap. Will be utterly grateful to anyone who can provide some
help.

In case my summary is not very clear, what i need to know now is just,
what kinda driver circuit should i use? And what are the values of the
components, i.e resistor, transistor, that i have to use to get that
driver circuit.

Argh! I'm not explaining very well. I hope you guys know what i'm
trying to say

You are starting in the middle. We need to start at the beginning.

What do you want to have happen relative to temperature and buzzer?

Do you have links to the data sheets or part numbers for the
temperature sensor and the buzzer?

R

#### Rich Grise

Jan 1, 1970
0
Hiya, i'm new to this group, so i have no idea where i should post this
thread. So hopefully im posting in the right place.

Anyway, my problem is, i've got to connect a temperature sensor to a
buzzer. Sounds simple? Not so, i've gotta use a driver circuit to
connect the components. The sensor uses TTL logic output, so a driver
circuit has to be used to connect it to the buzzer, which runs on a
3-24V input.

Frankly speaking, i have no idea what i'm supposed to do. I don't know
how to figure out the values of the resistor or what transistor to use

It's part of my final year project, so it's really important that i get
help asap. Will be utterly grateful to anyone who can provide some
help.

If you are in your "final year", then you should take the fail, and
take the course over again from the beginning, but actually attend
class and do the work.

Good Luck!
Rich

O

#### obliquez

Jan 1, 1970
0
The sensor I'm using is a liquid level sensor.

http://content.honeywell.com/sensin...el/100437-en.pdf#search='honeywell lle sensor'

I am supposed to connect it to a buzzer, I've got 2 coz i'm not sure
which is more suitable.

http://sg.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=3921177&N=0

http://sg.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=3921189&N=0

Basically, I'm supposed to incoporate these components into a
container. When liquid is poured in, up to a certain level, the sensor
will 'sense' it, and the buzzer is supposed to sound.

Is this enough information?

My teacher said that since the sensor uses TTL Logic, I can't connect
the buzzer directly to the sensor. I have to use a driver circuit. And
that's where my problem lies.

Thanks

O

#### obliquez

Jan 1, 1970
0
I did attend classes, but for final year project, alot of information
are not in our syllabus. =( So i've gotta find it from other sources.

My teacher asked me to search the web instead. So that's why I'm here.

Anyway thanks, I need all the luck i can get.

Thank you John as well..

-smiles-

J

#### John Popelish

Jan 1, 1970
0
obliquez said:
The sensor I'm using is a liquid level sensor.

http://content.honeywell.com/sensin...el/100437-en.pdf#search='honeywell lle sensor'

I am supposed to connect it to a buzzer, I've got 2 coz i'm not sure
which is more suitable.

http://sg.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=3921177&N=0

http://sg.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=3921189&N=0

Basically, I'm supposed to incoporate these components into a
container. When liquid is poured in, up to a certain level, the sensor
will 'sense' it, and the buzzer is supposed to sound.

Is this enough information?

My teacher said that since the sensor uses TTL Logic, I can't connect
the buzzer directly to the sensor. I have to use a driver circuit. And
that's where my problem lies.

Thanks

I don't think you need any additional parts except a 9 volt battery.
The sensor can operate from any supply between 5 and 12 volts. It
outputs a logic high (the positive supply voltage) when in air and a
logic low (negative supply voltage) when submersed. They have 3
leads. The red lead connects to battery positive, the blue to battery
negative and the green is the output.

If your buzzers are self oscillating (they make a tone, not just a pop
when connected to a 9 volt battery, red lead to positive) then all you
need to do is connect the black lead to the sensor output and the red
lead to the battery positive. Either buzzer should draw less than the
output current rating of 10 mA with a 9 volt supply.

J

#### Jonathan Kirwan

Jan 1, 1970
0
I don't think you need any additional parts except a 9 volt battery.
The sensor can operate from any supply between 5 and 12 volts. It
outputs a logic high (the positive supply voltage) when in air and a
logic low (negative supply voltage) when submersed.

Interestingly, I came to a confused impression in reading the data
sheet on this part.

"When no liquid is present, light from the LED is internally reflected
from the dome to the photo-transistor. When liquid covers the dome,
the effective refractive index at the dome-liquid boundary changes,
allowing some light from the LED to escape. Thus the amount of light
received by the photo-transistor is reduced and the output switches,
indicating the presence of liquid."

Since the diagram shows the photo-transistor connected one side to
ground (so it pulls low harder when more light is presented to it) and
since the Schmidt trigger isn't shown as an inverter, I tended to
conclude that the input node to the Schmidt was lower when more light
was present (which is when there is no liquid presented to the surface
of the detector.) And that, thus, the output would be low, as well,
at this time.

some data sheets don't get the exact details of the logic right in the
diagram (inverter vs non-inverting, for example) and the other is that
the data sheet does specify the "output sink current" but not the
"output source current," which suggests strongly to me just as you
say, above.

It wasn't until I went elsewhere on the web that I discovered that you
are exactly correct about the output.

They have 3
leads. The red lead connects to battery positive, the blue to battery
negative and the green is the output.

If your buzzers are self oscillating (they make a tone, not just a pop
when connected to a 9 volt battery, red lead to positive) then all you
need to do is connect the black lead to the sensor output and the red
lead to the battery positive. Either buzzer should draw less than the
output current rating of 10 mA with a 9 volt supply.

Several things mitigate against this solution, I think. Most
importantly, this is a project and is probably designed to _show_ some
modest proficiency. Not much, I fear. But at least some. Just
getting lucky by hooking up a buzzer device to an output described
this way,

"The output is intended as a TTL compatible output signal, for
interfacing to logic systems. For interfacing with other types of
circuitry an appropriate buffer circuit must be used."

....would probably be violating the spirit of the project.

I suppose, if being fractious about it, I could also point out that
the two buzzers specify a maximum of 8-10mA and the sensor specifies a
worst case (at 80 C) of 3mA sinking drive and that any design that
depends on the accident of these matching up might be "graded down" a
bit. Also, since the OP actually says, " I don't know how to figure
out the values of the resistor or what transistor to use for the
driver circuit," I tend to assume that this is what the teacher
intends to be used in the design.

(The buzzer also specifies a nominal 12V. I suppose it can run on 5V,
but I wonder if the purpose of this is to also get the OP to actually
do a reasonable solution using two supplies, one at 5V and one at 12V.
No idea there, and no big deal either way, but it is a question that
crosses my mind.)

Finally, _if this is an electronics degree program__, I have a hard
time understanding how such a simple interface escapes what I'd
imagine should have been the appropriate training and the acquired
knowledge in the "final year." The solution seems non-critical in
nearly every regard and I have a hard time understanding how they
haven't they discussed BJT transistors operated as simple switches. I
begin to wonder things like, "what year is the 'final' year?" and
"what is this degree actually in?" and "what school, for gosh sake?"

Jon

J

#### Jonathan Kirwan

Jan 1, 1970
0

Damn spell-checker! I typed Schmitt and it "fixed" it for me!

Jon

O

#### obliquez

Jan 1, 1970
0
Jonathan said:
Interestingly, I came to a confused impression in reading the data
sheet on this part.

"When no liquid is present, light from the LED is internally reflected
from the dome to the photo-transistor. When liquid covers the dome,
the effective refractive index at the dome-liquid boundary changes,
allowing some light from the LED to escape. Thus the amount of light
received by the photo-transistor is reduced and the output switches,
indicating the presence of liquid."

Since the diagram shows the photo-transistor connected one side to
ground (so it pulls low harder when more light is presented to it) and
since the Schmidt trigger isn't shown as an inverter, I tended to
conclude that the input node to the Schmidt was lower when more light
was present (which is when there is no liquid presented to the surface
of the detector.) And that, thus, the output would be low, as well,
at this time.

some data sheets don't get the exact details of the logic right in the
diagram (inverter vs non-inverting, for example) and the other is that
the data sheet does specify the "output sink current" but not the
"output source current," which suggests strongly to me just as you
say, above.

It wasn't until I went elsewhere on the web that I discovered that you
are exactly correct about the output.

Several things mitigate against this solution, I think. Most
importantly, this is a project and is probably designed to _show_ some
modest proficiency. Not much, I fear. But at least some. Just
getting lucky by hooking up a buzzer device to an output described
this way,

"The output is intended as a TTL compatible output signal, for
interfacing to logic systems. For interfacing with other types of
circuitry an appropriate buffer circuit must be used."

...would probably be violating the spirit of the project.

I suppose, if being fractious about it, I could also point out that
the two buzzers specify a maximum of 8-10mA and the sensor specifies a
worst case (at 80 C) of 3mA sinking drive and that any design that
depends on the accident of these matching up might be "graded down" a
bit. Also, since the OP actually says, " I don't know how to figure
out the values of the resistor or what transistor to use for the
driver circuit," I tend to assume that this is what the teacher
intends to be used in the design.

(The buzzer also specifies a nominal 12V. I suppose it can run on 5V,
but I wonder if the purpose of this is to also get the OP to actually
do a reasonable solution using two supplies, one at 5V and one at 12V.
No idea there, and no big deal either way, but it is a question that
crosses my mind.)

Finally, _if this is an electronics degree program__, I have a hard
time understanding how such a simple interface escapes what I'd
imagine should have been the appropriate training and the acquired
knowledge in the "final year." The solution seems non-critical in
nearly every regard and I have a hard time understanding how they
haven't they discussed BJT transistors operated as simple switches. I
begin to wonder things like, "what year is the 'final' year?" and
"what is this degree actually in?" and "what school, for gosh sake?"

Jon

Wow, I'm sorry, but i don't quite get it. Are you saying that i don't
need a buffer circuit? I can just connect the sensor directly to the
buzzer? Coz my teacher insists that i do need a driver circuit. Hence
all the questions.

I am not an undergrad. I'm not getting a degree. Where I'm from, we
have schools called Polytechinics (17-19 yr olds). So i'm not sure
what's it equivalent to in your country. =)

O

#### obliquez

Jan 1, 1970
0
Erm, I'm using a 9V battery for testing. But in the final prototype, i
have to use those kinda flat batteries, like for watches?

So do i not need a driver circuit for this? But it is part of the
requirement of my project..

He says that since the sensor output is TTL logic, the buzzer cannot be
directly connected. A driver circuit must be used.

Thanks!

J

#### John Popelish

Jan 1, 1970
0
obliquez said:
Wow, I'm sorry, but i don't quite get it. Are you saying that i don't
need a buffer circuit? I can just connect the sensor directly to the
buzzer? Coz my teacher insists that i do need a driver circuit. Hence
all the questions.

There was an "if" in that advice. I can't tell from the catalog page
whether or not the buzzer is a unit that includes the driver or if it
is just a simple transducer. Touch its two leads to a 9 volt battery
and see if it pops or buzzes. If it buzzes, it includes the driver.
If it pops, than we have to come up with an oscillator driver circuit
that can be switched on or off by the output from the sensor.
I am not an undergrad. I'm not getting a degree. Where I'm from, we
have schools called Polytechinics (17-19 yr olds). So i'm not sure
what's it equivalent to in your country. =)

doubtful that I got the right sensor data. Your link locked up my
computer, so I searched Honeywell for an LLE sensor and picked the
first one on the list. Please send the part number of the device you
are using, so I can check what I told you.

J

#### John Popelish

Jan 1, 1970
0
obliquez said:
Erm, I'm using a 9V battery for testing. But in the final prototype, i
have to use those kinda flat batteries, like for watches?

So do i not need a driver circuit for this? But it is part of the
requirement of my project..

He says that since the sensor output is TTL logic, the buzzer cannot be
directly connected. A driver circuit must be used.

Thanks!
Find out if he is right by testing the buzzer on the battery and see
if it includes the driver or not.

J

#### Jonathan Kirwan

Jan 1, 1970
0
There was an "if" in that advice. I can't tell from the catalog page
whether or not the buzzer is a unit that includes the driver or if it
is just a simple transducer. Touch its two leads to a 9 volt battery
and see if it pops or buzzes. If it buzzes, it includes the driver.
If it pops, than we have to come up with an oscillator driver circuit
that can be switched on or off by the output from the sensor.

It's a two-wire device. My usual encounter with these piezos (and my
experience *is* limited) is that the three-wire piezos require a
driver circuit and that some of the two-wire versions are just 3-wire
devices with a simple circuit in them. (The 3rd wire is for feedback
into a simpler circuit than could be used with those 2-wire devices
which don't have a built-in circuit.)

I also couldn't tell from the data sheet, though. Not for sure. But
my casual reading suggested that it might be one of those not needing
an extra circuit to drive them at the 3.5kHz rate. But that's just a
hunch.

Jon

J

#### Jonathan Kirwan

Jan 1, 1970
0
Wow, I'm sorry, but i don't quite get it. Are you saying that i don't
need a buffer circuit? I can just connect the sensor directly to the
buzzer? Coz my teacher insists that i do need a driver circuit. Hence
all the questions.

You probably _are_ supposed to use a driver circuit. Even if the
piezo only requires a constant voltage to be applied in order to work.
Even if it performs reasonably well when tried, I have a hard time
believing that the teacher would want you to simply connect the two
without a driver circuit.
I am not an undergrad. I'm not getting a degree. Where I'm from, we
have schools called Polytechinics (17-19 yr olds). So i'm not sure
what's it equivalent to in your country. =)

Ah. Thanks for that. I figured it might be my own assumptions that
were the problem. We don't have the exact equivalent here in the US,
though it sounds about like "going to community college" to me. My

....

So, can you first say if you are allowed to use two different supply
voltages from a bench supply to run your circuit? Also, do you
already know for sure which level is used by the sensor output signal
line for the case when the liquid covers it? I sort of believe John's
thought that it is LO when covered and HI when not covered, but I'm
just not sure anymore.

Has the teacher taught you much about BJTs? If so, can you describe a
little of how you think about them? It will help a lot when writing a

Jon

C

#### Chris

Jan 1, 1970
0
obliquez said:
I did attend classes, but for final year project, alot of information
are not in our syllabus. =( So i've gotta find it from other sources.

My teacher asked me to search the web instead. So that's why I'm here.

Anyway thanks, I need all the luck i can get.

Thank you John as well..

-smiles-

Hi. The Honeywell LLE sensor has a built-in LED and phototransistor.
Both of them are pointed out towards the lens, which is mounted so as
to come in contact with a clear liquid. When liquid contacts the
surface, some of the LED light which normally would be reflected back
to the phototransistor escapes into the liquid. This is sensed by the
phototransistor, which turns on. The LLE sensor operates on a 5VDC
supply, and has an open collector schmitt trigger output which can sink
up to 10mA at 25 degrees C, and 3 mA at 80C.

The piezo beeper you've chosen has a self-oscillating circuit built in
(usually the tipoff is if the data sheet specifies a DC voltage vs.
current or sound output level). However, your piezo beeper is
specified as operating on 12VDC, which is a bit of a problem, unless
you happen to have both the +5 and +12VDC supplies handy. If I were
doing this, I'd use a 5VDC piezo beeper to save a lot of hassle. It's
always easier if you can use one power supply instead of two. But,
it's your project, and you know what's best. So...

Let's look at the driver and interface circuitry. I'm assuming you
want the beeper to go on when liquid comes in contact with the sensor
lens. That means you want something which will go ON when the sensor
output is sinking current. Since there's nothing in the datasheet
about the sensor output transistor being able to handle a higher
voltage than 5V (although many do), let's assume it can't. If you had
a spare inverting logic gate, you could do something like this (view in
fixed font or M$Notepad):   +12V  +  +5V +5V |  + + / \  | | (BZ1)  Red| .-. \_/  .---o---. | |10K |  | | | | |  | | '-' |  | LLE | | |\ ___ |/  | Sensoro--o--| >O--|___|- -| 2N3904  | |Grn |/ 10K | |>  | | .-. |  | | 10K| | |  '---o---' | | |  Blue| '-' |  | | |  | === ===  === GND GND  GND created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de Note that a pullup resistor is required at the output of the sensor to give you your +5V/0V logic levels. The output is active low -- that is, it goes to 0V when the sensor is ON. You reverse that with the inverter. The output of the inverter then sources about 1/2 mA of current into the base of the NPN transistor, which then turns on to sink the 10mA or so for the piezo buzzer. This should do the job for you. If you don't happen to have any inverter logic gates handy (note that a NAND or NOR gate can work just as well here), you'll have to use another transistor to provide that inverting action:   +12V +12V  | +  +5V +5V .-. |  + + | |10K / \  | | | | (BZ1)  Red| .-. '-' \_/  .---o---. | |10K | |  | | | | o--. |  | | '-' | | |  | LLE | | ___ |/ | |/  | Sensoro--o-|___|-| '-----o-| 2N3904  | |Grn 10K |> | |>  | | | .-. |  | | | 10K| | |  '---o---' === | | |  Blue| GND '-' |  | | |  | === ===  === GND GND  GND created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de You can see that when the first transistor turns ON (base current is coming from the pullup because your sensor is OFF), it steals the base current from the second transistor, which means your piezo buzzer will be off. When the sensor turns ON, it prevents base current from getting into the first transistor, so the other transistor is turned on by the other pullup. This isn't elegant, but it will work for you. If you want to look at a piezo buzzer that works on 5VDC (ferinstance Farnell P/N 3921130), you can simplify things quite a bit:  +5V +5V  + +  | |  Red| .-. +5V  .---o---. | |10K +  | | | | |  | | '-' |  | LLE | | ___ |<  | Sensoro--o-|___|--| 2N3906  | |Grn 10K |\  | | |  | | |  '---o---' |  Blue| |  | / \  | (BZ1)  === \_/  GND |  |  ===  GND created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de When the LLE goes on, it pulls current from the PNP, which turns it ON. That sends current through the buzzer. Hope your project goes well. Feel free to post again if you have any further problems. Good luck Chris O #### obliquez Jan 1, 1970 0 I'm using a Honeywell lle sensor. LLE 105000 (Type 5) Mounts on the inside. I intend to integrate the sensor into the handle of a mug. It is required for me to include a driver circuit in my design. That's what my teacher said. I heard that i can purchase a 3-24V circuit board and get the right components, then connect the sensor and buzzer to it? As in i get the circuit board and the right transistor and resistors? Oh my, I know it's supposed to be really simple to understand, but i'm not a very good student. =( Thanks you guys for helping me out! =) O #### obliquez Jan 1, 1970 0 Oh, thanks so much.. Frankly speaking, i don't really understand everything you're saying but i get the gist of it. The circuits you drew up for me, seems to be what my teacher is asking for. I will show it to him tommorrow and see what he says. If i can get this driver circuit part out of the way, i will have to go on to the next part, which is to include a temperature sensor and a tilt sensor. So far, i can't find small enough sensors. The temp sensor is to sense liquid temperatures. And the tilt sensor is supposed to deactivate the liquid level sensor. So, when the mug is in a tilted position, even if the liquid covers the lle sensor, the buzzer won't activate. I think i'm very bad at explaining stuff. Let me try again. What i am supposed to do, is to incoporate all these components in a mug. Making it a smart mug. The lle sensor, will go on when the liquid reaches a certain level. Thus, will cause the buzzer to go on as well. The tilt sensor is to deactivate the lle sensor, so that the buzzer will not go on if the mug is in a tilted position. i.e, when it is being washed, etc.. The temp sensor, if the liquid is too hot, the buzzer will sound. I'm not clear about this, but i think i will need another buzzer for this. I have yet to be able to find a suitably small temp and tilt sensor. I thought i could use this for the temp sensor, but i can't find a circuit diagram. Therefore, i can't tell if i can incoporate it into my circuit. http://tsdpl.com/MPT-PROBE.htm Thanks to everyone for all your help! you are all very nice ppl -grinz- O #### obliquez Jan 1, 1970 0 I learned abit about BJTs in my 1st year, but i'm afraid i've forgotten most, if not all of what i have learnt. Because it was only a small little part of a chapter of one of my modules. Lol I will try to get back some of my old books from my friend and see if i can read up on BJTs again. Is that what i need to know about? Since verything has to be intergrated into a mug, i think that i can only squeeze in one supply voltage, And it has to be in the form of those flat round batteries. Maybe i can connect 2 or 3 flat batteries in series or parallel? thanks O #### obliquez Jan 1, 1970 0 Ok, i will. Then i will only be able to get back to you tommorrow night. It's almost 2p.m. here right now. I will go to school tommorrow morning and test out the components. =) J #### Jonathan Kirwan Jan 1, 1970 0 Hi. The Honeywell LLE sensor has a built-in LED and phototransistor. Both of them are pointed out towards the lens, which is mounted so as to come in contact with a clear liquid. When liquid contacts the surface, some of the LED light which normally would be reflected back to the phototransistor escapes into the liquid. This is sensed by the phototransistor, which turns on. The LLE sensor operates on a 5VDC supply, and has an open collector schmitt trigger output which can sink up to 10mA at 25 degrees C, and 3 mA at 80C. That makes complete sense, given the way they spec'd the output. Thanks, Chris. My cursory reading of the data sheet left me absent this detail of the open collector output. Where did you see it explicitly mentioned? The piezo beeper you've chosen has a self-oscillating circuit built in (usually the tipoff is if the data sheet specifies a DC voltage vs. current or sound output level). Good point. However, your piezo beeper is specified as operating on 12VDC, which is a bit of a problem, unless you happen to have both the +5 and +12VDC supplies handy. If I were doing this, I'd use a 5VDC piezo beeper to save a lot of hassle. It's always easier if you can use one power supply instead of two. But, it's your project, and you know what's best. So... Let's look at the driver and interface circuitry. I'm assuming you want the beeper to go on when liquid comes in contact with the sensor lens. That means you want something which will go ON when the sensor output is sinking current. Since there's nothing in the datasheet about the sensor output transistor being able to handle a higher voltage than 5V (although many do), let's assume it can't. I suppose it may be that they include a protection diode to the +5 rail on that output. If you had a spare inverting logic gate, you could do something like this (view in fixed font or M$ Notepad):

 +12V
+
 +5V +5V |
+ + / \
 | | (BZ1)
Red| .-. \_/
 .---o---. | |10K |
| | | | |
 | | '-' |
| LLE | | |\ ___ |/
 | Sensoro--o--| >O--|___|- -| 2N3904
| |Grn |/ 10K | |>
 | | .-. |
| | 10K| | |
 '---o---' | | |
Blue| '-' |
 | | |
| === ===
 === GND GND
GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

Note that a pullup resistor is required at the output of the sensor to
give you your +5V/0V logic levels. The output is active low -- that
is, it goes to 0V when the sensor is ON. You reverse that with the
inverter. The output of the inverter then sources about 1/2 mA of
current into the base of the NPN transistor, which then turns on to
sink the 10mA or so for the piezo buzzer. This should do the job for
you.

Without knowing more, I'd tend to guess that the OP is supposed to do
this with BJTs and resistors.
If you don't happen to have any inverter logic gates handy (note that a
NAND or NOR gate can work just as well here), you'll have to use
another transistor to provide that inverting action:

 +12V +12V
| +
 +5V +5V .-. |
+ + | |10K / \
 | | | | (BZ1)
Red| .-. '-' \_/
 .---o---. | |10K | |
| | | | o--. |
 | | '-' | | |
| LLE | | ___ |/ | |/
 | Sensoro--o-|___|-| '-----o-| 2N3904
| |Grn 10K |> | |>
 | | | .-. |
| | | 10K| | |
 '---o---' === | | |
Blue| GND '-' |
 | | |
| === ===
 === GND GND
GND
`created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

You can see that when the first transistor turns ON (base current is
coming from the pullup because your sensor is OFF), it steals the base
current from the second transistor, which means your piezo buzzer will
be off. When the sensor turns ON, it prevents base current from
getting into the first transistor, so the other transistor is turned on
by the other pullup.

This isn't elegant, but it will work for you.
<snip>

: +12V
: |
: |
: / +12V
: \ R2 |
: / 47k |
: | |/e 2N3906
: +--------| Q2 PNP
: | |\c
: |/c 2N3904 |
: +5V +5V---| Q1 NPN |
: | |\e |
: Red | | |
: | | / \
: ,-------, / (BZ1)
: | | \ R1 \_/
: | LLE | / 22k |
: | Sensor| | |
: | |--------' |
: | | Green gnd
: '-------'
: |
: Blue |
: |
: gnd

Two fewer resistors, even. Make them both 22k, if two different
values is bothersome. And just nail Q1's base to the 5V wall and yank
down on its emitter. This will drive Q2's base just fine and turn on
the buzzer.

Jon

Replies
4
Views
137
Replies
2
Views
812
Replies
1
Views
484
Replies
22
Views
4K
Replies
12
Views
3K