how can i add more motors to work for the arduino

Hello guys and thanks for reading this. im working on a important project and i need motors to run on 9volt power but when i attach one motor to the arduino duimilanove that i have the motor is not spinning fast enough. can someone plese tell me how to make to motor spin faster and also i have to add 3 more motors so can someone please tell me how to make four motors spin fast from an arduino duimilanove ATMEGA328.
THANK YOU

i need motors to run on 9volt power

With a sense of foreboding, I'm going to ask the question "what is providing the 9V?"

can someone plese tell me how to make to motor spin faster and also i have to add 3 more motors so can someone please tell me how to make four motors spin fast from an arduino duimilanove ATMEGA328.

Use an appropriately large external power supply, which usually requires some type of motor controller.

what they are saying is that you've not really provided any information for us to even try to answer your question.

What kind of motor is it? How fast is it going, and how fast do you want it to go? How are you powering it, and how are you connecting it to the Arduino? Are you using an H-Bridge?

We need more information from you to even try to help.

ok thank you for your replies first i have nine volt batteries and i was wondering is there any way i can make the motor run on nine volt batteries from the arduino and if their is can someone please tell me how? the motors im thinking of using is between a radio shack 1.5v-3.0v DC motor and a 7.5v dc motor alsofrom radio shack. also when i connect the motors to the arduino the arduino does not give the motors enough power to get a high rpm but when i connect the motors to a nine volt batteries i received way more rpm and that is what im trying to do. and ive ordered 2 motor controllers now im new at the arduino and i don't want to mess up on my project so if motor controllers are the only way how would i program them to control motors and their speed and when to turn them on and off and how would i connect it to an arduino duimilanove ATMEGA328. any help or links would be greatly appreciated

You should not be powering either of those motors directly from the arduino, as you will damage it.

Arduino pins can provide an absolute max of 40mA but its really better not to exceed say 20mA. You see the motor turn faster when connected directly to the battery because part of the batteries power isn't being used to heat your arduino unnecessarily.

You will need additional components to switch power to the motors, that way the arduino can simply control the motors and not try to power them directly. Depending on what kind of control you want over the motors this could be as simple as a transistor or relay, or it could be more complicated, googling h-bridge could help.

Finally, 9 Volt batteries are really expensive for current capacity compared to pretty much any other option. And they don't work that well under relatively high current demands (read DC motors here). And you haven't described anything that needs 9V in the first place so it looks like you would be using a good deal of your power heating various voltage regulators or something anyway. Consider AA's?

"You will need additional components to switch power to the motors, that way the arduino can simply control the motors and not try to power them directly. Depending on what kind of control you want over the motors this could be as simple as a transistor or relay, or it could be more complicated, googling h-bridge could help."

based on what you said can you elaborate on how i can switch the power of the motors because all i want is to make the motors(4 of them) spin at maximum rpm when i press a button that is linked to the arduino and thats what i want to control. plus i need them spinning at max rate for like a minute and thats it. so how would i make the arduino control that and which path would i have to take and also i have ordered two motor controllers are those a possibility and if they are how would i do that?
Thank you for your help

What motor controllers? I think they are a good possibility and with a link it will make answering other questions much much easier.

This shouldn't be very difficult to setup and code for, you just need to make a couple more decisions, mainly how to power it.

Nah.. he wants it super simple-- all four run at max together, just switched off and on by the arduino. He doesn't even need a motor controller, he can get away with a power transistor or a small relay if all he wants is just to switch power on to the motors, wait some time, and then shut them off.

If you arent trying to control them individually and they all just need to turn in one direction at max speed, it's basically a timed switch he needs. Somebody around here can probably recommend an N-channel mosfet, I'd probably just use a TIP120 or something. Without knowing the draw of the motors, it's hard to pick a particular transistor.. or he could just use a small signal transistor like 2n3904 to switch a relay off and on, and then he can just use the relay output.

