# Nand logic gate problem

#### WBahn

Joined Mar 31, 2012
26,304
Quick question: If the alarm is meant to sound when both doors are open, what happens if just one door is slightly open while the other is closed?

And this: If you have a buzzer (I have one on my freezer single door), why not use a micro switch with a Common, a Normally Open and a Normally closed set of contacts? Wire them in series (for two doors) and directly power your buzzer. No need for transistors or resistors or oscillators. I'll bang out a diagram and post it shortly.
As stated earlier in the thread, the TS wants the alarm to sound if either door is open for more than about 30 seconds. He doesn't want the buzzer to annoy him every time he gets something, only when he fails to close the door after a reasonable amount of time.

#### Copey84

Joined Jul 27, 2015
198
thanks for replys, appreciate wiring diagrams think ill go with analog kids second circuit.
Tonyr1084, no real reason for oscillator other than adds bit more interest to circuit.
ak whats the need for c1, also could output connect directly to buzzer without transistor?

#### Tonyr1084

Joined Sep 24, 2015
5,249
The time it takes alarm to sound can be varied by changing the resistor values, with 8.2Mohm and 4.7kohm the alarm sounds around 35sec
OK, this wasn't mentioned until post #11. Sorry I missed that. I'm a simple guy with simple ideas. OK, maybe that makes me a simpleton. Oh well. I am what I am. If I were to build this I'd definitely follow AK's last circuit because of the built in delay before the alarm starts annoying you enough to shut the doors. But I'd probably use the 4049 (U1a & U1b) as a buffer so that the buzzer won't slowly trigger. And I'd trigger it through either a BJT or an FET.

#### Copey84

Joined Jul 27, 2015
198
having looked at circuits again think ill go with aks first circuit.
Its more energy efficient not sinking current all the time, and i have the 4093 ic he specified.
one last thing are pins 8 and 9 just connected to ground when switch is closed to stop them from floating. would it be better to have resistors on them? its only inputs that cant be left floating, are outputs ok been left?

#### AnalogKid

Joined Aug 1, 2013
8,700
A pulsating alarm is much harder to ignore, for the same reason a flashing light is more attention-getting.
For most logic families, unused outputs can be left unterminated. For all logic families, unused inputs must be terminated. For CMOS, direct connections to either rail are ok.
C1 is the power supply decoupling capacitor for U1. If the sounder is an electromechanical buzzer (as opposed to a piezo beeper), it should have its own decoupling cap close to its pins.
The buzzer won't slowly trigger. Each 4093 input has hysteresis, which is why it handles slow inputs without any other buffering.
The entire circuit also could be done with a 40106 hysteretic hex inverter. Or, if you go with a 74AC14, you can eliminate the drive transistor because the AC output stage can source/sink 20 mA. Depending on the beeper requirements, two or three inverters in parallel probably could drive it directly. Hmmm... Lotsa options.

ak

#### Copey84

Joined Jul 27, 2015
198
the buzzer is 30ma rated so with the 4093 ic would it be best to keep tranistor in circuit. also what would be max current circuit could turn on, just incase i decide to increase size of buzzer.

#### eetech00

Joined Jun 8, 2013
2,050
Here's a version that uses all four gates. When either door opens, it starts a ~30 second timer.
If both doors close before time runs, timer stops. If either door is open longer than 30 seconds,
buzzer starts. If both doors are then closed, buzzer stops. R4 can be adjusted for longer or shorter time.

Also, a 0.1uf cap will be needed from the +supply pin of the 4011 to ground.

#### Attachments

• 43.1 KB Views: 10
Last edited:

#### AnalogKid

Joined Aug 1, 2013
8,700
Here is an alternate version based on AC gates. This is about as low as the body count can go, but it is limited to 5 V operation only.

ak

#### Attachments

• 13.7 KB Views: 1

#### Copey84

