Starting and Stopping a DC Motor

Hello everyone,

I'll start off by saying that I am completely new to arduino boards, so bear with me. I am trying to do something very very simple, but I am worried about frying my board by randomly trying things. Essentially, I have a 9 volt DC motor that I want to wait thirty seconds after starting the program, then turn on. I've looked at many different tutorials, none of which really helped me. All I have for this is an Arduino Uno, no shield or anything like that. I have a bread board and a 9v battery. Where do I even start? I thought perhaps using the blink function (basic tutorial) for the LED and then wiring the battery in would work, but that obviously didn't. I appreciate the help from everyone, hopefully I can get this working and do you proud!


Welcome to the Arduino forum,

I should start by saying that I am a n00b myself but I have managed to get a DC motor working using a motor shield.

To use an Arduino to control a motor bi-directionally you are going to need a H-Bridge. If you are just interested in moving the motor one direction then you will at least need a transistor and some diodes. To put it bluntly, the Arduino does not have enough power to move a motor directly through its pins, so you can't just wire the motor to the pins and expect it to turn!

The idea is that you use the Arduino to control a relay or more commonly a transistor to connect the motor up directly to the battery (not through the Arduino).

There are quite a few tutorials online for how to do this but most use at least some discrete components (often a pre-built H-bridge chip). For an example check out:

If you are more interested in a quick and dirty "on and off" type solution check out:

The best of luck with this and keep us updated with how it's going!

By buying a transistor!. You can't run a motor directly from an arduino (or any other processor chip!) you'll fry the chip.



Ok, so I have a transistor, and I was looking at the diagram that holmes4 posted. If I am powering the Arduino with a 9v battery, how do I power the motor at the same time? Would I need to get a second battery, and if so, where does this power source come in on the posted diagram?

You might want to read this:-

Motors and 9V batteries are not a good mix, they don’t last very long.

Would I need to get a second battery,

No just feed the arduino power jack with the same supply as you feed the motor.

It depends on your motor in the kit that goes with the diagram the motor is a small (toy) 5v motor so you use Vcc. For smaller motors use 3.3v. For larger motors an extra battery is a good idea. +ve of the battery to the motors +v in the diagram and battery -ve to ground.


Well I got it up and running thanks to you guys! I can now control the delay from start to stop, using most of the code from the blink function. Thanks again, hopefully there won't need to be any trouble-shooting in the future!

Now look at the "blink without delay" example and see if you can't get control of the speed of the motor. For example turn the motor on for 10 mills and off for 10 mills will get you something about 1/2 speed. Have full!