Motor with Arduino (without MOSFET)

Hardware Required

  • Arduino Board
  • Resistance
  • Zener Diode ( Optional )
  • Motor
  • MOSFET ( may not be necessary )


We should not connect two separate voltage sources to each other. For Example, Don’t try to hook both the 9 V supply & the Arduino’s 5 V supply into the same supply row on the Breadboard.

we would be using Pulse Width Modulation (PWM) techniques for controlling motor speed. So please have a overview over that article for understanding this article properly.


In the scheme, we use:

TIP 120 ( BJT )

It is an NPN bipolar-junction transistor (BJT) used for switching the seperate 9 V supply to the motor. Further there are two types of BJT s, NPN and PNP, which refer to the different Semiconductor doping techniques used to create the transistor.


Every BJT has three pins :

  • The emmiter (E)
  • The collecter (C)
  • The Base (B)

Current flows in through the collector and out of emmiter. By modulating the base pin, you can control whether current is permitted to flow. When a sufficiently high voltage is applied to the base, current is allowed to flow through the transistor and motor spins as a result.

Zener Diode (optional)

We connect a Diode in parallel to the motor to protect our Arduino from reverse voltage spikes caused by motor ( acting like and inductor ) .

DC motors are like Inductors which store energy in their magnetic fields and resist changes in current. As the DC motor spins, energy is built up & stored in the inductance of motors coils. If the power is instantaneously removed from the motor, the energy is dissipated in the form of an inverted voltage spike, which could prove harmful to the power supply. If we put diode across the motor we ensure that the current generated by the motor flows through the diode & that the reverse voltage of the diode (because diodes allows current to flow in one direction only).

Benefits of using BJT

As the motor utilizes high amount of current that could damage the Arduino.
With the help of BJT, we take advantage of current & voltage limits.


This is code for running motor without MOSFET.

// Simple Program To Control Motor Speed
const int Motorpin=9;
void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:

for(int i=0;i<256;i++)
{ analogWrite(Motorpin,i)
delay(10); //delays programm for 10 micro second
delay(2000); //delays programm for 2 seconds .

for(int i=255;i>=0;i–)

{ analogWrite(Motorpin,i); //gives voltage values
delay(10); //delays program for 10 micro second


Some Functions used in this Program

analogWrite(): Used to give analog Values to the Arduino Pins (PWM pins only). It requires two parameters one is Pin no and other is Value to write.

delay(): Used to stop the program for few milli second.