This is the simplest motor driver that could possibly be built using only one NPN transistor, which is controlled and driven by the ESP32 micro controller board.
Step 1: Materials and Tools
- ESP32 Microcontroller
- DC motor
- NPN Transistor — BC337
- 100Ω resistor
- Diode — N4148 General Purpose
- Breadboard wires
- Breadboard’
- 2x jumper wire
Step 2: Connecting the Signal
Connect a 100Ω resistor to the base (middle) pin of the NPN transistor to protect the EPS32 board from overvoltage, then connect it in series to D5
Step 3: Connecting the Power Supply
- Connect the collector (right) pin to ground.
- Connect the emitter (left) pin to the positive pin of the general purpose diode.
- Connect the negative pin of the general purpose diode to 3.3V.
Step 4: Connect the DC Motor
- Connect either one of the pins to either end of the diode.
Order does not matter, it only changes rotation which is arbitrary and can be coded as active high or active low.
Step 5: Coding
Choose ESP32 as the board under tools, and plug it in. Choose the corresponding USB port that is labeled ESP32, then upload the following code to the board.