I've got a circuit with Arduino UNO Rev3, DC motor, button to switch direction of rotation and potentiometer to regulate revs. The problem is that usually when I increase voltage using potentiometer, motor doesn't want to start rotating by itself and it does only when I move its shaft with finger or when I press the button again. I would undrestand that it can be due to friction and that's why moving shaft with finger helps, but why does motor start rotating when I press the button changing direction?

Here is my circuit: enter image description here

And here is my code:
enter image description here

  • 1
    Please see why we shouldn't post images of text. We don't know much about your motor or how the motor is interfaced to the Arduino. Commented Jul 1, 2021 at 13:54
  • I might not drive the motor directly off the Arduino like that; even a wee motor can draw more current than the Arduino can handle. Commented Jul 1, 2021 at 14:16
  • 6
    Disconnect that circuit immediately - you are damaging your Arduino
    – Majenko
    Commented Jul 1, 2021 at 14:22

2 Answers 2


Firstly, you need a motor driver to drive a motor from an Arduino. You cannot drive it directly from IO pins.

Secondly by using a potentiometer like that for controlling the speed you are massively starving the motor of power (not that the Arduino can provide such power, and if it could then the potentiometer would smoke).

Your design should be:

  • Potentiometer into an analog input to control the speed using PWM
  • Outputs from the Arduino to control the direction (GPIO x 2) and speed (PWM) to a motor driver (L293 is commonly available)
  • Motor connected to the motor driver
  • Power supply suitable for your motor connected to the motor driver

There are many many examples on the web that show you this kind of circuit. Follow one.

  • Thanks for the answer, but I would like to regulate motor speed manually not by changing PWM value in the program.
    – Maciaz99
    Commented Jul 1, 2021 at 18:02
  • 2
    Then you need a motor driver that will take an analogue input. You can't just slap a potentiometer in there and hope it'll work.
    – Majenko
    Commented Jul 1, 2021 at 18:03
  • Thanks, I'll try it. Fortunately I've got L293d.
    – Maciaz99
    Commented Jul 1, 2021 at 18:17
  • 1
    @Macios216 "Regulating it manually" and "changing PWM values" are separate issues--the means of determining the PWM value is arbitrary. Take the pot value and map it to the PWM value. Commented Jul 2, 2021 at 14:03

First of all, disconnect your Motor which is directly connected to your UNO if you want your Board to be safe and sound.

Arduino or any other microcontroller ICs are not made for directly running High powered loads.

The work of a microcontroller is to produce signals which must be run through a transistor or an IC amplification method to drive high loads.

You are running the Motor directly from UNO pins. What wrong may it go?

  1. If your motor consumes current more than 20mA then the pin where you connected the arduino is to heat up and will burn if you continue further.
  2. Let's suppose your motor consumes current less than 20mA, still it has a high risk that a motor sometimes creates very high voltage and current surge in a specific condition.

If you continue to do so, you will end up burning those pin completely.

So what befits your project seems to be a motor driver IC like L293D or L298N

Instead of a motor, connect Motor Driver IC logic level input to digital output pin 3 and 4 of Arduino then connect a motor to the output of the Motor Driver IC

More about these ICs can be found in Datasheets

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.