4 digital Logic Gates Just Using Transistors, AND,NAND,NOT,NOR, and a simple flip flop circuit

There are times when you want to incorporate some basic logic into your designs but your
available pcb space is limited, or maybe you would like a cheaper alternative to the more costly IC option.

Transistors used in these circuits can be any npn transistor such as BC547, BC548, BC549, 2N3904 etc.

Diodes can be almost any type so long as they can handle the reverse voltages in your design.
LED's were only used to provide a visual reference to show these circuits in action.

Experiment on breadboard first before you use any of the circuits shown, All were tested before
publishing and All of the component values can easily be played around with to meet your needs.

inputs can be virtually any signal source from timers to oscillators and more, or even push
buttons and reed switches and so on.

I came up with these circuits back in 1995 when i studied Electrical Engineering in college,
i quickly moved onto microprocessors so i never got a chance to put these designs into practice
apart from a test probe below which uses my NOT gate design, so i would love to hear any ideas
you have or maybe you are putting one into practice right now, please let me know.

2 input AND Gate
Both inputs need to be high to switch the output on.

2 input NAND Gate
Both inputs need to be on to switch the output off, if both inputs are high then the output is low.
Both Diodes are needed to prevent feedback, The input resistors could be lower values if used
in a lower voltage circuit or input voltages are less than 9v.
The 220 ohm and 500ohm resistors are required to make the circuit switch on and off.
The 1K Base resistor could be changed for a variable resistor to create a variable output voltage.

NOT Gate
The result is the opposite of the input, if the input is high then the output is low,
somtimes called an inverting buffer, although buffers generally have a high output voltage
compared to standard logic gates.

2 input NOR Gate
Output is high until one or more of the inputs are used.
More inputs can easily be included, as you can see the inputs share the same transistor base,
you may need to add diodes to each input if you need to prevent any feedback or if you come
across any problems, if there are switching errors you could also change the resistor values
for each input, the 2 existing diodes are there to prevent basic switching errors.

::  A Simple Practical Useful application with the NOT Gate above ::
::  Test Probe / Continuity Tester ::

Every now and again you may need to test a circuit board for short circuits or broken tracks

The probes can either be a pair of crocodile clips or purpose made probes which you should be
able to source from any good component supplier, if you wanted you could even integrate them
onto the PCB with the rest of the circuit.

I designed this circuit to run on 2 AA or AAA batteries but you could also use a 3V button cell
commonly used for car remote key fobs, do as much testing as you can before any sensitive
components are fitted, although there is only around 800mv to 1.5v running through
the probes, its better to be safe than sorry.

When the circuit is live, the red LED is lit but when the probes come into contact with a solder
bridge or a short circuit is found, the red LED switches off and the green one lights up.
Other fault checking could include broken tracks, in which case the led will remain red
and aid in tracking down the problem areas.

How it works is fairly simple.
The transistor connected to the red LED will only stay on while there is no contact between the probes,
as soon as the second transistor is switched on, there isn't enough power for the first one so it switches
off, The 220 ohm resistor helps block the power to the first base while it flows into the second transistor
which is now switched on.

I am working on a simple cheap Analog to Digital Converter at the moment so if you would like to
see it and some other great stuff please click the follow button to keep an eye on my future instructables.

