I have an Arduino Uno and an inexpensive RC jeep with a functional DC motor and front-wheel turning servo, but I don't have an Ardumoto shield to control it (yet).

I'd really like to learn if it's possible and safe for my Arduino Uno (from back-EMF) to build a circuit to control it with the Arduino Uno, using some switching mechanism to power the motor separately from the Arduino Uno's 5 V.

I discovered the motor takes (I believe) a maximum of 6.8 V by connecting it to a 9 V battery (its label says it takes 9.6 V for the entire vehicle, including the front wheel servo and some LEDs). I connected the battery via my breadboard with an SPST mini switch and read the voltage with my meter. The motor has 8 ohms of resistance, so I figure it's pulling 0.85 A / 5.78 W.

I have some 741 and LM324 op-amps, some 1N4001 and Zener diodes, a variety of NPN and PNP transistors, including some TIP120 Darlington transistors, and several capacitors.

Could I use some combination of them to power the motor and servo while protecting the Arduino Uno from back-EMF? If not, I will order the Ardumoto.

If it helps, pictures of the jeep with tagged closeups of the stock motor/servo controller are here:


I've googled this extensively and also asked about it on Reddit. No disrespect to those guys, because their answers were awesome. But there was so much information between various sites and different posts on the subreddit, that it was a bit overwhelming and occasionally conflicting. I am just trying to learn and identify the best solution.

  • \$\begingroup\$ I know a few of the Reddit are very knowledge able, but I have seen really poor advice upvoted there. It is a problem I hope will resolve over time, mostly I see career advice. \$\endgroup\$
    – Kortuk
    Oct 23, 2011 at 6:24

2 Answers 2


Given that you can replace the arduino for under $30 (or for about $5-6 if the atmega chip is socketed, or a mere $3.50 for a blank atmega you can initialize on a breadboard using the arduinoISP sketch before you fry the current one), if you are more interested in learning about things, I'd say go ahead and build some driving circuits. On the other hand, if you just want to "make it go" buy someone's driver shield or serial-controlled driver module.

As an aside, "9v" batteries have very little current capacity and are not intended for motors - using one with a motor will cause it's voltage to sag severely, and it will run down quickly. Most of the components in your toy are connected in parallel - the 9.6v battery (probably consisting of 8 AA-size NiCd or NiMH cells) probably powers the drive motor directly, and the servo and perhaps electronics through a voltage regulator of about 5 volts (at least if they are standard parts). You should probably keep that scheme.

There are some things you can do to "protect" the arduino such as using opto-isolators (essentially an LED and a phototransistor molded in an IC-like package - you can make your own with discrete parts and heat shrink tubing) to transfer signals between the arduino (or radio receiver) and the servo and drive motor without their being any electrical connection between the two - each in that case requiring its own battery. However, most budget equipment simply relies on careful design and filters to suppress spikes, supply noise, and RFI. Amongst things you will see in R/C vehicles:

  • small capacitors across the terminals of motors, and/or between each terminal and the motor case

  • if the motor is unidirectional, a reversed diode across the terminals, if it is bidirectional four reversed diodes between the two motor terminals and two battery terminals.

Most likely you can work out a solution running everything off the same battery if you power the motor directly, run the servo off of its own 5v regulator, and run the arduino off of its on-board 5v regulator. Alternatively, you can give the arduino its own battery (perhaps 3 AAA's if you bypass the regulator) and establish a common ground connection between that and the motor/servo battery.

In terms of driver circuits for the main motor, the big question is if you are okay with forward only, or if you need forward and reverse. Related questions are PWM duty cycle speed control, electronic braking, and efficiency.

For a small toy with forward-only, you can simply use an medium sized NPN transistor as a switch in the negative lead (emitter to battery -, collector to motor -), with the base connected via a resistor to an arduino pin. A pragmatic approach would be to start with a large resistor such as 10K ohms and reduce the resistance just until the voltage drop across the transistor is reduced to about .6v - implying it is fully "on" and most of the battery voltage is available to the motor.

Doing forward-reverse control is more complicated - typically accomplished with an "H bridge driver" in which each leg of the motor can be connected to the negative battery terminal via an NPN transistor or the positive terminal via a PNP. Two control pins are required - 01 is one direction of rotation, 10 the other, while 00 and 11 both stop the motor. Building H bridges is a bit tricky - you have to be sure that the biasing is such that the NPN and PNP transistor on a side can't both be on at once and short out the power supply, but there are packaged solutions such as the L293 and L298 (which handles two motors).

Bipolar transistors do have substantial loss at low voltages, so higher performance vehicles typically use MOSFETs, but these are trickier to work with (especially in an H bridge configuration) and handle (they are subject to damage from static or overvoltage).

  • \$\begingroup\$ Wow, thanks Chris. That is a ton of good information. I do want it to retain its forward & reverse functionality, so it sounds like I will need an H-bridge circuit or to use MOSFETS. Based on that, I'm beginning to think I might be better off learning to crawl before I attempt walking. It's more important to me to understand everything I'm building/working with along the way than to get the motor working with components I don't fully understand yet. My new Ardumoto should be here by Saturday, so I think I'll just wait to use that. \$\endgroup\$ Oct 24, 2011 at 13:40

It is going to be safe to do what yuy want for a wide range of values of safe :-).
ie controlling a motor using a self built controller and a basic Arduino is not technically difficult, but there is learning along the way which y0u are going to need to be willing to do. Buying a piece if hardware that already works will ease your task. You'll get going quicker (probably) but learn less to much less. The choice is yours.

