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.
All details for constructing the GateLab, including the schematic, are available on this page. Please note that the images on this page are also downloadable from the bottom of the page for better viewing.
You can view a video I did on the GateLab below which demonstrates how to use the GateLab:
You can email me at james.boshikoopa@gmail.com
New: Schematic (Rev. 1.1) (26/1/26)
PCB Design (26/1/26)
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. I made it in KiCad 9.0.
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, and is accompanied with the gate's truth table (A and B are the inputs, Q is the output). 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. At the time of making the prototype the intention was to make a PCB (Printed Circuit Board) in the future, which will look visually more appealing and easier to solder. This is now covered in the PCB Design section.
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.
Having designed and built the GateLab prototype I then worked on a GateLab PCB, the first time I’ve done a PCB layout, which was very much a learning process. While doing the PCB design I added two main improvements to the schematic, which became revision 1.1, and was used as the basis for the PCB. You can view the updated schematic below and it is also downloadable at the bottom of the page as gateLab1V1.png.
The changes to the schematic are as follows:
Resistors R22 and R21 have been added, connecting USB-C pins CC1 and CC2 respectively to GND, to meet USB-C compliance, so that all USB-C power supplies work with gateLab.
Alternative power pin connectors, J2 and J3, have been added, bypassing the need to use a USB-C surface mount connector, allowing for pin headers or a USB breakout board to be used instead.
Everything else has remained the same.
This section isn’t intended to be a PCB layout course, instead I will go over the basics and any oversights while making the GateLab PCB design. However, at the end of this section there are a few videos covering PCB design that I used.
I created the PCB design in KiCad 9.0 using schematic rev. 1.1 (see section Schematic (Rev. 1.1) for more details), and you can find the PCB files on PCBWay, as I entered the project into PCBWay's 8th Project Design Contest, and is my first time entering such a contest hosted by PCBWay. PCBWay has not sponsored me but as with any PCBWay community project the creator receives a 10% commission on each order.
The link to my entry:
https://www.pcbway.com/project/shareproject/GateLab_Logic_Gate_Visual_Learning_9cc0830a.html
I had planned to have PCBWay manufacture the GateLab PCBs and claim the Raspberry Pi Pico 2 you get for entering their contest but currently they aren't accepting PayPal and their other payment options have too high fees. When PCBWay put PayPal back I will order the PCBs and then I will update my site with a review.
When making the PCB layout you have to set the footprint each component is to use, which determines the spacing and arrangement of the component and its connections when placed on the PCB. Then each component can be placed and connected with traces, a.k.a. tracks, using the connections made in the schematic. Initially I roughly placed the components, with the most critical placements being the gate switches and LEDs so that they were spaced well and lined up appropriately. Notice that the USB-C connector sticks out from the PCB edge, this helps with strain relief when placed in an enclosure.
I originally started with a single sided design - traces on the top side only - however because of the large number of connections I switched to a double sided design: traces on both sides. Because GateLab isn’t a high speed design and doesn’t use lots of power, the trace length and thickness isn’t too important, however, it’s good design practice to keep traces as short and direct as possible.
I also added GND and 5V planes, PCB top and bottom respectively, these large copper areas eliminate the need in having individual traces to every component that needs to be connected to GND and 5V. It can be tricky to ensure that there is enough space that the traces don’t get in the way of the planes.
Since I was going to get PCBWay to make the PCBs I made sure my PCB design met PCBWay's minimum requirements, which I checked using thier Design Rules Check (DRC) settings , which you can read more about at:
https://www.pcbway.com/pcb_prototype/PCB_Design_Rule_Check.html
To have the PCB manufactured there are a number of files that need to be generated, namely the Gerber files, which describe the copper, solder mask, silkscreen and drill holes. The Bill of Materials (BOM) and centroid (pick-and-place) files are also useful, especially to have the PCB assembled (components soldered on the PCB), forming a Printed Circuit Board Assembly (PCBA).
After generating the necessary PCB files in KiCad for manufacture I checked on PCBWay's site and found that because the PCB was slightly over 100mm in one directly the cost was dramatically higher than if it were 100mm or less so I reduced the PCB design to 100 x 100 mm. This is why planning is so important, and in future I will check the cost for a particular PCB size before designing a PCB. Note that there was no difference in cost of a single sided board versus a double sided one for PCBs within 100 x 100mm or smaller.
All content of this and related pages is copyright (c) James S. 2025-2026