skill

Transistor switching

A tiny current at the base opens a gate for a much bigger one.

first shows up at Level 3 · Sense

See it working

simulating…

The LDR going dark lifts the base voltage a fraction of a volt. That tiny push lets much more current through the collector lane and the LED lights. A small signal at the base controls a bigger one. 🔧 Open this circuit in the Workbench →

A transistor is an electronic switch — but instead of your finger flipping it, a small electrical signal does. That means a sensor (which can only move tiny amounts of current) can control an LED, a buzzer, or a motor (which need much more).

The three legs of an NPN transistor

  • Base (B) — the "control" pin. A tiny current here decides everything.
  • Collector (C) — where the big current comes in.
  • Emitter (E) — where it leaves, on its way back to −.

The rule

When enough current flows into the base, the transistor "turns on" and a much bigger current can flow from collector to emitter. Roughly:

I_collector ≈ β × I_base (β is often 100 or more)

So 50 µA into the base can control 5 mA through the collector. The transistor amplifies: a small current controls a larger one.

Where you'll see it

Any project where a sensor (LDR, button, microphone) has to trigger something loud, bright, or moving uses a transistor as the middleman. It's the bridge between "I detected something" and "I did something about it".

Sizing the base resistor

You never wire a signal straight to the base — the base–emitter junction only drops 0.7 V, so an unlimited current would flow and the transistor would cook. Instead a base resistor sits between the signal and the base, sized to deliver about ten times the strict minimum base current (that is, 10 × Ic ÷ β). The extra headroom keeps the transistor saturated when β drifts with temperature or load. The transistor base resistor calculator runs the math and shows the switch turning on live.

The upside-down twin: PNP

Every NPN has a mirror image, the PNP. Its big current flows in at the emitter and out at the collector, so its emitter goes to + and the load hangs off its collector down to −. And it turns on when the base is pulled about 0.7 V below the emitter, not above. An NPN switches the − side of a load; a PNP switches the + side. Together they can push a signal either way, which is how motor drivers and most chip outputs work. The Upside-Down Transistor builds one.

Projects that teach this

Automatic Night Light A light that switches itself on when the room gets dark — no hands, no code. L3 35 min Sunrise Alarm The night light — flipped. Swap two parts and the LED wakes up with the sun instead. L3 25 min Cookie Jar Alarm The Sunrise Alarm's brain wired to a buzzer instead of a lamp — quiet in the dark jar, screaming when the lid comes off. L3 25 min Trip Wire Alarm A thin wire across a doorway holds the alarm silent. Break the wire and the buzzer screams — until you connect it back. L3 25 min Warm Hand Alarm Cup your hand over the sensor and the LED lights up — a thermometer that turns into a switch. L3 30 min Reading Light The Automatic Night Light with a knob on top — turn it to dial in how dark the room has to get before the lamp fires. Your first tunable threshold. L3 30 min Vacation Nightlight The Automatic Night Light with a manual override — flip the slide switch off and the lamp stays dark even in a pitch-black room. L3 25 min Study Lamp The Automatic Night Light with a force-on override — flip the slide switch and the lamp stays lit even in daylight, ignoring the sensor. L3 25 min Curfew Beeper The Automatic Night Light's brain with a buzzer where the LED used to sit — beeps the moment the room goes dark, so you never miss sunset. L3 30 min Fever Beeper The Warm Hand Alarm's brain wired to a buzzer instead of a lamp — silent in a normal room, beeping the second a warm palm covers the sensor. L3 25 min Dusk Chorus The Curfew Beeper with a red LED wired in parallel with the buzzer — one dusk sensor drives a chime and a lamp at the same time. L3 30 min Warm Hand Chorus Fever Beeper with a red LED added in parallel with the buzzer — one warm-hand sensor drives a chime and a lamp at the same time. L3 30 min Dawn Chorus Cookie Jar Alarm with a red LED added in parallel with the buzzer — one light sensor drives a chime and a lamp the moment the sun hits. L3 30 min Trip-Wire Chorus Trip Wire Alarm with a red LED added in parallel with the buzzer — one thin wire holds the whole chorus silent; snap it and both mouths fire. L3 30 min Night Doorbell A doorbell that only works at night. The ring button fires buzzer and LED together — but only once the LDR sees darkness. In daylight the button does nothing. L3 30 min Alley Lamp Automatic Night Light with a push-button override. Dark room OR button press fires the lamp — a wired-OR built straight onto the transistor's base. L3 30 min The Upside-Down Transistor A PNP transistor switches the + side of a lamp and turns on when you pull its base DOWN. Same button, same LED, whole circuit flipped. L3 30 min Handheld Fan Press the button, the fan spins. A tiny finger current commands a hundred-milliamp motor through a transistor. L4 20 min Sunrise Fan Sunrise Alarm with the LED swapped for a motor. The sun rises, the fan starts — an automatic wake-you-up desk breeze. L4 25 min Panic Fan Two buttons, either one fires the fan. Panic Doorbell wearing a motor — an OR gate that spins. L4 20 min Party Spinner One button, three mouths: a spinning motor, a red LED, and a buzzer all fire together. One transistor drives them all. L4 25 min Twin Wheels Two motors from one button — a Level 9 robot drivetrain, five levels early. L4 25 min Dial-a-Spin Dial-a-Brightness with a motor instead of an LED. Twist the knob and watch the fan speed slide from full spin to a slow crawl. L4 20 min Trip Wire Fan Trip Wire Alarm's brain wearing a motor. The wire is intact — the fan is silent. Snap it — the fan spins as the alarm. L4 25 min Sun Beacon Sunrise Fan with a second lane — a yellow LED lights and a motor spins together the moment daylight hits the sensor. One brain, two mouths. L4 25 min Dusk Fan Sunrise Fan's mirror image — the room gets DARK and the fan spins. A bedside cooling breeze that starts as the lights go out. L4 25 min Warm Hand Fan A little desk fan that starts when you cup your palm over the sensor. Warm-Hand Alarm's brain, motor mouth. L4 25 min The Switch That Uses No Current A MOSFET turns the LED fully on, yet its gate draws nothing. Hold the button, then tap the 10 kΩ to make it 100 kΩ and see the gate still win. L5 30 min

Parts you'll meet along the way