Joined Jul 27, 2015
198
Hi all, have been looking at the circuit for fridge alarm again, its the first one the analogkid drew up, post 36 if anyone's interested. Anyway got a few more questions about the circuit that I was hoping you knowledgeable people could answer.
What is the need for R2 at 1.0Mohm and D3? As I understand when doors open 11 goes high through the diode D3 and charges C2 at 33micro farad's, this I assume sends pin 1 high after about 30sec which sounds alarm. When doors are closed 11 goes low and can sink current to ground, therefore C2 is discharged, is D3 there to protect the IC, and why is R2 there, it's not in series with cap so how can it affect timing?
When pin 1 and 2 go high, 3 obviously goes low along with pin 5 an 6, this then allows pin 4 to go high which charges C3 and activates the buzzer. Does the oscillation occur when C3 charges fully causing the cap to change polarity and send pin 2 high again. Basically is the oscillation created by pin 4 and 2 going high and low through C3 charging and discharging?
The cap C1 is for decoupling, i think, is this to protect the buzzer from the 1hz signal that has been created?
Also I'm going to order caps to suit circuit, only have small value ceramics, will multilayer ceramics suit C1 and C3?
Hope someone can answer these questions as I would really like to fully understand this circuit before I go any further. Look forward to replys.

#### AnalogKid

Joined Aug 1, 2013
8,700
Hi all, have been looking at the circuit for fridge alarm again, its the first one the analogkid drew up, post 36 if anyone's interested. Anyway got a few more questions about the circuit that I was hoping you knowledgeable people could answer.
What is the need for R2 at 1.0Mohm and D3? As I understand when doors open 11 goes high through the diode D3 and charges C2 at 33micro farad's, this I assume sends pin 1 high after about 30sec which sounds alarm. When doors are closed 11 goes low and can sink current to ground, therefore C2 is discharged, is D3 there to protect the IC, and why is R2 there, it's not in series with cap so how can it affect timing?
R2 is in series with the turn-on-delay timing capacitor C2 and Vcc. It is what charges up C2. The diode does not charge up the capacitor because it is reverse biased when the fridge door opens. The diode acts as a switch. When the doors are closed, pin 11 is low and D3 cathode is near GND. This holds the voltage across the cap at around 0.6 V, low enough to be seen as a logic 0 by pin 1. When a door opens, pin 11 goes high. Now D3 is reverse biased because the anode still is at 0.6 V but the cathode is near Vcc. This allows C2 to charge up toward Vcc through R2.
When pin 1 and 2 go high, 3 obviously goes low along with pin 5 an 6, this then allows pin 4 to go high which charges C3 and activates the buzzer. Does the oscillation occur when C3 charges fully causing the cap to change polarity and send pin 2 high again. Basically is the oscillation created by pin 4 and 2 going high and low through C3 charging and discharging?
Yes. To be clear, charging/discharging C3 and activating/deactivating the buzzer are two separate, unrelated actions, both caused by pin 4 going high.
The cap C1 is for decoupling, i think, is this to protect the buzzer from the 1hz signal that has been created?
No. It is primarily there to assure that U1 sees a very low AC impedance from Vdd to Vss, which is required for proper chip operation. If it is protecting anything, it is protecting U1 from electrical noise generated by the buzzer, not the other way around.
Also I'm going to order caps to suit circuit, only have small value ceramics, will multilayer ceramics suit C1 and C3?
Yes.

ak

#### Copey84

Joined Jul 27, 2015
198
Thanks ak, is R2 then constantly pulling current to ground through D3 and pin 11 when doors are closed, then when they open 11 goes high switching diode, this then breaks path to ground so cap charges through R2, which sends pin 1 high around 30sec?

#### AnalogKid

Joined Aug 1, 2013
8,700
Thanks ak, is R2 then constantly pulling current to ground through D3 and pin 11 when doors are closed, then when they open 11 goes high switching diode, this then breaks path to ground so cap charges through R2, which sends pin 1 high around 30sec?
Yes, although the correct term is that R2 is constant sourcing current. Note that this current is less than 4.5 uA worst case.

ak