## ASK AN EDUCATOR! “How can I control an old RC car with an Arduino?”

I’d like to pilot an old RC car with my Arduino.
The motor seems to need something like 600mA @ 9V (thanks to my Amperemeter).

I’d like to know how to do that with a transistor ?
When I make tests, as the base current I put may be too small, my motor don’t move at all.
Same thing when I plug the motor to the battery with a potentiometer, the motor move only if the potentiometer value is less than 2 ohms !

In brief, I’d like to know how to control a motor with an Arduino, the hard way (not with a special shield), and how to calculate the values needed.

Actually the “hard way” is really quite simple, and you only need a few components. Here are two options:

Single direction control (CW only or CCW only):

I would recommend starting with a two TIP120s, one for each motor. The TIP120 is a Darlington transistor which is capable of switching a DC load up to ~5A. Because this is an NPN transistor, you will actually be connecting and disconnecting the negative terminal of your motor, while keeping the positive attached. This makes it easy for the Arduino to turn it on and off (digitalWrite(pin, HIGH) & digitalWrite(pin, LOW). This site gives a good overview, although I would recommend using a base transistor.

You can calculate the proper base resistor by using the following calculation (derived from ermicro):

From Arduino:
Vport = 4.2V (the minimum logic HIGH voltage from a 5V powered micro controller)

From datasheet:
Vbe = 2.5V
Ic = 1A (desired current)
hFE = 1000

Ib = Ic / hFE = 1 A / 1000 = 0.001 A
Rb = (Vport – Vbe) / Ib = (4.2 – 2.5) / 0.001 = 1700 Ohm, use 1.8k Ohm resistor
P = (Vport – Vbe) x Ib = (4.2 – 2.5) x 0.001 = 0.0017 watt, use 0.25 Watt resistor

Bi-directional control (CW and CCW):

I recommend looking at the L293D. It’s easy to use, not to expensive, and has protection diodes built in. An H-Bridge allows you to digitally reverse the polarity of your motor as well as turn it off.

In both scenarios I would recommend controlling the motors using PWM as you can digitally control their speed.

I did a previous post giving a much more detailed overview of controlling motors using the Arduino if you are need of more info!

Good luck with you RC car, and feel free to ask if you need help controlling it remotely!

Don’t forget, everyone is invited to ask a question!

“Ask an Educator” questions are answered by Adam Kemp, a high school teacher who has been teaching courses in Energy Systems, Systems Engineering, Robotics and Prototyping since 2005.

Check out all the Circuit Playground Episodes! Our new kid’s show and subscribe!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

1. Another way to control an RC car’s motor is to use the same device most RC cars use. It’s called an ESC for Electronic Speed Control and it’s controlled the same way an RC servo is controlled. That is, you send it a repeating pulse train and vary the width of the pulse to control the speed of the motor. So, this means you can use the Arduino’s Servo library to control it. Just be aware that there are some nuances such as the fact that most ESCs can control a motor in both forward and reverse and also can have a braking feature. The typical approach is that a neutral position pulse (servo centered) is OFF and that a longer and shorter pulse widths engage forward and reverse.

Wayne

2. Garrett

I couldn’t agree more. I assembled a couple of those kits back in their Halcyon days (late 80s early 90s.)

Keep in mind there were two ways an RC motor could be controlled. The old way was via servo, where the servo would rotate an "arm" onto the appropriate metal pad completing a circuit that would drive the motor forward at 1/3, 2/3, full, or reverse speed. These were replaced with electronic speed controls which for the purposes of maintaining backward compatibility with the radio receivers accepted the servo input signals directly. So basically you can reverse engineer the PWM by plugging it into a square wave generator.

The best part about controlling an RC car via PWM into a "servo" ESC is that you can use the exact same trick to control the STEERING which is likewise controlled via a servo.

3. Garrett

Finally I found an image of the classic servo speed controller:

http://i.ebayimg.com/00/\$%28KGrHqR,!l!E1F4dZbsSBNdtJ3D+Cg~~_3.JPG

You’d take the rotating-arm-thing and mount on top of a servo with no arm (just the gear) and affix the plate to something solid.

Sorry, the comment form is closed at this time.