Arduino DC Motor

Controlling a DC motor with Arduino

Purpose of this tutorial:

In this tutorial we will order a DC motor by the Arduino board:

1- When we press the push button, the motor turns

2- When we release the push button, the motor stops.

Necessary components

  • Arduino UNO
  • DC moteur
  • relay
  • push button
  • connecting wires
  • test plate


As for the assembly, we can connect

  For relay:

  • (S) pin to pin 2 of Arduino
  • (+) pin to 3.3V pin of Arduino
  • (-) pin to GND pin of Arduino
  • ON pin to 5V of Arduino

For DC motor:

  • the first terminal to COM pin of the relay
  • the second terminal to GND terminal of the Arduino

For push button:

  • the first terminal to the digital terminal N°1 of Arduino
  • the second terminal to the GND terminal of Arduino


Here is the program that allows to control a DC motor by Arduino.

1 commentaire

Stefan 18-11-2121

My DC motor doesn't turn on at all. I did the exact same thing as you. But if I plug in a LED instead of the motor, the LED turns on. Any ideas why? I connected the relay directly to arduino board..

Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top