# Would this button trigger alarm circuit work?

This is a dead easy question for most of you! But I'm relatively new to circuit design, so I'd just like to ask whether this circuit might work (at all!)

Here's a picture of the circuit

Basically, what it's trying to do is if the push to make switch is NOT triggered, then it should sound the buzzer, and light the LED. When the push to make switch IS triggered, then it does nothing. The toggle switch on top triggers whether the circuit is running or not, as checked by the AND gate.

It's meant to be an alarm for something of value, ideally, the push to make switch is under a glass cube that encases the item, when the glass cube is moved, the alarm sounds!

Specific components aren't really needed at the moment, in generalized terms, would this circuit do the job it's trying to do? Or would it fail miserably!

Also, if you don't understand my horrible drawing, then:

• The two circles with the line on top, is the push to make switch
• The triangle is the op amp (comparator)
• The bent line connected to 2 circles on the top is the toggle switch
• The box with 1 rounded edge is the AND gate
• The rounded triangle on the right is a buzzer
• The thin rectangle is a resistor
• The ugly LED symbol is the LED.

Thanks for any and all responses!

Cheers,

Karan

You are making this way too complicated. You don't need a opamp and a logic gate to perform your very simple logic. The on/off switch can simply be wired in series with the supply and act like a normal on/off switch. The inversion you want from the momentary button can be accomplished by a single transistor:

Q1 acts like a low side switch, with R2 providing it's base current and thereby keeping it on. When SW1 is pressed, it shorts the base to ground, which turns off Q1. The LED and buzzer are wired in parallel, not in series as you had them. It is unlikely both need the same amount of current. The LED will have about 10mA thru it when on, which lights a ordinary LED bright enough for most purposes.

Nearly the full 12V will be applied to the buzzer. You didn't say what voltage the buzzer was rated at, so I picked 12V just for example. That's a common voltage for buzzers, but they are certainly available in other voltages too. Some buzzers can appear inductive from the outside circuit point of view, so D2 protects the circuit from the inductive kickback when the buzzer is turned off. Buzzers can also make a lot of high frequency electrical noise. C1 is there to shunt most of that locally to reduce the radio interference and other bad effects from this.

What Oli said, and:

Constructive comment:

"Just conceptual" is understood BUT if too conceptual then actual required details may be missed.

Opamp inv/non-inv inputs should be labelled.

OA input to ground MUST instead have a voltage divider.

AND gate input should not be assumed to float* to level of your choice when O/C.

Put buzzer in parallel with LED+R.
LED in series with buzzer reduces available buzzer voltage and sets max current to LED limit.

Opamp output current drive will be small usually.
Buffer a good idea (1 transistor emitter follower often enough.
Intention understood - BUT switch cct shorts supplies.

Many free cct dwg packages available. Or hand draw.

"Floating" pins:

A "floating" connection (usually an input) is one which has nor formal drive and so whose value is dependent on leakage currents or on unspecified circuit characteristics.

In this case, the "upper" input to the AND gate is high when the switch is closed but is undefined when the switch is open.

You need a "pull down" resistor from AND input to ground to be sure this happens. Oli has shown this as R5.

SOME logic families do "float" to predefined conditions (eg true bipolar TTL float high) but most CMOS families are undefined. Minor leakage paths can define what a floating CMOS input does and stray capacitance may hold them in one or other state for a considerable period until leakage changes them, making operation unpredictable.

You may "prefer" Paint, even though it is harder to do a good job with it than by using some of the free packages available that are made for drawing good quality circuit diagrams. That's a personal choice, BUT if you do use Paint, the result has to meet a minimum level to be acceptable. You haven't managed that yet but will be able to do so with due effort. Paint can do this but it is harder to do than when using a "proper" tool.

• You make a good point! :) I've right now kept it as minimal as possible, cause I haven't got any specifics for sensitivity! :S Oh yeah, haha I forget about this, I assume the top is usually a positive input leg for the opamp, may I ask, sorry! what is the float? :S Yeah, I've just thought about that! haha! Thank you very much for that! My assumption is a 9 Volt input (atm!) I may attach the transistor once I breadboard it! :) Yep, haha, I like paint :) Cheers, Russel :) Thanks alot! – unicornication Dec 26 '11 at 11:06
• A "floating" connection (usually an input) is one which has nor formal drive and so whose value is dependent on leakage currents or on unspecified circuit characteristics. In this case, the "upper" input to the AND gate is high when the switch is closed but is undefined when the switch is open. You need a "pull down" resistor from AND input to ground to be sure this happens. Oli has shown this as R5. – Russell McMahon Dec 26 '11 at 15:09

