# Would this circuit work as a binary calculator?

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...

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:

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

• 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. Nov 30, 2016 at 0:05
• 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? Nov 30, 2016 at 0:07
• 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!) Nov 30, 2016 at 0:12
• @MarcusMüller LOL, that's not an analogy I've heard before in electronics, but it somehow fits the situation.... Nov 30, 2016 at 0:53

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.