Let's Make Robots!

Driving a motor with arduino...

I need some help with driving dc motors with arduino. I have already looked at the arduino site and all I found was this http://www.arduino.cc/en/Main/ArduinoShields and no guide or parts list.

I have gone thru all of the lessons here http://www.ladyada.net/learn/arduino/  and ithas been really fun so far but I WANT TO BUILD ROBOTS! NOT BLINKIE LIGHTS! :)



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


This is my first post here.  Maybe I'm paranoid or just dense or overthinking this, but I can not find this info anywhere.  I have a GWS Mini servo with r/br/o wires and "J" connector like shown here:


Signal would come from whichever PVM pin I assign in my code and Red + / Brown - would be from the board (or aux power) and be on at all times?  No resistors/diodes required?  Just want to make sure I don't blow up anything...  This will move my IR sensor back and forth.

I just got my Arduino and don't want to let the magic smoke out of the chips!  :)  Once I get this going, I will try out my Polou Micro Dual Motor Controller with the motors/wheels Fritsl had listed here.


Thanks for any help!


I used an Arduino for this robot: http://letsmakerobots.com/node/556. I connected the signals directly to the output pins and I haven't released the magic smoke yet. I have researched the resistor or no resistor subject on the net and some people add a resistor and some don't. If you want to be on the safe side, you can add a 330ohm resistor like the Picaxe crowd does.

The servos in my solution are powered by a separate power source. That is, I have a 9V battery connected to the Arduino and 4 1.2V cells for the servos. The GND signal of the two power sources are connected to create a common ground. 

Hope this helps.


I am on thin ice here, but I am pretty sure the 330 ohm is only because the servo (depending on make) can generate quite much electrical noise. What this could mean is that the chips controlling it would get a little disturbed, perhaps resetting or acting iradical.. But no smoke :) It is not the chip that is powering the thing, so there should not be any worries.. unless crazy behavior from the chip seams frightening. 

/ Fritsl

The resistor will not protect you from noise. You would need a capacitor for that, but the resistor will limit the current. Also, the noise is on the supply lines, not the control lines.

Btw: Check this out for info on servos: http://www.princeton.edu/~mae412/TEXT/NTRAK2002/292-302.pdf

Awesome, Thank you!  Nice walker you've got going on there.  I havn't decided what to build yet.

well after a good half an hour reading all his and followning links i have decided the i need one of those polou motor controller thingos and a few servos to make my new brain bubble robot ( idea ) the ....( drum roll please.)


it will be prety neat combining all ideas from like ever into a single robot. im exited. ( not really cos its 10 pm)... bed time.

As an FYI, Pololu sells a line of Orangutan robot controllers that feature ATmega168s AVRs (the same microcontrollers that Arduino boards have) along with additional hardware such as built-in dual motor drivers, which can greatly simplify the electronics side of your robot.  While not officially Arduinos, they can be programmed with Arduino library code from the Arduino IDE (after some minor reconfiguring) using an AVR ISP programmer, or you can just use WinAVR with AVR Studio.

They're not intended for beginners, but they're great if you're familiar with AVRs or if you're looking to upgrade from something like a Basic Stamp to a higher-performance microcontroller.

- Ben

I just bought and arduino because all i own in my house are macs, and i wanted to mod out a car for my first project. All i need to do it make it control a motor backwards and forwards so i was thinking about this relay because is able to be done on 40 mA and thats what a arduino i/o pin can source http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=842953 is there any reason this relay wouldn't work for driving a motor with out a transistor or anything. It is DPDT so it will be able to back and forward on the car from one i/o line. So please tell me if this wouldn't work before i go wast three dollars on some relay that will never work. Oh and this relay should be able to hand the motor in the car its only 12 v and like 500 milliamperes



Edit. I Would add another transistor 2n3904 between the battery for the motor and the line going in to kill the power to the motor when it wasn't in use. this would be connected to another I/O line. i think this is probably the best solution for me because i am able to control one motor with two i/o lines stop reverse and forwards . So if i were to use a hbridge i would have 8 lines for 2 motors to do the same i could do with about 4, not with all the functions with most of the basics ones though.