Forgive me if this is a stupid question with a poorly drawn circuit diagram. I've never really made anything electrical before, so this is all very new to me.

I've recently been wondering how transistors can be used to add numbers together, and learned that it is done using logic gates. I thought I'd try to understand how this could be done, by drawing a circuit diagram for the half adder of an ALU. The below image is what I came up with...

enter image description here

For those unaware of how binary addition (for a single digit) works, the intention of this circuit is for neither LED to turn on if neither switch is closed, for only the top LED to turn on if only 1 switch is closed, and for only the bottom LED to turn on if both switches are closed.

This can be represented by the following truth table:

enter image description here

Would this circuit work correctly, in the way I have described? If not, how can I change it so that it would work?

  • \$\begingroup\$ sorry, it's impossible to tell whether these are NPN or PNP transistors, your battery (?) is hanging in mid-air (ie. you cannot call this a circuit, because it's missing the circuit part), and I might be missing something, but I'm not aware of a specific "rectangle where a red wire attached" circuit symbol. if those rectangles are actually wires, they short out almost everything of your schematic. Use a proper schematic editor, for example the one integrated here, to draw a usable schematic. \$\endgroup\$ Nov 30, 2016 at 0:05
  • \$\begingroup\$ Thanks for the response. My main concern was with the way power is supplied to this circuit - I did expect that it could not be provided in this way. However, how could I make this a complete circuit? \$\endgroup\$
    – M Smith
    Nov 30, 2016 at 0:07
  • 2
    \$\begingroup\$ The problem is that your diagram is not following any rules that I know for drawing electronic circuitry, so either I simply can't even remotely interpret it, or it doesn't make any sense. You're basically speaking to me in wrong Chinese, and ask me whether the poem you just recited was a ballad. I don't speak Chinese :( (though I certainly wished I could!) \$\endgroup\$ Nov 30, 2016 at 0:12
  • \$\begingroup\$ @MarcusMüller LOL, that's not an analogy I've heard before in electronics, but it somehow fits the situation.... \$\endgroup\$
    – John D
    Nov 30, 2016 at 0:53

1 Answer 1


Since you have no carry-in to worry about, what you need here is just a half-adder. The LED for the less significant bit will connect to its normal output, and the LED for the more significant bit will connect to its "carry".

Using normal logic gates, a half adder consists of an XOR to produce the normal output, and an AND gate to produce the carry:


simulate this circuit – Schematic created using CircuitLab

Now, that leaves only building an XOR and AND gates. If you're building this out of discrete parts so you don't care a lot about performance, and do care about simplicity, you might want to use DTL. An extremely simplified DTL AND gate might look something like this:


simulate this circuit

Note: in practical use, you rarely want to use DTL, because it's pretty slow. Also note that this excludes a couple of resistors that are normally included for level shifting to ensure that the output of one gate can drive the input of another gate. Since you're never cascading gates in this particular case, you can probably get away without that, but if you look up what a DTL AND gate looks like, chances are it'll be more complex than what I've shown here.

I'll leave the XOR for you, but the basic idea is pretty simple: start by designing at the logical level, then design the individual gates (or just use some pre-built logic ICs, of course).

Making things work tends to work in the reverse direction: once you've designed a gate, make it work in isolation. When you have all your gates working individually, connect them together and get a larger circuit to work. Repeat as needed until your whole circuit works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.