3V motors with the Arduino Uno

Hi people! I'm really new to Arduino and so far i have just managed to make a couple if/else statements with a vibrating motor and LED's. I am now trying to make and obstacle avoiding robot. I have all the parts, but I was just wondering how to power two 3V motors with the Arduino without using a motor shield or an h-bridge. If I really do need and h-bridge, then where can I get one? There are none at Radioshack. I can buy resistors and transistors and all the other stuff, but I am trying to keep things simple. Just thought one of you experts out there could help me out. I don't want a code or anything, just some help as to what I could do. Oh yeah and I was wondering how to make those DC motors go backwards. Please help asap!!! Thanks!

P.S. I am powering the Arduino with a 9V battery.

You can't run a motor directly from an Arduino; you need some kind of driver. If you want it to go forwards and backwards, you need an H-bridge. Why are you against using a h-bridge or motor shield? Also, using a 9V battery will not last long... those things don't have the capacity to run motors for a long time.

I am trying to keep things simple.

If I were you, I'd get a motor driver shield. That would be the simplest.

ok. i will use the h bridge. the only reason i was against is was that i couldn't find it in any store. :P can you recommend a good place to buy an h bridge? and if i want to power the arduino without the motor shield, then is there any way i could do so? i am prepared to make a circuit using a breadboard. and if i have to get a motor shield, then where can i do that besides radioshack? i kind of have a budget, and it would go over if i used radioshack's shield. :P :P thanks!

oh and what kind of battery should i use?

I used this one, about nine dollars.


There are others though. That driver will power two 1A motors. I use it to drive 2 3volt Tamiya 'toy' motors.

I use a 9 volt to power the Arduino, then a two AA battery pack to supply current for the motors. The battery pack was about 1.50 and i found it in one of the bins in radio shack.

I'm sureyou could google how to make your own driver using transistors if you'd rather. If you buy the components at radio shack it might be cheaper to buy a driver board mail order.

My blog link below has some info about putting together a bot, probably similar to what you are doing.

Good luck!

thanks you very much! I will probably get the motor shield you have shown. just one more thing :) you said u used a 9v for the arduino, but AA pack for the motor. how do you do that? and how would i use the h bridge? you don't have to tell me everything, but maybe just the basics lol. :) :P i kind of get it, so thanks!

so how do i connect two different battery packs to the arduino, one for the power the other for the motors?

so how do i connect two different battery packs to the arduino, one for the power the other for the motors?

Most motor shields have 2 power inputs: one for the logic, and a separate one for the motors. You connect the logic supply pin to the +5v pin from the Arduino, and the motor supply pin to the positive side of your AA battery back.

The motor driver I referenced is not a shield, but just a small carrier board for the driver chip. It plugs in neatly into the mini breadboard on my protoshield.

Yes, there are a ton of connections to make. If you reference the link I gave above, you would connect the positive from the external battery pack to VMOT, and then the ground from the battery pack connects right below it.

There will be two leads to connect on each motor. AO1 and AO2 connect to one motor, and BO1 and BO2 connect to the other.

On the Arduino side, you will have 3 digital pins per motor. PWMa, AIN1, and AIN2 for one motor and like wise for the other motor. To go forward, you set AIN1 high, AIN2 low, BIN1 high, BIN2 low. Obviously, you need to set a PWM value to control the speed. Backwards would be low,high,low,high. To turn the motors off, set all pins low. To brake, all pins high. Turn - set o.e motor forward and one backward, depending on which direction. Or you can turn while going forward by making one motor go faster than the other.

The standby pin must be set high for the driver to function at all. You can do this either by tying it to VCC, or by connecting it to a digital pin and controlling it in code. I used a pin, and have plans of hooking a big button up to control a kill switch.

If you do get that driver, make sure to look at those posts I made, and feel free to use the code if you like too. If you ha e trouble, email me: Lonnie.Honeycutt@gmail.com

Okay thank you very much! I will try what you all have suggested and hope it will work. Yea and I will email you if I still can't get it to work. I might post a question again on the same post, because since this is my first actual robot, i am sure i will have many questions. Thanks!

oh and like dc42 said, does the driver you have the 2 power inputs? this is probably a stupid question, but yes....i am new and stupid. lol :P

Yes, that board has Vmot for the motor power supply and Vcc for the logic power supply.

Oh good thanks! :D

I think you'll be happy with the driver. I know the L293 and L298 are also very popular drivers. The TB6112 THY just happens to be the first and only one I've used so far. If I get another one, Ill probably just buy the bare IF and put it on a breadboard myself instead of paying extra for a Breakout board.

Just a heads-up- if you buy from the link I posted, you will have to solder the included header pins yourself. That's probably the case with most of them though. I am a novice solderer at best and it only took a few minutes.

Good luck and have fun!

That motor driver board uses the TB6612FNG chip, which has some advantages over the L293D:

  • double the output current rating (1.2A continuous vs. 0.6A)

  • mosfet outputs, which means that its voltage drop is less (0.7V max @ 1A, vs. 3.6v max at 0.6A)

  • built-in logic to prevent you from turning on both low and high side switches in the same half H-bridge

It makes me wonder why anyone uses the L293D.

Thanks! And yea i just started soldering, but i kind of get it.

Oh and this probably isn't the right subject, but I really don't get how to use my Parallax Ping sensor. I know how to connect it to the arduino, but I don't know how to set it up in the code and how to set the values and stuff like that. Is there any example? I went to your blog, MeanPC, and it was pretty cool, but I still didn't get how to set the code. Lol. :P

One more thing. I tested my motors, and even though they say 1.5-3V on the packet, it doesn't run in my 3V pin on the Arduino. It works great in the 5V pin though. So what is going on here? Thanks.

The 3.3V pin can only supply about 50mA, not enough for a motor.

Oh okay. So is it safe to use the 5V pin?

Only for small motors with very low current requirement. Better to use a 5v wall wart.

What about when I use the motor driver? Can I just use the batteries?

Didn't we cover how the battery pack would connect to the motor driver already? It will connect to VMOT, and will supply all power for the motors. The 5V VCC connection on the motor driver is just for logic level stuff.

I don't have the Ping, I have the Chinese HC-SR04, but I googled it for you:

First link shows you how to use the Ping sensor. Pretty in-depth.


2nd link is to a library so you can just do a #include on your programs and issue a simple command.


I haven't tried either one, since I don't have a Ping. You may need to find a newer Ping library if that one doesn't work with Arduino 1.0. If you have more questions, I think I'd start another thread in the Sensors forum.

Good luck!

Oh lol okay. Thanks!