6 Feb 2013

Digital Systems Part 2 - Transistors implementation

In the last post about digital systems, you learned the differences between the different logic gates. Now, we're going to look at how to make AND/OR gates with NPN transistors. But first, we need to talk a little bit about the purpose of the transistors.

The Bipolar Junction Transistor (BJT)

The theory behind the transistors is quite complicated (quantum theory, semiconductors and electronic doping). Fortunately, you don't have to know about all these things to understand the operation of the transistor. Keep in mind, transistors can operate in different modes but in this post we are only going to learn about the saturation mode. First, take a look at the schematic diagram of the BJT and it's TO-92 (Transistor Outline) casing :

In the saturation mode, the transistor is behaving like a simple switch. The transistor is a 3-pin device : emitter, base and collector (EBC). This switch will let the current flow in only one direction, from the collector to the emitter. The condition required to let current flow in the switch is that there is a small current flow between the base and the emitter. In other words, the base is a control pin and applying a voltage to it will close the switch (thus resulting in a current flow from C to E).

A small current flow from the base to the emitter will produce a large current flow between the collector and the emitter

Making gates with BJTs

With only two NPN transistors, we're able to build a AND/OR gate. The transistors used in the circuit will be the 2N3904. The circuit is simple : we have 4 switches (labelled 1 to 4) in a DIP package connected to a AND gate and a OR gate. The output of the AND gate is connected to a yellow LED; The output of the OR gate is connected to a red LED. In the table below, you see all the possible switch combinations. Without any doubts, S1 and S2 are wired to the OR gate (red), S3 and S4 to the AND gate (yellow).

Truth Table

 S1 S2 S3 S4 Red LED Yellow LED 0 0 0 0 OFF OFF 0 0 0 1 OFF OFF 0 0 1 0 OFF OFF 0 0 1 1 OFF ON 0 1 0 0 ON OFF 0 1 0 1 ON OFF 0 1 1 0 ON OFF 0 1 1 1 ON ON 1 0 0 0 ON OFF 1 0 0 1 ON OFF 1 0 1 0 ON OFF 1 0 1 1 ON ON 1 1 0 0 ON OFF 1 1 0 1 ON OFF 1 1 1 0 ON OFF 1 1 1 1 ON ON

The upper part is the OR gate, the lower part is the AND gate. The small components in black are the 2N3904 NPN transistors. On the left, all switches are off, on the right : 1 on - 2 off - 3 on - 4 on.

The circuit Schematic

I think the diagram below speaks for himself. With the OR part, the two switches are in parallel, so if one of the switch is closed, the red LED will light. For the AND part, the two switches need to be closed for the yellow LED to light. I chose 10 kiloohms for the base resistors (R1-R2-R3-R4) to produce 1mA of current from base to emitter. For the LED resistors, I chose the value of 680 ohms so 12mA is flowing in the LED. Please take a look at my post about diodes if you do not remember how to calculate the current through the LEDs.

That's it for today! In the next part, we will look at integrated circuits that contains four to six logic gates of the same kind (74 series); this will help us to make digital circuits faster. The goal will be to create complex structures with logic gates. See ya!