All you'll need is a base resistor (1k is usually decent when ballparking) and the small transisor and whatever relay you want to use. A flyback diode probably is a good idea too if using a relay.. like a motor, there's an inductive spike with the relay coil. Some small relays include the diode inside.

You'll need a single output and a single input, and a super simple program on the Arduino, no matter which switching method you choose.

hey for the motor controller here is the link http://www.robotshop.com/sfe-2a-5v-16v-dual-serial-motor-controller-4.html. for the motors i want to make them all turn at full power at the same time and at max speed so if i use a timed switch would the motors still require their own power source witch i wanted 2 use 9v batteries for each individual motor and how would i code that so that the arduino turns on the motors. the two motors i was thinking of using are RadioShack.com Official Site - America's Technology Store or http://www.radioshack.com/product/index.jsp?productId=2102828
thank you for your help

jjmuteteke:
hey for the motor controller here is the link http://www.robotshop.com/sfe-2a-5v-16v-dual-serial-motor-controller-4.html. for the motors i want to make them all turn at full power at the same time and at max speed so if i use a timed switch would the motors still require their own power source witch i wanted 2 use 9v batteries for each individual motor and how would i code that so that the arduino turns on the motors. the two motors i was thinking of using are RadioShack.com Official Site - America's Technology Store or http://www.radioshack.com/product/index.jsp?productId=2102828
thank you for your help

As already stated, if you only wish to turn all the motors on and off at the same time at full speed, then you most certainly don't require the expense and complexity of motor controllers. Simple transistor switches is all that you require. 9 volt DC batteries are a very poor choice for powering your motors as they provide minimum current and low total capacity, they are a heavy cost sink.

Lefty

ok so based on the motors i stated witch transistor switches would i need and also is their any other power source that i can use that still can povide me with max power for the motors.
thank you for your help

Well, those are hobby motors, I'm guessing they probably want as much as 200mA each if you have some kind of load on them, they are rated for 100mA normally. Give yourself a little room for overhead.

That's 200mA x 4 , 800mA

Now, that's within the ratings of a 2n2222, which you can get at radio shack for cheap, but they also sell TIP120, which is
rated for MUCH higher current and can easily handle the motors. You might get away with a 2n2222, but it will get awfully hot I'm willing to bet. You'll do better using something more meaty for a transistor, so it can handle the heat caused by the power running through it a little bit better. You circuit will run cooler and last longer.

Assume that any transistor is going to have a 2v drop. Darlington transistors like a TIP120 drop as much as 3v. Luckily, motors are pretty voltage tolerant.

What they are saying about the 9v batteries is that for their size and weight, they won't be able to power those motors for very long. Minutes, most likely. You would be much better off getting a battery holder (say from Radio Shack or whatever) that will allow you to use AA batteries. Your motors want 7.5v, so we'll try to give them around 9-10v to account for the transistor voltage drop.

