Use Arduino to Control a Motor Part 3 – Making an RC Car Using a Servo Motor for the Steering

Use Arduino to Control a Motor Part 3 – Making an RC Car Using a Servo Motor for the Steering

Arduino RC Car

Arduino RC Car

In the article “Use Arduino to Control a Motor Part 2“, we went over how to use a motor driver. Today, we will look at the motor driver in more detail and make our own radio-controlled car using a motor driver.

Just like when we made the Stevenson Screen, we will decide the specs of the radio-controlled car before getting started.

Today Electronic’s Recipe

Expected time to complete: 90 minutes

Parts needed:

Arduino (Arduino Uno R3)
Arduino Pro mini (Arduino Pro Mini 328 5V 16MHz)
Breadboard
DC motor (FA-130RA-227)
Servo motor (http://www.aliexpress.com/store/product/EMAX-ES3103-17g-Plastic-Analog-Servo/715707_780975050.html)
Motor driver (BD6222HFP http://www.digikey.com/product-detail/en/BD6222HFP-TR/BD6222HFPCT-ND/1936319)
SOP16 pin DIP adapter board https://www.sparkfun.com/products/498
Diode (1N4007) ×2 http://www.digikey.com/product-detail/en/1N4007-TP/1N4007-TPMSCT-ND/773694
Resistor 10KΩ×2 / 100KΩ×2
Condenser (100μF http://www.digikey.com/product-detail/en/35ZLH100MEFC6.3X11/1189-1300-ND/3134256)
Box for AA batteries (series circuit for 4)
AA batteries x 4
Toggle switch (http://www.amazon.com/250V-Position-Micro-Toggle-Switch/dp/B014XJ7PZG)
LEGO blocks – as necessary
8T pinion gear http://www.amazon.com/15289-Mini-Metal-Plastic-Pinion/dp/B002CAT2TG

Structure of an RC Car

Today, we will try to make the basic parts of an RC car by ourselves and study basics about electronic circuits, steering, and engine movements.
Arduino RC Car
Figure 1: Structure of a radio-controlled car

Figure 1 shows a rough breakdown of the functions found in an RC car. In other words, if you fulfill these functions, you can call it an RC car.
We will go over how all these parts work and how to customize them using actual demonstrations.

Deciding the Specs of the RC Car

Before we get started, let’s decide the overall specs for the RC car. Here is an overview.

  1. Basic movements are forward, backward, and steering mount
  2. The body should be easy to build
  3. Make it as compact as possible
  4. Wireless controller preferred

That looks about right.
Now, let’s see what kind of technology we need to use to make these things possible…

  1. Basic movements are forward, backward, and steering mount
    -> We need 2 motors, one for going forward and backward, and one for the steering.
  2. The body should be easy to build
    -> We can use LEGO blocks, so that it will be easily to modify it.
  3. Make it as compact as possible
    -> The Arduino UNO is pretty big to begin with, so maybe we should use a different Arduino. Let’s think about making the battery small too.
  4. Wireless controller preferred
    -> If we use infrared or XBEE wireless module, it may be possible, but it will be quite difficult. Let’s give it a shot if we have time. Today, we will learn about many new concepts. Let’s tackle them one by one.

Designing a Motor Circuit

Let’s get started. First, we will design the heart of an RC car, the circuit for “Basic movements are forward, backward, and steering mount.”

Going forward and backward using a motor driver
We went over forward/backward motor movement in the article “Use Arduino to Control a Motor Part 2”. We will use the same circuit today.

Arduino DC Motor Circuit
Figure 2: DC motor circuit

In the circuit in figure 2 (see article “Use Arduino to Control a Motor Part 2“), we can rotate and reverse the motor by outputting signals from Arduino #9 and #10, one after the other. We can use the same idea to make the RC car go forward and backward.

Making steering possible

Let’s think about mounting the steering to make the car turn left and right.
If we use a DC motor, can we make it turn by 30 degrees to the right? Maybe we should rotate the motor for just a little bit and move the motor 30 degrees? Sounds pretty difficult. That’s where the servo motor comes in.

What Is a Servo Motor?

A servo motor is like the other motors we’ve used before with an additional circuit that controls angles.

Servo Motor

Pic 1: Servo motor

The servo motor we will be using today can control the angle from 0 to 180.
Let’s create a circuit to control the servo motor. When using a servo motor with Arduino, there is a library of useful materials (set program with pre-made process). We will control the servo motor using this servo library.

Arduino RC car steering controller

Pic 2: Controlling a servo motor with Arduino

Arduino Servomotor

Figure 3: Arduino circuit for servo motor

Once we finish the steering control, we will combine it with the drive shaft circuit.
Here, the servo is set to digital 11, and the DC motor control is set to digital 9 and 10.

Arduino RC car circuit

Figure 4: Arduino circuit for servo motor and DC motor

In this example, we set the delay at (1500), so the steering and driveshaft will move every 1.5 seconds. Next, let’s make it so that we can control it based on the input from the controller.

Making the Steering Setup

Now that we have the circuit ready and that we are able to control the angle of the motor with a servo motor, let’s create the steering for the car.
I’d like to say, “We’re going to make a realistic one using a 3D printer!”, but at this point that is too difficult. Let’s think about what we need for a steering system and try them out. So, today, let’s use LEGO blocks to fulfill “The body should be easy to build”.
If you search “LEGO steering”, there are many pages showing how to mount a LEGO steering. Today, we want to keep it as small as possible, so here is what we made.

Arduino RC Steering Servo Motor

Pic 2: Steering setup

Arduino RC car steering

Pic 3: Steering parts (left: backside/right: without tires)

Creating the Drive Shaft for the Forward/Backward Movement

The steering part is done, so let’s go into the drive shaft. This is a DC motor, but there was an article about making a motor and a LEGO gear by yourself using a Pinion gear from Mini-4WD, so we will use this method to connect the motor with a LEGO gear.
If you have a LEGO motor, that may work too. We want to keep the motor as small as possible, so let’s keep trying!

Lego

Pic 4: Setting the pinion gear onto the LEGO gear

The motor and driveshaft can be connected directly. Our priority is making something that works, so we are using rubber bands to fix the motor.
It looks like you can add transmission, or prioritize speed/torque by changing gear ratio, so customize them to your liking!

Driveshaft

Pic 5: A simple drive shaft

Now, let’s combine the steering with the drive shaft.

Arduino RC car body

pic6: Combined

Arduino RC car

Pic 7: Mounting the Arduino on the top of it

Putting the Arduino directly on top looks good! But the batteries for the motor and the circuit breadboard won’t fit…

Once we finish the circuit and body, we will test it out and give it a test run.

Testing Arduino RC car circuit

Pic 8: Testing the circuits

The steering and the drive shaft are moving properly. So now we have the basic parts of a radio-controlled car. We’ve come this far, so let’s mount the Arduino and other things onto the body.

Arduino RC car

Pic 9: Putting everything on the body of the car

It looks cool uncovered! But it looks a bit bumpy…

We tried to pack everything onto the body, but it’s just not enough coverage. Plus, the Arduino gets too big compared to the body. Moreover, there is no space for 9V batteries to power the Arduino. Making it lighter seems essential.

Summary

In our next article, we will create a controller and try to control the motor using controller inputs. Also, the Arduino and the breadboard are still too big and heavy, so we will try out a smaller Arduino like the Arduino Pro Mini.

Arduino UNO & Arduino Pro Mini

Pic 10: Arduino UNO and Arduino Pro Mini (conversion board)