Back in 2010 I created and demonstrated the Logic function tester I had designed and built, which was a simple way to show how basic logic gates AND, NAND, OR and NOR work. You can read my write up on the project at:
I have now created an improved version, GateLab, which demonstrates how all basic logic gates NOT (inverter), AND, NAND, OR, NOR, XOR (EX-OR), and XNOR (EX-NOR) work. However, I have only used NAND gates to create each of the aforementioned gates, which shows how it’s possible to create different logic gates using only NAND gates and has the advantage that only one type of chip is needed (7400). Note that alternately NOR gates can be combined to form all basic logic gates.
GateLab can be run from a power bank or USB power supply and uses a number of switches to set the logic level for each of the gate inputs and LEDs serve as the gate outputs. This presents a fun way to learn how the basic logic gates work in an interactive manner.
Please note that the images on this page are also downloadable from the bottom of the page for better viewing.
You can email me at james.boshikoopa@gmail.com
The circuit diagram for the gateLab project is called gateLab1V0.png, viewable below, and is also downloadable from the bottom of the page for better viewing.
The gateLab runs off USB-C 5V power supply, such as provided by a phone charger, for example, as that should be convenient for most people but of course you can use whatever connector you like as long as you do not supply more than 5V. Switch SW1 turns the power on/off.
Each basic logic gate (NOT, AND, NAND, etc.) consists of one or more NAND gates provided by five 74LS00 ICs, U1 to U5. You can substitute the 74LS00 for a similar, compatible version, indeed when I built the prototype (see the Construction section) I used 74AC00 ICs as I happened to have 5 of them. 74AC00 has the advantage of lower power draw compared to the 74LS00 while still providing strong output drive.
0.1uF capacitors C1 to C5 provide the power supply decoupling for the chips.
Switches SW2 to SW14 handle the inputs to each logic gate (A/B), pulling the gate input high when in the on position. When a switch is in the off position a 4K7 resistor (R1, R3, R4, R6, R7, R9, R10, R12, R13, R15, R16, R18, R19) pulls the gate input low. Although pull-up resistors are recommended for 74LS series ICs this would result in inverted logic, since the switch would have to take the gate input low. So instead I’ve used pull-down resistors so that the input switches pull the input high when in the on position.
LEDs D1 to D7 indicate the gate output logic level. I didn't specify the LED colours on the schematic but you could use red for inverted logic gates (NOT, NAND, NOR, and EX-NOR) and green for non-inverted logic gates (AND, OR, EX-OR), for example, which will help differentiate. 330R resistors R2, R5, R8, R11, R14, R17, R20 limit the current to each LED to a moderate level. Assuming a gate output voltage of 5V (which of course in practical use it won't be but serves as the highest theoretical value) and an LED voltage drop of 2V, a 330R resistor should result in around 9mA current:
I=V/R
I=(5-2)/330
I=0.009A
This is a good compromise between battery life and LED brightness should the circuit be run off a battery. However, you should adjust the resistor value based on the LED type(s) you are using.
For the prototype I used components I already had and soldered them on a perfboard that has conductive isolated pads on both sides, aiming to keep the majority of wiring on the underside to keep the top side as neat as possible. I did not use a drawing plan for the soldering instead I simply followed the circuit diagram and laid out the components the best I could. The intention is to make up a PCB in the future, which will look visually more appealing, when done I will share the PCB board layout file.
You can see the finished prototype in the following photos which show various views:
As previously mentioned, for the prototype I used 74AC00 ICs instead of 74LS00 but they are functionally the same.
Now I will go over how I soldered the circuit. I regularly checked my soldering with visual inspection and via continuity checks using a multimeter to ensure good connections where needed and that there weren't shorts were there shouldn't be.
I started by soldering a USB-C breakout board to the perfboard as that would be easier than soldering a bare USB socket, then I followed with attaching the power switch.
For the PCB version I plan to use switches but in the prototype, due to the limited space provided by the perfboard I had chosen and not having small enough switches, in place of switches I used a 2 x 19 male header. This does have the advantage that the inputs can easily be driven by an external circuit.
The header was placed vertically, with the two horizontal pins removed at positions 2, 5, 8, 11, 14, and 17 to separate the inputs to the logic gates. The left side of the header pins were connected to +5V and the right side to each gate input as follows:
Pin Gate Input
1 NOT A
3 AND A
4 AND B
6 NAND A
7 NAND B
9 OR A
10 OR B
12 NOR A
13 NOR B
15 XOR A
16 XOR B
18 XNOR A
19 XNOR B
Colour coded jumpers (blue for input A, green input B) were placed horizontally across the two pins to take the gate input high, or removed to cause the input to go low.
Unfortunately, it was still tight for space and so it was quite fiddly to remove/put on the jumpers, this was because the input pull-down resistors ideally should have been resistor arrays, which would have taken up less space but I didn't have suitable ones at hand so I used individual resistors, which got in the ways of the jumpers somewhat, so I bent the resistors out of the way.
If you are using push or sliding switches instead of a header and jumpers then they can be soldered so that there is space between each group of gate inputs.
Next I soldered the LEDs with limiting resistors inline with the LED anode connections as to take up less space. This was when I realised an error and should have done more planning beforehand. I wanted each LED to line up with the headers so it's obvious which jumpers are associated with each LED. Because NOT has only one input I soldered the corresponding LED horizontally with the jumper but this meant the subsequent LEDs wouldn’t have equal spacing since all the other gates have two inputs. So I ended up having the second LED horizontal and the rest vertically so they lined up with the headers. What this means is that the first two LEDs are closer together than the other adjacent ones but the LED leads can be bent slightly to space out a little more.
Next, I soldered IC sockets (you can of course solder the chips directly to the board), due to the small size of the perfboard I put the decoupling capacitors on the board underside. The only other thing left to do was to add any remaining wiring.
As this was the prototype I simply attached posts in the corners of the perfboard to support it on a table or other surface but you may want to put it in a project box with holes for the USB-C, switches and LEDs.
I did a number of tests between soldering the various sections; I measured the logic 1 voltage to GND of a gate to be 4.90V and the current through a red LED when the gate was on to be 8.35mA, 8.40mA for a green LED when the gate was on. This was quite close to the estimated 9mA assuming 5V gate output voltage but if we use 4.9V in the LED current formula we get 8.78mA, which better matches the readings. The red and green LEDs were both adequately bright so the chosen limiting resistors were indeed suitable.
After soldering finished and having made sure I had connected each component correctly I inserted the five chips into the sockets observing the correct orientation before connecting a phone charger for power and switching on with switch SW1. I measured 4.98V across the +5V and GND supply and measured with all LEDs off the total circuit current draw was just 9.59mA, with all LEDs on it was 62.8mA. Recall that I had used 74AC00 ICs, if you use 74LS00 chips or ICS from a different 74 family the current draw will be different. Nonetheless the circuit is suitable to be powered using batteries including running off a power bank although some power banks will switch off if the current draw is too low.
With all switches in the on position (or jumpers placed across the headers) the NOT, NAND, NOR and XOR LEDs should be off, all others on - if not, check soldering. Make sure power is getting to the circuit, in particular check the IC power pins (pins 7 and 14) and ensure the chips have been inserted/soldered the correct way round. When you have the appropriate LEDs lit go through checking that each LED lights according to the relevant truth table for each logic gate.
All content of this and related pages is copyright (c) James S. 2025