3

So I'm trying to wire up a full adder just with NPN BJT transistors (I know there is a 74XX283 4-bit binary full adder, but I want to do it just with transistors if possible for my own learning).

The full adder I'm trying to build looks like the following with logic gate symbols:

enter image description here

Image from Wikipedia

I use a NAND, OR and AND gate to build the XOR gate:

enter image description here

Image from Wikipedia

Right now my current circuit looks like this:

schematic

simulate this circuit – Schematic created using CircuitLab

Schematic notes:

But the circuit does not work as intended:

A B CIn | Sum COut
------------------
0 0 0   | 0   0   (Both LEDs are clearly off)
0 0 1   | 1   0   (A clear one the LED glows; the other is off)
0 1 0   | 1/2 0   (The LED just glows like half; the other is off)
1 0 0   | 1/2 0   (The LED just glows like half; the other is off)
1 1 0   | 0   1/2 (The LED just glows like half; the other is off)
1 0 1   | 0   1/8 (The LED just barely glows; the other is off)
0 1 1   | 0   1/8 (The LED just barely glows; the other is off)
1 1 1   | 1   1   (Both LEDs only glow half)

The expected behaviour would be:

A B CIn | Sum COut
------------------
0 0 0   | 0   0
0 0 1   | 1   0
0 1 0   | 1   0
1 0 0   | 1   0
1 1 0   | 0   1
1 0 1   | 0   1
0 1 1   | 0   1
1 1 1   | 1   1

I have tried to remove, change or add some pull down resistors on the gate outputs, but the above circuit is the best attempt I have right now. I have also changed out all components and the breadboard I use, just to make sure it isn't some component that is dead. I already have double/triple checked all resistors and connections, so that I don't just have a misplaced wire or wrong resistor.

I also tried to use a multimeter to find the error, but that just confused me more. But if I have to I can also check stuff with the multimeter if necessary.

So I'm at the end with my knowledge here how to fix my circuit design and get a clear on and off output?

I don't know if I use wrong resistor values, I don't use the transistors correctly or if my design is wrong from the start.

Rizier123
  • 135
  • 1
  • 10
  • Try simulating it in LTSpice or some other free sim tool. The problem is that the circuit just isn't that interesting to most seasoned EEs so the only folk who might help are those interested in building something this historical hence why I suggest a sim tool. Start with logic gates and get that working then replace each gate with BJTs and advance, debug, fix, advance, debug, fix etc... – Andy aka Oct 25 '16 at 17:07
  • 1
    You have your whole circuit in Circuit Lab already, have you used their simulator to see if it works as expected? – Tyler Oct 25 '16 at 17:16
  • @Tyler Not yet, but I can give it a try if I get it running. – Rizier123 Oct 25 '16 at 17:21
  • I ran it with your first 1/2 lit scenario, and got -415mV on the Sum LED, work backwards from there, maybe. – Tyler Oct 25 '16 at 17:26
  • @Tyler As I said I'm at the end of my knowledge and that -400mV also confuses me. And I can't tell where exactly that comes from. – Rizier123 Oct 25 '16 at 17:37
  • Simplify, break it down to just 1 gate, add a second gate, etc etc – Tyler Oct 25 '16 at 17:43
  • 2
    The problem with this circuit is that the BJT 'gate' circuits are poorly designed and do not interface correctly. eg. the basic NAND gate is made from two BJTs - the bottom one works as a switch, the top one works as an emitter follower.Inputs require a source of current but outputs sink current. Problems are simply compounded when the 'gates' are connected together and you end up getting all sorts of funny voltages produced rather than a logic signal. You'll waste lots of time and effort and it just won't work. Andy gives excellent advice. – JIm Dearden Oct 25 '16 at 19:03
  • @JImDearden So how would I design the gates properly? I basically just google'd every gate built it and then put them together. – Rizier123 Oct 25 '16 at 19:07
  • @Rizier123 "Design-by-google." Cool. Who needs EE.SE or an education or knowledge? ;) – jonk Oct 25 '16 at 22:10

2 Answers2

7

It's probably most straight forward using a NOR form as the basis of a BJT adder. It's quite simple to form the basic gate, this way. Nothing crazy, at all. Just simplicity.