<p>A Big Thanks to everyone who has viewed and commented on this Instructable.</p><p>Just <br> a quick update really on this topic, and to let you all know that i <br>recently redesigned these circuits to work on less power, and use less <br>components. </p><p>Although the new ones aren't ready to view yet, i am <br>hoping to create some proper circuit designs along with some photos, <br>maybe videos too and do a massive update.</p><p>Although this could be <br>months away yet, I've really been inspired by so many people on YouTube, <br> and i want to create a channel with regular uploads,<br>i have lots of <br>my own designs and ideas that aren't on here yet, and i think everyone <br>would appreciate seeing things working before they have a go too.</p><p>here's a quick CAD Snapshot of the new designs, they still need tinkering with but they're nearly ready.</p>
<p>what is the circuit diagram of or gate sir for project only</p>
<p>Hello, Potts.</p><p>I made a wonderful device with your circuits for a project, well referenced as I informed you. Thanks.</p><p>I love this small project. Well done! I'm quite new in electronics, so dont laught at my method of trying to get what I want done. Thanks.</p><p>I was trying to build a circuit that I believe could use a similar principle, but I just couldn't get it to function exactly the way I want. Now, I need a circuit that when powered, it would engage the load to work for a short while and then disengage. </p><p>So I thought of diong something similar to your circuit using NOT logic gate; such that when the capacitor is fully charged, it's supply will power the load (loud alarm sounder) and also will disengage the capacitor from charging, because the base of the NOTing transistor is connected to the capacitor supply. That way, becasue of the required alarm period of about 30 to 60 seconds, the capacitor needs to be one that will be able to keep the alarm sounding loud for that period. </p><p>Ok. In case I'm just complicating issues, what I want to design is a circuit that when it is initially powered, a loud alarm sounds for about 1min before it goes permanently off, even if the power remains, untill the next time the circuit is powered on afresh. But just keeping it simple &mdash; no programming.</p><p>I have thougt of 555 timer, though. But whichever simple circuit would do.</p><p>Thanks, Potts.</p><p>Thanks, anyone. . .</p>
O yeah! I fixed this! But if anyone has another circuit, they could still share.<br><br>Thanks everyone.
<p>Yeah! </p><p>I made it!!</p><p>Big, Big thanks to G. Potts!!!</p>
<p>I really like your tutorial, but I have a question. I measured the output voltage of the not gate with an oscilloscope, the voltage is 2.48v when input is high and 5v when input is low(I am using 5v DC). I am also using a 1N4118 diode, is that the reason?</p><p>Thanks</p>
<p>Although i used the transistors to switch LED's on and off, there will still be a really low voltage at the output, just not enough for the LED to light up. </p><p>The 1k resistor on the base of the second transistor only lowers the emitter output voltage, almost as if the transistor itself was a variable resistor.</p><p>I really need to re-design and test them all properly. and to also show an alternative using chips.</p><p>But for now, if you need a lower output value than 2.48v, you could change the 1k fixed resistor to a higher value variable resistor, you should hopefully then be able to find a value that works for your design.</p><p>I hope this helps.</p>
<p>Please consider These designs as &quot;Free for all&quot; or Open Source if that applies, so hopefully nobody will unfairly copyright them as their own. (i doubt anyone will)</p><p>I don't want to restrict the use in any way, so if you find them useful then please use them whenever you want to.</p><p>If you create an Instructable around any of them, please link to this one and i will do the same for yours on this page. (you don't have to, but it all helps) please let me know if you do.</p>
<p>Why you use 500 and 220 ohm resistor. It is there, obviously to limit current, but why exactly 880 ohm and why one on top and one one bottom. Great work by the way, it helps alot, thanks.</p>
<p>good question thank you. you could use higher or lower values if you want to, lower that 220ohms wasnt switching the leds completely on or off when i tested the circuits, and 220 just seemed to work best with the voltage i used in the circuits, 270 and 300 might be ok too but not tested them.</p>
Good reply here, coz I've been wondering what was your factor of choosing the resistors, and if they could be altered. I found a formula for calculating the resistors to use but when I imputed it with your choices, it didn't match your choices well. Actually, the values of the LED matters a lot, for proper switching. Green, blue and white LEDs have higher voltage reguiremnts (about 3 &mdash; 3.5v) and red, orange, yellow seem to have about 1.8&mdash;2.2v, all for the 5mm LED. They also have current of about 20&mdash;35mA (for both sets).<br><br>Now you have not answered one part of the question by the first asker: why use the resistor up and down (for example,in NAND, NOR and NOT) . Why do you use the 330 with the 500 and not putting a single 830 ohms. <br><br><br>Then, would not the amplification effect of the transistor affect the final current reaching the LED after the resistor? Example: Ie=Ib+Ic (Current at emiiter equals collector current + base current &mdash; all now reaching the LED.
<p>A very good point you have brought up about resistors, when i first designed the circuits i didn't give too much thought about driving an led, they were just added later to show the circuits working, and basic resistor values added to limit current.</p><p>when i made them i used a small 3v button cell and they all seemed to work as intended, just as basic logic circuits really.</p><p>for anyone who wants to add them to their prototype, they should consider changing every component value in the designs. but like i say the ones i used seem to work ok in low voltage.</p>
<p>Hi, i'm a newbee at electronics. I would like to know how to combine for example a NAND gate and AND gate.. so that i can have 4 inputs and 2 outputs. We we're asked to make a combinational circuit with 4 inputs and the output is for us to decide. Please reply, thanks! Cheers</p>
<p>try this circuit on some breadboard, but the 4 10k input resistors might need to be a lower value and the 2 led's are the 2 outputs. the result should be that only one led is lit until all 4 inputs are used at the same time, then the other led will turn on and the first one will turn off like a flip flop circuit</p>
Man, you're awesome!! Thank you very much!!! I guess we need more studying on how this works. But can we combine 2 kind of gates just using transistors and have 4 led outputs? That would be great. Thank you again Sir, salute! Much appreciated! =)
<p>i'll look into it for you and try to get back to you soon, i think you could easily do a 2 input and 4 output circuit, even a 3 input 8 output circuit, and with enough transistors and a late night or two, a 4 input 16 output circut ... it would be a big and impressive circuit if you managed a 5 input to 32 outputs.</p>
<p>Hehehe, if can you possibly make a 4 input 16 output? And what kind of circuit will that be? =) I've tried all of your circuit and it was great. They all worked. Big help, big thanks! I'll be waiting for it. Bless you!</p>
<p>By any chance, do you know how to make a 2-bit adder/multiplier/comparator? Any 1 one of those just by using transistors as logic gates? Just to give some ideas for my project.. I'll pass if i make this one! hehe</p>
<p>i'll be offline for a couple weeks now but i will have a look into both circuits for you and get back to you as soon as i can, as for the comparator though build the 2 LED test probe and where the probes should be just put a variable resistor there, experiment with variable resistor values like 500ohm, 1k and 5k</p>
<p>the above circuit is a 4 input NAND. when you combine logic circuits it can completely change the way they behave.</p>
Hi very usefull Thanks:-)<br> I made a (very simple) logic probe followed by a programmable divider that allows you to test the speed signals<br> &nbsp;if interested here is a link with the schematic and PCB for KiCad&nbsp;<br> the ZIP contains the doc in English and French<br> See bottom of page Logic probe &quot;Vampire&quot;<br> <a href="http://www.kicadlib.org/" rel="nofollow">http://www.kicadlib.org/</a><br> <br> Easily modified Eagle
the NOT gate can be made even with a single transistor! <br>how about doing like this: <br>connect the emitter of an NPN transistor to ground and the collector to +v. Then connect a 1K resistor and an output wire to the transistor collector. the input is base of the transistor. Try doing this way... it works! <br>
Thank you for the suggestion, But the circuit you have described does not completely <br>invert the voltage, it is a nice and simple circuit though. <br>the reason i use 2 transistors is to use one to completely drain the other so the output is 0v.
Simplified, yes .. works properly, No <br>the point of this circuit was to show my NOT Circuit with a practical application. <br>The circuit you provided doesnt even need the transistor and doesnt turn off the <br>first led.properly
Here's the circuit simplified and with two current-limiting resistors:
The 2 Transistor Test Probe is a terrible circuit. There is no current-limiting resistor for the green LED.
It only runs on a 3v button cell so you shouldnt really need one, i use it now and again and mine still works fine. <br>I would tend to agree with you about protecting the led, But the led's in these circuits are used as an indicator, only to show the paths which are switched on and off.
How can I supply high volt and low volt? <br>
The easiest way would be to use the circuit to switch a relay on and off, in my opinion its best to keep things simple.
Do you have any tips for cascading these gates?
Bit late to the party, but I just wanted to comment that I find this Instructable to be simple, straightforward, and well thought out. It came in handy while trying to explain logic gates. <br> <br>Thanks for the guide. :D
pls tell me the working of nand gate step by step and how transistor and diodes work plzzz reply me as soon as possible<br>
a rectifier diode will only allow power to travel in one direction, anode to cathode, the cathode end is marked with a stripe.<br>the Led is also a diode but the cathode pin is shorter and has a flat edge on the rim of the head.<br><br>the NPN type transistors i use in these circuits have 3 pins, collector .. base and emitter, like a diode, power flows in the direction from collector to emitter and in these circuits i use them as switches so the base pin acts as the on/off switch.<br><br>the NAND circuit shown above is pretty much the same as the NOT circuit but instead with 2 inputs.<br><br>as you can see in the picture of the NOT circuit, a 1K resistor is connected from battery positive to the first transistors base pin which means the transistor is switched on and the Led connected from the emitter pin to the battery negative pin is also on. <br>to switch the Led off all we need to do is drain the power going to the base of the first transistor, <br>this is done by using a second transistor as a switch, so anything that switches the second one on means there isnt enough power for the first one to stay switched on.<br>for a NAND you just need more than one input transistor.<br><br>so when the NAND circuit in powered on, the Led is on.<br>if only one of the 2 inputs are switched on then there will be no change and the Led will stay on until both inputs are switched on, only then will the Led switch off until one or both of the inputs are switched off.<br><br>i hope that helps...
Hi, i'm a first year Engineering student and one of my units this semester is electrical. Our group project consists of making anything we want that reads data and interprets/does something with it. I have some idea for it, but anyways to my question. Your NAND gate design, could i use this to create a T flip flop? like as shown in this pdf - http://www.odyseus.nildram.co.uk/RFIC_Circuits_Files/Dtype.pdf <br><br>Thanks
i had a few thoughts on toggle circuits but never decided on the best way to achieve one, to keep the above circuits simple you could maybe just use a thyristor to latch the circuit to the second led, to reset the circuit maybe add a basic NOT gate with the thyristor to latch back to led 1.<br><br>as an easier alternative though, some 555 timer datasheets have a latching flip flop circuit which would be cheaper, and if you use surface mount components it would potentially look really impressive,<br>it got me extra points before with tutors and i would think it still applies today.<br><br>i hope that helps, still working on the A-D Converter that i mentioned above but if you want a really really impressive circuit for your project i would recommend you look one of those up online first.