Transistor Switch Explorer
Run the Transistor Switch Explorer MicroSim Fullscreen
Iframe Embed Code
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
About This MicroSim
A transistor is an electronic switch that is turned on and off by electricity. This MicroSim shows the kind of transistor inside your robot's motor driver: an N-channel MOSFET. It has three terminals: the gate (G), the drain (D), and the source (S).
- On the left, an RP2040 GPIO pin sends a small signal through a 220 Ω resistor to the gate. This is the thin blue control path.
- On the right, a 6 V battery pack (4 x AA) pushes current through the DC motor, then through the MOSFET from drain to source, and back to ground. This is the thick orange motor path.
When the gate voltage reaches 1.5 V, the MOSFET turns on. Its symbol turns green, the channel closes, and orange dots flow around the motor loop. The meters on the right show the two currents side by side: a fraction of a milliamp on the GPIO side, and hundreds of milliamps through the motor.
This sim uses a simplified model. The motor current rises in a straight line from 1.5 V to 3.3 V. The gate current is shown as about 0.1 mA at 3.3 V so the ratio can be computed; a real MOSFET gate draws almost no steady current at all.
Check Connect motor directly to GPIO to see why we never wire a motor straight to a pin. The motor tries to pull hundreds of milliamps, but a GPIO pin can only give about 12 mA. The pin overloads and the motor barely turns.
How to Use
- Press GPIO: LOW to switch the pin HIGH (3.3 V). Press it again to go back to LOW (0 V).
- Drag the Gate voltage slider slowly up from 0 V. Watch for the voltage where the MOSFET turns on and the motor current starts.
- Choose Stalled motor (blocked wheel) from the Load menu and compare the motor current with the normal load.
- Check Connect motor directly to GPIO (no transistor) and read the GPIO meter and the warning.
- Move your mouse over the circuit to see the current dots and the motor shaft move.
This MicroSim goes with the transistor section of Chapter 6: Electronics, DC Motors, and Communication Protocols.
Lesson Plan
Grade Level
Grades 8–12 (introductory electronics with a physical robot)
Duration
15 minutes
Prerequisites
- GPIO pins and HIGH/LOW digital outputs (Chapter 2: Hardware Platform and Robot Assembly and Chapter 3: MicroPython and Development Environment Setup)
- Voltage (volts) and current (milliamps) as basic ideas
- The idea that a motor needs much more power than an LED
Learning Objective
Students will be able to explain (Bloom's Taxonomy: Understand) how a small GPIO signal on a MOSFET's gate switches a much larger motor current, and why a motor cannot be powered directly from a GPIO pin.
Activities
- Find the threshold (3 min). Students raise the gate voltage in 0.1 V steps and record the lowest voltage where motor current appears (1.5 V).
- Compare the currents (4 min). At 3.3 V, students read both meters and the ratio line for the normal and stalled loads. They explain in one sentence what "small signal, big current" means.
- Try the shortcut (4 min). Students turn on the direct connection and describe what happens to the pin and the motor. Discuss what could happen to a real RP2040 pin that is overloaded.
- Connect to the robot (4 min). Students find the motor driver chip on the Cytron board (or a board photo) and explain which part of the sim it replaces.
Assessment
- Challenge: Find the lowest gate voltage at which the motor starts to turn. Answer: 1.5 V. Then turn on Connect motor directly to GPIO and explain why the motor cannot work that way. Answer: the pin can only supply about 12 mA, and the motor needs hundreds of milliamps.
- Exit ticket: "Label the gate, drain, and source on a MOSFET symbol, and draw an arrow showing where the large motor current flows."
- Rubric (4-point): Exemplary explains the control path and motor path separately, names the threshold, and uses the current ratio as evidence. Proficient explains that a small gate signal switches a large motor current. Developing knows the transistor is a switch but believes the motor current comes from the GPIO pin. Beginning cannot say why the direct connection fails.
References
- Chapter 6: Electronics, DC Motors, and Communication Protocols - transistors as switches and why a GPIO pin cannot drive a motor.
- MOSFET (Wikipedia) - how metal-oxide-semiconductor field-effect transistors work.
- Transistor (Wikipedia) - background on transistors as switches and amplifiers.
- Raspberry Pi RP2040 Datasheet - electrical specifications for the RP2040's GPIO pins.
- Transistor Circuit Diagrams (Moving Rainbow) - the earlier transistor-switch MicroSim this one adapts.