Electronics 01
How to Drive a Relay or Motor from Arduino with a Transistor
Wire a relay, DC motor or 12 V LED strip to an Arduino or ESP32 pin with a PN2222A or a MOSFET: base resistor math, flyback diode, pin limits and heat.
Wire a relay, DC motor or 12 V LED strip to an Arduino or ESP32 pin with a PN2222A or a MOSFET: base resistor math, flyback diode, pin limits and heat.
Dividing load current by hFE gives a base resistor that leaves many transistors half on. Size it for a forced beta of 10, with worked 2N2222 and BC547 examples.
A transistor doesn't make energy: a millivolt on the base steers current from the supply. Transconductance, gain = gm × RC, and a worked common-emitter design.