Nand logic gate problem

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi all, I've built a circuit that will sound a buzzer if fridge doors havent been closed properly.
The circuit diagram that I was working from has only allowed for a fridge with one door.
To incorporate a second door I was going to use a relay, but thought it would be better to use the spare nand gates on my cd4011be IC, that would operate a second bc547 npn bi polar junction transistor to sink current to ground.
Problem is when I connected everything up and opened the circuit at either pin 8 or 9 pin 11 would always output a voltage of around 2.5. This should be low as pin 12 and 13 would be high. Note that when pins 8 and 9 are high pin 11 is also high as it is supposed to be ,5v present.
So can anyone answer why there is a voltage present on pin 11 when it's logic state says it should be low.
Have included a wiring diagram, this is how it is connected on my breadboard. Checked all connections and components all ok .
Appreciate any advice. 1461084082924726564762.jpg
 

Alec_t

Joined Sep 17, 2013
14,280
I haven't checked through the logic of your circuit, but you should have a respective pull-down resistor (say ~ 33k) to ground from each of pins 8 and 9. Leaving logic pins floating (when a switch opens) can lead to all sorts of weirdness.
 

WBahn

Joined Mar 31, 2012
29,976
As Alec_t pointed out, the first problem is that you allow floating inputs to a CMOS logic gate. This is a "bad thing"? Take care of that first, then see if your circuit is till misbehaving.

Also, are you sure that diode across your buzzer is oriented the right way?
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Thanks for replys, will fit resistors to pins 8 and 9. Should have shown that diode is an led, it will flash when buzzer sounds. There was no resistor in series with led on original wiring diagram, is this ok?
 

cmartinez

Joined Jan 17, 2007
8,218
There was no resistor in series with led on original wiring diagram, is this ok?
You need to place a resistor in series with that LED, otherwise it will shine real bright a few times, and then "kablooey"! Something in the range of 240 to 330 ohms should be enough.
 

dl324

Joined Mar 30, 2015
16,839
Should have shown that diode is an led, it will flash when buzzer sounds. There was no resistor in series with led on original wiring diagram, is this ok?
The LED needs a current limiting resistor.

Is the buzzer really a buzzer or is it a speaker. A buzzer would require a constant voltage. A speaker would reproduce the frequency from the oscillator.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Thanks for all replys, placed 33k resistors from inputs 8 and 9 to ground and output is now correct going high and low depending on logic.
Also pin 12 is an input that remains high, it will never go low, so I think there is no need for resistor, am I correct?

I thought led would need a resistor, although it has been working ok without one, prob burn out prematurely though, will make room for resistor on pcb.
There is a buzzer in circuit, it's a basic 5v 85db two pin think they are a common type.
 

dl324

Joined Mar 30, 2015
16,839
There is a buzzer in circuit, it's a basic 5v 85db two pin think they are a common type.
If it's a buzzer, you don't need the oscillator. You also don't need the transistor on the left or the resistors connected to it.

Is the 4.7uF cap for noise suppression?
Edit: Time delay...
 
Last edited:

WBahn

Joined Mar 31, 2012
29,976
Thanks for all replys, placed 33k resistors from inputs 8 and 9 to ground and output is now correct going high and low depending on logic.
Also pin 12 is an input that remains high, it will never go low, so I think there is no need for resistor, am I correct?
Yes, though some people consider it good design to never connect inputs directly to power rails, but rather to always use series resistors. I've heard a few different reasons and they seem rather marginal (at least the ones I can recall of the top of my head). For your purposes you should be fine.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
I think the 4.7 micro farad cap is charging up when the transistor on left is turned off, the cap will pull current from source through the two resistors, this will send pin 1 high and sound buzzer through the logic gates.
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 after either pin 8 or 9 goes low, that's how I understand it could be wrong.
Also I think the transistor on left is needed to sink current from mid point of two resistors. When turned on it creates a path to ground and keeps pin one low so alarm can't sound. If I take it out of circuit how will I be able to sink current to ground?
The buzzer I'm using is a complete component, about 15mm in diameter, no way of gaining access.
Does the 85db indicate that it has an oscillator, why does it matter?
 

WBahn

Joined Mar 31, 2012
29,976
If it buzzes when you apply a constant voltage to it, then it is a buzzer. The 85 dB rating is pretty indicative that it is a buzzer, but not a guarantee. Buzzers have their own circuitry, including an oscillator, so that all you have to do is apply power to it and it starts buzzing. A piezo element by itself is more similar to a speaker -- apply a voltage and it distorts as the voltage is applied and then sits there looking stupid. If you want it to make a sound, you need to drive it with a signal waveform that represents the sound you want it to make.

They way you describe how your circuit is working, you have a buzzer.

Is this battery powered? If so, it might be worth reworking the circuit so that you are driving that left hand transistor all the time when the doors are closed. You're looking at about a 1 mA base current draw which, while not much, adds up when it is being drawn 24 hours a day.

Here's a thought -- use the switch to power the right hand side of the circuit and forget the left hand side altogether. Then you aren't consuming ANY power when the doors are both closed.
 

eetech00

Joined Jun 8, 2013
3,858
Is one of the requirements to delay sounding the buzzer for a short period time?
If so, does this need to be adjustable?
For example, if you just peek inside the fridge to see if there's ice cream left over?:D
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi thanks for reply, had thought it would have been wasting energy, didn't know it would be as much as 1ma.
Will go with your idea and parallel the two switches feeding pin one, makes sence
Also would it be best to put a small value bypass cap across the ic?
 
Last edited:

Thread Starter

Copey84

Joined Jul 27, 2015
198
Yes wanted to allow 30second delay from when you open the fridge door until alarm goes of. It's around 35 sec with the resistor arrangement I have. More than enough to see if there's ice cream!
Also thanks for circuit diagrams.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi all, have included new wiring diagram to show changes made, have not shown 0.1 micro farad bypass cap but will fit across ic, should all caps in circuit be of the ceramic type?
Have removed led as circuit will be housed in plastic enclosure and installed out of view, so didn't think there was much point in having it. Should there still be a diode in this circuit? In previous post from eetech00 he has shown a diode in parallel with buzzer not sure why it is needed could someone explain?
Also how does pin 2 remain high when pin 3 is low, logic states that when pin 1 and 2 are high pin 3 will be low, but how then can 2 stay high if voltage supply is turned off at 3? Is the cap helping it stay high?
Sorry for all the questions still new to electronics, just put together a few circuits now an then and trying to learn as I go, appreciate any replys.1461182062132-892836885.jpg
 

WBahn

Joined Mar 31, 2012
29,976
When the switch opens there is nothing to pull pin 1 down (except the unknown leakage current in the capacitor).
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Oh dear, c what you mean when switch is opened there's no way to dump current, should have spotted that.
Might be able to make short to ground through switches. The two switches I am going to use have two ways NO NC, if ground is connect to closed side this should pull pin 1 low and only pull current until cap is empty, I think, could you confirm this would work?
 
Top