Classroom Public page

Week 6: Transistors as Switches

573 words

A transistor lets a small input current control a much larger output current. By the end of the week you can build a circuit where a small "input" current (the kind a microcontroller pin can provide) switches a higher-current load (a buzzer or small motor).

This is the last pre-microcontroller week. Week 7 brings the Arduino R4.


Reading (~45 min)

  • Horowitz and Hill, The Art of Electronics, Ch 2 §2.1 (transistors as switches). Skim the rest of Ch 2; come back to it as needed
  • The kit's transistor datasheet (typically a 2N2222 or 2N3904 NPN). Find the typical Hfe (current gain) and the maximum collector current

Lecture (~1.5 hr)

  • What a transistor is, simply. Three pins: base, collector, emitter. A small current into the base lets a larger current flow from collector to emitter. The ratio is the current gain (Hfe), typically 100-300 for hobby transistors
  • NPN vs PNP. NPN is the default in HW-101; the conventional current flows from collector to emitter when the base is pulled high. PNP works inversely; ignore it for HW-101 unless you have a specific reason
  • Why a microcontroller cannot drive a motor directly. A typical microcontroller pin can source ~20 mA. A small motor or buzzer needs hundreds of mA. The transistor bridges the gap
  • The protective resistor at the base. Required. Limits the base current to a safe level. Typical value: 1 kΩ for a 5 V control signal driving a 2N2222
  • The flyback diode. When you switch off a motor, the motor's coil tries to keep current flowing; that energy has to go somewhere. A reverse-biased diode across the motor protects the transistor by giving the energy a safe path. Required for inductive loads (motors, relays); not needed for resistive loads (buzzers, LEDs)

Lab exercises (~2 hr)

Lab 6.1: Transistor Switch. Build an NPN transistor switch that turns on the kit's small buzzer (or piezo) when a manual control pin is pulled high. Measure base current vs collector current; verify the gain. ~90 minutes.

Independent practice (~3 hr)

  • Build a transistor-switch circuit with the buzzer replaced by the kit's small DC motor. Add the flyback diode. Verify the motor runs when controlled
  • Try the same circuit without the flyback diode. Use a multimeter set to its highest voltage range to measure the spike at switch-off (it can exceed 20 V for a brief instant). This is why the flyback diode exists
  • Read the 2N2222 datasheet's "saturation" specifications. Find Vce(sat), the voltage drop across the transistor when fully on. Notice it is small but nonzero; the transistor is not a perfect switch

Reflection prompts

  1. The transistor gives current gain: a small input current controls a larger output current. Where does the extra current come from?
  2. The flyback diode is required for inductive loads but not for resistive ones. Build the intuition: why does the inductor try to keep current flowing when you switch off, and why does the resistor not?
  3. You are about to start microcontroller work next week. List two specific things from weeks 1-6 you expect to use every week from now on

What's next

Week 7 is the bridge. You meet the Arduino R4. You write your first sketch. The built-in LED blinks. The course shifts from "build circuits with passive components" to "build circuits a small computer controls." Everything you learned in weeks 1-6 still applies.