Seems overly complex to me. Why all the components?

Why not just two switches?

        S1        - S2     R1      D1
(+)----o===o----o | o--,--\/\/\--(|>|)--,--(-)
===   |                |
---||<----------'
B1
`

This is what is called "Wired And". S1 is a toggle and is the alarm Enable/Disable switch. S2 is normally closed, and the glass cube presses it, thus opening it. R1 and D1 form the visual alarm. B1 is the noisy alarm.

This setup uses absolutely zero current when idle.

• Thanks for your idea! I might consider this if the sleep current is high enough to overheat the circuit over about an hour. :) Haha, also, that's quite a cool diagram! Cheers, Majenko, Thanks alot! :) – unicornication Dec 26 '11 at 11:09

It looks close enough, though I have a couple of suggestions:

The opamp/comparator is not really necessary, a simple pullup resistor attached from V+ to the AND gate input, with button connected from same input to ground would do.
Since the button will be normally closed, a high value resistor should be used to stop excessive current consumption. I would say 1 Megaohm should do okay.
Of course if you want to avoid any consumption (under normal conditions) then you could use a NAND gate with normally closed switch (push to break) instead.

Note the on/off switch would be opposite logic for the NAND gate option. You will need a pull down resistor from the other AND input to ground (for either option) to prevent it from floating when the switch is open.

Also, make sure whatever the LED current is set at is enough to drive the buzzer (but not to blow the LED :-) )

EDIT - I just noticed the left side of your button appears to be connected to both +V and Ground. This would not be a good idea ;-)
I'm assuming you meant button connected to V+ only.

If using the opamp/comparator, the - input should be high than 0V to allow the + input to swing above/below it and change the output. Halfway between V+ and ground should do - use a voltage divider here (e.g. 2 100k resistors)

EDIT2 - The below circuit is an example of how to do things using the components you specify:

Ignore the extra inputs on the AND gate (they are not really grounded, it's to tell SPICE they are not included so it thinks it's a 2 input AND gate)
Also ignore the +- inputs on the switches (they are voltage controlled switches, SPICE doesn't have "normal" switches - e.g you can simulate pressing with a voltage to these inputs)
The buzzer is not shown, just an LED with Vf of 2V, but you can adjust this as necessary. Wiring in parallel as Russell suggests is liable to be the best way of doing things.

• Hi! Thanks alot got your feedback! :D The criteria I'm following requires an operational amplifier, which is relatively annoying! Adding in a 1 megaohm resistor would go after the op amp, no? but wouldn't that require a transistor directly after the AND gate? The circuit's only for testing at this stage, so without the NAND gate is fine! haha! Thank you very much for your answer, you deserve many cookies and a +1 if I had enough rep! – unicornication Dec 26 '11 at 9:10
• @KaranK - Okay, if you need to use the opamp, etc, then forget about the pullup resistor. See edits, I added a circuit that uses your components which should work okay. – Oli Glaser Dec 26 '11 at 10:44
• Wow, thank you, very very much! That's incredibly useful! Cheers! :) Yeah, I thought series wiring would be a bit of an issue with the buzzer! Just out of curiosity, why exactly would you need a voltage divider when ground is technically 0V? Haha, yes I meant to draw it up on V+ but modified it and it stuck on ground D: Cheers, Oli! :) – unicornication Dec 26 '11 at 11:00
• @KaranK - The comparator will only change output when the - input goes above or below the + input. If the + input is wired to ground the - input can't go below it (it can only be at the same voltage which will produce undefined results) – Oli Glaser Dec 26 '11 at 11:09
• Ahh, Thank you! :) I'll make sure to wire the negative rail as is in your diagram! Cheers, Oli! :) – unicornication Dec 26 '11 at 11:11

If you do not need to absolutely minimize current, the approaches given in some other answers will be good. If you do need to minimize current, then you should design or implement a circuit which will periodically produce a "high" pulse through a resistor to one side of the switch while the other side is grounded (a microcontroller could be good for this, though it wouldn't be the only approach). If the side of the switch the resistor goes high, the switch is open. Using this approach may allow one to achieve sub-microamp quiescent currents even if the switch itself would hundreds of microamps of leakage. For example, if one were to pulse the switch with 1mA for 10 microseconds, ten times per second, the average current through the switch would only be 100nA. The controller would add a little more leakage, but the total could probably still be kept under 1uA. Polling the switch more frequently would increase the current required; polling it less frequently would decrease the current.