The following schematic shows the basic one-BJT form for the NOR gate at the top. It then follows up by showing what a full adder would look like if it were based entirely on these gates. You'd need a total of 9 NPN BJTs here. Half of what you are using now. And it should actually work okay and simulate fine. (You may get glitching. But if you observe reasonable setup and hold times, it should work okay.)

schematic

simulate this circuit – Schematic created using CircuitLab

Also, the inputs as designed don't overload the outputs. There are, at most, three input loads on a single output (in two cases.) The rest is either one or two loads.


Here's an LTspice circuit and simulation, walking through all eight combinations of A, B, and C.

adder simulation

jonk
  • 77,059
  • 6
  • 73
  • 185
  • But where did I went wrong with my design? What mistakes did I do? I would like to learn from the mistakes I made in my current design. If possible I don't want to build the adder just out of universal NOR gates. – Rizier123 Oct 25 '16 at 19:12
  • @Rizier123 Why not? You wrote, "the circuit does not work as intended." I repaired that problem. So what is your real goal here, if not to design a working full adder out of BJTs? I don't understand your real goals, I suppose. But you obviously haven't stated them, now that you are asking this question. – jonk Oct 25 '16 at 19:15
  • Well it just fells a bit weird to use only one kind of gate. And if I use the same gates as in my schematic just with ICs it works, but if I try to build the gates my own with transistors it doesn't. – Rizier123 Oct 25 '16 at 19:20
  • @Rizier123 But you actually _can_ wire that up with BJTs and it will work. Supply it with 5V. Do you need to see the full schematic with BJTs only? It's a trivial expansion. – jonk Oct 25 '16 at 19:21
  • 1
    @jonk you know you are in good company in that adder design? NASA did that (well much more actually). The Apollo guidance computer was totally based on an RTL dual NOR gate here [picture](http://www.klabs.org/images/apollo/agc/dual_nor.jpg), [schematics](http://klabs.org/history/ech/agc_schematics/logic/5011-1.jpg) and usage [example](http://klabs.org/history/ech/agc_schematics/logic/a03-2.jpg) – carloc Oct 25 '16 at 19:28
  • @carloc Well, I wanted to use fewer BJTs than they did in that 2nd link you provided. Interesting site, though. Do you know what the SQ register and decoder function supported/did for them? – jonk Oct 25 '16 at 19:37
  • @jonk I don't need a full schematic, but why does your design work and mine doesn't? If they do exactly the same? Shouldn't mine work too? – Rizier123 Oct 25 '16 at 19:47
  • @jonk Oh yes your circuit uses fewer transistor :) . Probably they were more looking for reliabilty and speed even if in aerospace weight, power and volume are of course main concerns too. No unfortunately I do not know what an SQ register was for, but that site is really cool, if you browse thru you'll find it quite wealthy with infos. – carloc Oct 25 '16 at 19:52
  • @carloc I will look at it again when I have more time. Thanks for that! – jonk Oct 25 '16 at 20:05
  • 1
    @Rizier123 I didn't want to go sitting around investigating the use of 18 BJTs in an adder, when it was so much easier to just make a working example using far fewer BJTs. So your question is really "what's wrong with my thinking process" and not "building a full adder with NPN BJT transistors," as I'd earlier imagined? I'll give it a shot as an addendum. – jonk Oct 25 '16 at 20:07
  • @jonk *So your question is really "what's wrong with my thinking process"* Yes, that is correct. Or what did I do wrong? built the gates wrong? Used wrong resistor/pull down resistors? I mean if I replace my transistor gates with ICs everything works fine, which would suggest that it works just that I did something wrong on how exactly I did it. – Rizier123 Oct 25 '16 at 20:18
  • @Rizier123 The BJT isn't just a switch, as I think you imagined. Have you taken a closer look at the way you've arranged your AND gate and it's output into a NAND, plus the OR gate that also feeds this NAND, for example? Look at your diode drops, resistors, etc. Tell me what you come up with there. – jonk Oct 25 '16 at 20:33
  • I'm not quite sure what you mean with diode drops and resistors? And at what exactly I need to look for. – Rizier123 Oct 25 '16 at 20:38
  • @Rizier123 The BJT requires a diode drop per base-emitter, yes? Have you done any analog design with BJTs before? Follow the chain from input to \$Q_3\$, through \$Q_6\$ (not forgetting \$Q_5\$ above it), through \$Q_9\$, and then through \$Q_{12}\$, keeping track of all necessary analog details along the way. Show me your work and calculations. – jonk Oct 25 '16 at 21:00
  • @jonk I'm an absolute beginner to electronics in general. So I never have done any analog design with BJTs. I watched a tutorial where someone used the same transistors and used a 10k ohm resistor as base resistor and after some researching I added the 1k pull down resistors for cleaner signals. – Rizier123 Oct 25 '16 at 21:03
  • @Rizier123 Then this is the problem. I can't write a chapter on the subject of such design here, sufficient to bring you to the point where you can do this on your own. You are cribbing, I guess, from other work where those folks knew what they are doing and carefully worked out the details. Then you take those blocks and just paste them, ignorantly. That works up to a point. But then it doesn't. I'm not blaming you or anything. Except to say that you have some work ahead of you and your "tell me what's wrong" question just isn't possible to answer given what you don't know right now. – jonk Oct 25 '16 at 21:08
  • Okay, but can you give me some links, resources or keywords I can use so I can read it my own and learn it? – Rizier123 Oct 25 '16 at 21:15
  • @Rizier123 I wish I knew something targeted at this kind of narrow use of BJTs. I don't. Probably most of the good educational material designed exactly for this is more than 40 years old. It's just not done anymore. But you should learn about BJTs and how they function (plus CE, CC, and CB modes), Ohm's Law, Thevenin and Norton equivalents, and probably nodal analysis. Ideas about input impedance and output impedance would help, too. Get "The Art of Electronics," 2nd or 3rd edition, and the student manual for it, perhaps. – jonk Oct 25 '16 at 21:23
  • Is such a simple thing really that complicated and so many things involved? – Rizier123 Oct 25 '16 at 21:51
  • @Rizier123 If you cut and paste circuits, without understanding, then problems often arise. I redesigned things so that you actually could just cut and paste. (Mostly, because in reality loading matters and given enough cutting and pasting even what I put there could be abused into no longer functioning anymore.) I don't know how serious you are about designing an adder or an entire ALU using BJTs. But if you are really serious about something like that, then you need to learn those things I mentioned (I think.) But I'm sure some people will disagree. No opinion is immune to disagreement. – jonk Oct 25 '16 at 22:07
  • @Rizier123 You said "the circuit does not work as intended." So I think you've already proven the point that "a simple thing" is "really that complicated." Clearly, it's complicated enough that you got into trouble along the way. You actually answered your own question, I think. It doesn't work as intended. Therefore it must not be as simple as you imagined. – jonk Oct 25 '16 at 22:13
  • @jonk I'm a programmer and I thought I try to build a little simple computer with ICs, so I get a better understanding of how a computer works on a transistor level. I also found this really cool yt channel: https://www.youtube.com/user/eaterbc/videos and the first thing I try to do is just add some bits together. Basically building a 74LS283 4 bit binary full adder just with transistors. And I really tried hard(http://imgur.com/a/NpJqW) and thought it isn't that hard, but maybe I'm not smart enough to do such a thing. – Rizier123 Oct 25 '16 at 22:22
  • @Rizier123 Unless you take this to chat, this has to be my last comment here. I'm also a programmer who decided to build a computer in 1974 from gates. Got written up in local papers. Not so different with you perhaps. I had a lot to learn. So do you. Gates work as well as they do because designers have shaped them. But today you have access to cheap FPGAs. Given your background, I'd recommend looking into that as an option. VHDL and verilog should be fairly "natural" to you. And yes, you **are** smart enough. Don't doubt that. – jonk Oct 25 '16 at 22:55
  • @jonk So I played around with it a bit more and I just took the LED's and placed them before the transistor of the last logic gate instead of behind them at the end and it works. It gives me a clear signal. But how does that makes a difference if the electricity flows through the LED first and then into the transistor instead of flowing into the LED after the transistor? – Rizier123 Nov 11 '16 at 00:04
  • @Rizier123 You are kidding me!! I'm glad to hear you are still on this! But you really should post up another question, detailing your schematic and exactly what you did and your question. (I'm not even sure what "it" is when you say "So I played around with it...") I have no doubt that your original schematic will have problems, generally, and I know why. Are you using that, still? – jonk Nov 11 '16 at 00:10
  • @jonk Yes I still have the same schematic. Here is what I changed: \$D1\$ was connected behind the emitter of \$Q12\$, which is the AND gate with \$Q11\$ of the XOR gate , now I just placed \$D1\$ before the AND gate just in front of the collector of \$Q11\$. \$D2\$ was connected behind the emitter of \$Q17\$ and \$Q18\$, now I just have \$D2\$ in front of the collector of those two transistor which build an OR gate. It works, but I don't know how that makes a difference? – Rizier123 Nov 11 '16 at 00:18
  • @Rizier123 You are probably lucky. As I wrote earlier, the chain from input to Q3, through Q6 (not forgetting Q5 above it), through Q9, and then through Q12 (and keeping track of all necessary analog details) pretty much spells disaster to me. In your case, you've removed one VBE drop. If it is now working, it's only scraping by, by hook and by crook. In general, there's very little joy in flogging a dead horse or in explaining why one bad circuit works and another bad one doesn't. Just no pleasure in it. Better to struggle to understand instead why a good circuit works and a bad one doesn't. – jonk Nov 11 '16 at 00:24
  • @jonk It seems weird to me to place the output, the LED, before the last logic gate and not at the end of all logic (gates). But it works very well :) I also have read about the different modes here multiple times: http://www.learnabout-electronics.org/Semiconductors/bjt_06.php but I don't fully understand it. So I wonder if it is the correct way to do it as I have the working CCT now? I have also read that it is common to place the LED before the collector? (If you have time we can use [chat](http://chat.stackexchange.com/rooms/15/electrical-engineering) instead of filling the comments.) – Rizier123 Nov 11 '16 at 00:33
  • @Rizier123 We can try chat at some point. But you said "I'm an absolute beginner to electronics in general. So I never have done any analog design with BJTs." And I despair of being able to explain things, given that. Do you think there could be anything useful done in chat without you first seriously trying to learn to design with a BJT? – jonk Nov 11 '16 at 01:33
  • @jonk Well I hope it will be useful. I mean I know the basics of a BJT with the NPN layers and if you have around 0.7Vbe that the transistor will be conductive. – Rizier123 Nov 11 '16 at 01:40
  • @Rizier123 I'm willing to give it a go. Let me know when a good time might be for a 1:1 chat. – jonk Nov 11 '16 at 02:35
  • @jonk Right now if it is a good time for you. – Rizier123 Nov 11 '16 at 02:36
  • @Rizier123 Okay. Moving this whole thing to chat... – jonk Nov 11 '16 at 02:38
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/48321/discussion-between-jonk-and-rizier123). – jonk Nov 11 '16 at 02:38
  • @jonk I looked at the preview of "Learning the Art of Electronics" and I think I'm going to get that one. I hope you won't "roll your eyes" if I still build my http://imgur.com/a/NpJqW (8x full adder) to the end to with the working circuit I have now see it working? – Rizier123 Nov 11 '16 at 16:59
  • @Rizier123 I think you should do whatever you want to do and see how it goes. Yes, "Learning the Art of Electronics" is the right book to get. It's fantastic for self-paced, self-learning of electronics, generally, and BJTs specifically. – jonk Nov 11 '16 at 17:50
  • @jonk Do you maybe have a few minutes for a few questions [here](http://chat.stackexchange.com/rooms/48321/discussion-between-jonk-and-rizier123)? – Rizier123 Nov 20 '16 at 00:24
  • @Rizier123 I probably have less than 4 minutes. In a 40 minutes or so, more time. – jonk Nov 20 '16 at 00:27
2

As you can make the other gates from NAND gates try this (circuit is based upon a simplified TTL (DTL) type gate. Note that the inputs a current source, outputs sink current.

The transistors are jelly bean types e.g. BC548 (NPN), BC557 (PNP)

enter image description here

JIm Dearden
  • 18,926
  • 30
  • 40