Electronic circuits · no code

Transistor NOT Logic Gate

The simplest inverter: a transistor that flips the signal. With the input at 0 the LED lights, with the input at 1 it goes off.

  • LevelBeginner
  • Time20 min
  • Power9 V DC
  • CategoryLights & LEDs

Bill of materials

Everything you need to build it, with the reference you will see on the schematic.

Bill of materials
Qty Part Ref.
1 Slide switch (SPDT, 3 legs) SA
1 10 kΩ resistor (brown-black-orange) R1
1 BC547 NPN transistor Q1
1 470 Ω resistor (yellow-violet-brown) R2
1 red LED D1
1 9 V battery with snap clip BT1
1 Breadboard (400 tie-points or more)
5 Jumper wires

Missing parts? The kits recommended by Impeca Tech include almost all of them. See the kits

Schematic & wiring

On the left, the circuit diagram; on the right, the same circuit built on a breadboard. Both connect exactly the same things.

Circuit diagram of “Transistor NOT Logic Gate”
Circuit diagram
Breadboard layout of “Transistor NOT Logic Gate”
Breadboard layout

Wire it step by step

  1. Place the components
    • Slide switch SA with its three legs on row f: the left one (position 1) in 3f, the middle one (common, C) in 4f and the right one (position 2) in 5f.
    • 10 kΩ resistor R1 (bands: brown, black, orange, gold): one leg in 4i and the other in 7i (either way round).
    • BC547 transistor Q1 with the flat face (the one with the text) towards you, left to right: collector (C) in 6f, base (B) in 7f, emitter (E) in 8f.
    • 470 Ω resistor R2 (bands: yellow, violet, brown, gold): one leg in 12f and the other in 9f (either way round).
    • red LED D1: the long leg (+, anode) in 9h and the short leg (−, cathode, flat side) in 8h.
  2. Add the jumper wires
    • Red wire: from 3j to the + (red) rail.
    • Red wire: from 12j to the + (red) rail.
    • Black wire: from 5j to the − (blue) rail.
    • Black wire: from 8j to the − (blue) rail.
    • Orange wire: from 6j to 9j.
  3. Connect the battery
    • Connect the 9 V battery to its clip: the clip’s red lead to the + (red) rail and the black one to the − (blue) rail. Do this last, once everything else is in place.
  4. Test the circuit
    • With the switch in position 2 (A=0) the LED should be on; move it to position 1 (A=1) and it goes off. Repeat a few times: always the opposite of the input. On a multimeter the output reads about 1.9 V with A=0 and almost 0 V with A=1.

How to read the holes: the letter is the row and the number is the column of the breadboard (for example 7f). The red (+) and blue (−) rails are the two long lines along the edge.

How does it work?

  1. 1You set input A to 1 or 0
  2. 2With 1 the base gets current and the transistor conducts
  3. 3The output falls to almost 0 V and the LED goes off
  4. 4With 0 the transistor does not conduct and the LED lights

Transistor Q1 works as a switch controlled by the input. With A at 1, a small current enters the base through R1 (10 kΩ, about 0.8 mA) and Q1 conducts: it ties the output to GND and leaves it at about 0.05 V, so the LED no longer has the voltage it needs and goes off. With A at 0 the base gets no current, Q1 is cut off and the current from R2 (470 Ω) goes entirely through the LED, which lights with about 15 mA and leaves the output at about 1.9 V. The output is always the opposite of the input: that is a NOT, the basic building block for the other transistor gates. The input (A) is set to 1 or 0 with a 3-leg slide switch: towards position 1 it is tied to the battery + (level 1) and towards position 2 to GND (level 0). That way the input is never left “floating”, as it would be with a pushbutton.

Testing & troubleshooting

What you should see

A = 0
Voltage at the output≈ 1.92 V
LED current≈ 15 mA
A = 1
Voltage at the output≈ 0.05 V
LED currentunder 0.1 mA

Approximate values, calculated with typical parts. With real parts they can vary by 10 % or more.

If something does not work

The LED is always on?

Q1 is not conducting: check that R1 reaches the base (the middle leg) and that the emitter goes to GND. Also check the transistor orientation: flat face towards you, legs C, B, E from left to right.

The LED is always off?

Check the LED (long leg + towards R2 and the collector) and that R2 goes to the battery +. If the transistor is reversed (collector and emitter swapped) the LED also stays off.

Want to automate this circuit with code?

Learn how to program sensors and custom schedules in our e-book “Arduino from Scratch”.