A number of your basic concepts and ideas "need improving" - and people here will be willing and able to help in this area. I'll not wade into a tutorial on areas where more information looks necessary yet - let's see which was you want to go first.

As shown below, if the Ardumoto will do what you want you can do it yourself reasonably easily. Whether this is worthwhile is TBD. This does NOT use back emf motor feedback to allow the processor to control speed. This is doable. Whether you want to do it can be determined "along the way".

It is "easy enough" to control motors like you mention without blowing up your Arduino - and also easy enough to blow things up if you insist on not taking enough care :-).

Note that the L298 can control motors up to about 4A. What current yuou motor really takes is as yet TBD - that's one of the misundertandings that need sorting out.

The L298 in a through hole package is $4.67 in 1's at Digikey. How much is an Ardumoto or equivalent?

The Ardumoto looks like as shown below and is based on the ST L298 full bridge motor controller
datasheet here

enter image description here

A complete motor control circuit can be as simple as shown below, and judging from the above picture, it probably is about this simple in this case:

enter image description here

That should do for now. Comments?

Motor control using a TB661FNG controller board available here from Sparkfun is very well covered in the lab experiment sheet referenced by tommutwoeyes in response to his own question. It's all there. It's now a matter of going through it all point by point and doing what it says.

As a guide, which really really really shouldn't be needed, as all the connections are already named, the diagram below, taken from the lab sheet, provides connection guidelines.

Note that they are using 7.5V for the motor and 5V for the IC. A suitable motor can be run from 5V DC BUT using a separate supply from the IC supply, but with the ground connections joined. means that it is easier to keep motor noise out of the IC.

enter image description here

  • \$\begingroup\$ Thanks, yes - that is very helpful. I did order an Ardumoto (they're about $25), realizing that even if I don't use it on this project, I'll have plenty more projects with which to use it. For this one, though, I am more interested in learning than getting it to work the easiest way. If my amperage calculation is off, how can I get a more accurate measurement? \$\endgroup\$ Oct 24, 2011 at 13:32
  • \$\begingroup\$ @tommytwoeyes - (1) Multimetetr on 10A or 20A range (low internal resistance) in series with motor. Maybe an electrolytic cap across meter leads to reduce noise. OR (2) Place small resistor in series with motor, connect elecrolytic cap across resistor +ve towards power +. Measure voltage drop across resistor. Small = 1 ohm, or o.1 ohm or ... . | With 1 ohm, drop is 1 volt at 1 amp. With 0.1 ohm drop is 100 mV per amp. So eg 2V meter range and 0.1 ohm resistor gives 0-20A range = 10 mA resolution for 0000 - 1999 reading range. Using 200 mV range and 0.1R gives 2A max and 1 mA resolution. \$\endgroup\$
    – Russell McMahon
    Oct 25, 2011 at 16:11
  • \$\begingroup\$ Hey guys, I ordered a TB6612FNG to drive the single motor in the RC jeep, and it arrived a couple of days ago. I have looked at the datasheet [PDF] and some examples demonstrating connections to the driver here and here [PDF], but, being a total n00b with this stuff, I am still not clear on exactly how to connect this driver board to power and to my Arduino. Does anyone know of any videos, images, or other documents depicting how to connect all of these pins? \$\endgroup\$ Oct 30, 2011 at 18:45
  • \$\begingroup\$ @tommytwoeyes - ALL the information you need is in the lab sheet See the addition at the end of my answer. \$\endgroup\$
    – Russell McMahon
    Oct 31, 2011 at 2:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.