That's 1.5v per AA, so it's 6 AA batteries (connected end to end, what's called Series) to give us the 9v we want. Six AA's will run those motors for a while at least, a heck of a lot longer than a poor little 9v! Think of it this way.. if we connect eight AA batteries together, that will give us a 12 volt battery (1.5volts each). Your car battery is also (roughly) a 12v battery. However, if you disconnect your car's battery and try to crank her over using those eight AA's, you are going to be out of luck. The AA's provide the right voltage, just cannot provide the amount of Current the car needs to operate the starter and all that. The 9v battery is like that.. it's got the right voltage, but what it carries for current is too small to be very long-lasting with most motors.

                                                                         -----------------<MOTORS>-----9v
                                                                        /
                       Arduino Digital Pin 8 --------\/\/\/\/----[transistor]
                                                                        \
                                                    1k resistor          -----------------GND

all the motors should be connected in parallel, not daisy chained end to end. This is the setup for an NPN transistor, 2n2222 and TIP120 are both NPN. For a PNP transistor, the motors would go between the transistor and ground instead of between the power and the transistor. Think of the transistor as a switch. The "base" takes in a small input and turns on or off accordingly. The other two electrodes are where the power and the load go.. not so hard to understand, really. You should also have a diode to handle the flyback spike, it gets connected in "reverse" across the motor. In short, motors can cause a power spike that can kill other components unless you are careful. That diode (1N4001 is what I use, cheaper than dirt) is your protection from that spike. You could also use a smallish ceramic capacitor, but I prefer diodes as they are foolproof.

Here, I want you read this.. it covers a number of really good options in a really well done tutorial:

http://www.me.umn.edu/courses/me2011/arduino/technotes/dcmotors/motorcontrol/motorcontrol.html

When the author refers to "fancy version" of motor control, he means the chip on that controller board you pointed to. Besides being overkill, it interfaces via Serial, which is great in some respects but not so great in others. He refers to it in the section named "Bidirectional Motor Control". It's just more pain than you need and certainly more cost.

The code will be very simple. I picked pin 8 randomly by the way.

You'll just be doing:

digitalWrite(8, HIGH);

to turn the motors on, and

digitalWrite(8, LOW);

to them off.

Now, all you need to do is detect the switch and add a few delays for timing and you're cooking with gas.

first for the 9v batteries i only need for my project to run for a short period of time and also for the motors how would i put them in parallel and from that schematic do i need to multiply the components time 4 for each motor and will all four motors run at max power from one pin. also would it make any difference if i used the PWM pins from the duimilanove ATMEGA328. if so how would i make the programming to control all 4 motors
thank you for your help

P.S. would you happen to no how to program a usb host shield

p.s.s. would two motor controllers make it more complicated and time consuming?
again thank you very much for helping me

jjmuteteke:
first for the 9v batteries i only need for my project to run for a short period of time and also for the motors how would i put them in parallel and from that schematic do i need to multiply the components time 4 for each motor and will all four motors run at max power from one pin. also would it make any difference if i used the PWM pins from the duimilanove ATMEGA328. if so how would i make the programming to control all 4 motors
thank you for your help

I've updated focalist's schematic to (hopefully) make it more clear how to hook things up (and to label the pins of the transistor); the collector of the transistor goes to the motors, the base of the transistor to the resistor (and on to the Arduino), and the emitter goes to ground. I've shown three motors connected to the transistor in a parallel configuration - I'm sure you can see how to add the fourth:

                                                                                      +----[Motor1]-----+
                                                                                      |                 |
                                                                         +------------+----[Motor2]-----+---- 9 VDC
                                                                         |            |                 |
                                                                         |            +----[Motor3]-----+
                                                                         |            |                 |
                                                                         |            +-------->|-------+
                                                                         |               Flyback Diode (1n4001 or similar)
                                                                         |
                                                                         / Collector
                                                            Base        /
                    Arduino Digital Pin 8 --------\/\/\/\/--------[NPN transistor]
                                                1k resistor             \
                                                                         \ Emitter
                                                                         |
                                                                         |
                                                                         |
                                                                         +---------------- GND

jjmuteteke:
P.S. would you happen to no how to program a usb host shield

I can't comment on that - it seems a bit out of left field; why do you think you need a USB host shield for motor control (or is it in relation to another task)?

jjmuteteke:
p.s.s. would two motor controllers make it more complicated and time consuming?

The only real reason to use motor controllers (for this project) is if you need the capability to:

  1. independently control each motor
  2. independently control the speed of each motor
  3. independently control the direction of each motor

If you don't need any of those capabilities, then using one or more motor controllers will only raise the cost of the project and make it larger while causing it to draw more current; if you insist on using 9 volt batteries, larger isn't the direction you want to be headed in (for your small motors, I agree with everyone else that using a 9 volt PP3 battery is the -wrong- choice; the battery will not last long at all, and they are expensive to replace as well).

I've updated focalist's schematic to (hopefully) make it more clear how to hook things up

What no 'flywheel diode', I thought you knew better. :grin:

All four motors as Crosh has shown. Using one of the PWM outputs would even allow you to vary the speed of the motors. PWM simply turns the power off and on really fast to provide what "looks" like a variable supply to the motors. However, it makes sense to walk before you run, so stick with off and on at first. Only the software will change (and only a few lines) to add PWM speed control, the hardware stays the same.

Stick with the idea that the transistor is a valve and the arduino "turns" that valve off and on via the base of the transistor. The valve lets the current flow, which turns the motors. It's really not all that different than waterand plumbing, and people understand pipes and valves pretty well. The 9v battery works in that model too- it's got plenty of water pressure, it's just got a tiny tank.

By the same token, the digital output of the arduino doesn't have a big enough tank to run the motors either.. but it does have enough to turn a valve off and on, which can be connected to whatever water reserve you want. The "water" flowing through the "pipes" (wires) is what makes the motors turn around... and Ground is simply where it all goes down the drain. :wink:

It's a really crude analogy, but it's helped me more than once.. and starting out, demystified things quite a bit- even if a bit inaccurate for the sake of making it understandable to a neophyte..

It's really not all that different than water, and people understand pipes and valves pretty well.

Good, could you come over and solve an intermittent leak I have under my kitchen sink. Oh and bring a bright flashlight with you. :wink:

No prob, as long as the ticket is waiting at Logan. I'd love a few days in Frisco.. far too long since I've been, and I love the city. Almost as much as I like the Humboldt country and Big Sur. Heck, I find most things north and south of LA to be pretty great, just skip 100 miles on each side as a sort of quarantine, and California becomes a lot nicer place. I was born in San Diego but moved away as a young kid... Navy brat. Los Angeles is...ummm...Hmm. Gommorrah? Okay maybe that's a LITTLE overboard, but you get the sense of my feelings about that fine metropolis. I'd miss Cali if it fell into the ocean, LA not so much. I've not been to Frisco since I got back into photography.. and Frisco is one of the most picturesque cities in the world. Come to think of it, I think I might have to start ferreting away nickels and dimes. I didn't go anywhere this year, but I usually try to travel for a few days every late winter to just do photography and get away. Frisco would be a great destination.

Own a house on a fixed income, and you learn about tradeskills you never imagined you'd be doing... I can't afford a plumber or an electrician or a carpenter every time something dies or breaks. Sometime before the fall, I need to sweat a new solenoid valve, cutoff and about three feet of pipe into the heating system plumbing or I'll not have heat.. but I learned how last time one went, so this time it's just a matter of getting the parts and then having a time to do it. I tend to work in spurts when I'm feeling good, and plan/purchase during the other times so when I feel decent, I'll be looking "at" it, rather than looking "for" it, whatever it may be. I've gotten smart enough to stockpile things like PVC and Copper pipe, a small spool of 12/3 Romex, breakers and GCFI sockets in the basement on a shelf. Not a ton, just realistic amounts- I rarely buy ONE of anything, as if it broke once, it's gonna break again sometime, most likely. If I'm not Jerry-rigging one thing or another to an Arduino, I'm Jerry-rigging some appliance, device, chunk of furniture, wall covering, or family pet to avoid calling one "pro" or another... hehe. By the way, I don't suppose one can still get Ether very easily, and they want to know WHY you want to buy suture kits, whether or not it's LEGAL to buy them or not. Sometimes it's a good thing I can't get required supplies, I think.

You become a master of Duct Tape, PVC pipe (both for plumbing and for building lightweight frames and supports), Epoxies of every flavor, goops and sealants, and eventually even how to do some things right. I plumbed in our kitchen sink, all the way to the outflow including cleanouts.. and it has one of those nice pull-out-kinda-thing spouts and all that, a Boiling Water tap (neato toy I got as a gift), as well as garbage disposal and dishwasher... not a single leak in five years.. The thing is a deep-bowl double sided monster.. made of Black synthetic granite. More durable and lighter, kinda like Corian, but I forget the name. DuPont polymer something or other. Looks pretty snappy.