Pages: [1]   Go Down
Author Topic: Starting and Stopping a DC Motor  (Read 722 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Adam
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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: http://itp.nyu.edu/physcomp/Labs/DCMotorControl

If you are more interested in a quick and dirty "on and off" type solution check out: http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads

The best of luck with this and keep us updated with how it's going!
« Last Edit: October 20, 2012, 05:04:50 pm by Bob101 » Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 25
Posts: 1873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

See http://www.oomlout.com/oom.php/products/ardx/circ-03

Mark
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31462
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You might want to read this:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

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

Quote
Would I need to get a second battery,
No just feed the arduino power jack with the same supply as you feed the motor.
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 25
Posts: 1873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Mark 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Poole, Dorset, UK
Offline Offline
Edison Member
*
Karma: 25
Posts: 1873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Mark
Logged

Pages: [1]   Go Up
Jump to: