RCar | Car


Remote-Controlled Cars

This kind of robots has a broad range of uses in our society. Army applications, toys for kids, automation projects and professional competitions are some scenarios we may find such a device. They can be controlled using many technologies, like: wires, Bluetooth, Wi-Fi or 4G/3G signals are some of the most well-known. Generally, they can be powered by oil or electricity. Based on their size, a scale factor is usually attributed. This is done by comparing them with their analogous real models. They can be found in many categories: Street, Drift, Buggy, Truggy and Trucks (hover each figure with the cursor and find out a complete correspondence).

Fig. 1 - 5 standard remote-controlled car categories commercially available.


Arduino is an open-source electronic platform based on flexible and reliable hardware and software. It was created in 2003 by a group of students from Interaction Design Institute Ivrea, in Ivrea, Italy. The name Arduino comes from a bar’s name located in its native city where the creators used to meet. Its purpose is to create objects or environments. Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors and other actuators. The microcontroller on the board is programmed using the Arduino language, which is based on C++, and the Arduino Integrated Development Environment (IDE), based on Processing. Most boards consist of an Atmel 8-bit AVR microcontroller with different number of pins, ROM and RAM memory (among others). These pins are organized in 2 rows of male headers, in order to easily connect and integrate it with external circuits. The Arduino microcontroller also has an integrated timer based on an oscillating crystal at 16 MHz. Arduino projects can be stand-alone, or they can communicate with software running on a computer, such as MATLAB.

Fig. 2 - Arduino Nano.

  1 of the relevances of this hardware is its ability to convert analog signals into digital ones, which can be saved, modified and analyzed in a computer (or other digital device), using specific software. This data processing could be essential in a medical diagnostic center, where the least variation in the physiological signal could be crucial for the correct diagnosis of certain pathology.
  Any program written in Arduino is commonly called a sketch. These files are intended to be saved in the owner’s PC with the following extension: .ino. In order to be executed, it only requires 2 basic functions: setup and a loop. The 1st one is only executed once (after powering up or resetting the board). Information like setting output/input pins; bit rate (baud); variables (…) can be given in this section of the program. Libraries can also be initialized in this section. These play an important role in Arduino programming, since a limited number of functions are available to be promptly used. Most of the times, it is an advantage to use them since functions may often be more efficient from an Arduino’s scope (very important due to its limited computational power). On the other side, the loop will be executed cyclically with/without interruptions depending on the existence of interrupts or functions that deliberately pause the execution (delay, delayMicroseconds).
  Many prototypes can be projected using Arduino: ECGs, EMGs, EEGs, Pletismography devices, automatized dispensers, games, printers and, of course, robotic cars.



In order the car to perform some of the features we were interested in, we had to include several devices. Here is a complete list of the components present in the prototype:

Fig. 3 - List of electric components present in the prototype.
  1. DC 3V Motor;
  2. Micro Servo SG90;
  3. LEDs (Red, Yellow and White);
  4. Resistances;
  5. Bluetooth HC-05 Module;
  6. L298N Driver;
  7. GPS Module (NEO-6M-0-001).

All connections among the previous components were reverseably performed in a breadboard using male-male, male-female and female-female jumper wires.
  Using Arduino Nano, we were able to decrease energy consumption and increase the portability of the final project. This was done at the expense of some computational power. Since this Arduino's model only has 2 serial connections (RX and TX – which were used to transfer data between the Bluetooth module and the android app), we needed to include an extra serial port to receive the location values from the GPS module in the smartphone.
  Regarding the lights present in the vehicle, we always included a resistance in order to limit the intensity of the current going through the diodes. This was done in the (2) front, (2) back and (2) turn signal lights. These lights are totally controlled using the RCar app, except the ones in the back that automatically turn on when the car accelerates backwards.
  A similar approach was followed with the Bluetooth module. Although, in this case, we included a voltage divider in the circuit, such that the HC-05 receives half of the voltage (in the RX port) coming from the 5V Arduino port (TX). Nevertheless, this was dispensable. Thus, it was not included in the electric circuit diagram (Fig. 5).
  Servo's rotation was lower and upper limited in the Arduino script to 45 and 135 degrees. Avoiding an excessive rotation of the wheels of the car. We first used an old servo in our project but, due to bad oiled gears, this was substituted by a new one. This way, we eliminated jittering and greatly increased angle precision.
  We also decided to include an extra feature in the car - GPS. This detects location with a remarkable accuracy (considering the price) lower than 3 meters (radius). Then, a map with a red dot is shown in the app, correctly positioned. Note that, due to GPS module limitations, it is not possible to get car's position indoors.
  A speaker was also added to the circuit. A sound signal is emitted every time one clicks in the corresponding button of the app. Both the duration and frequency of the wave were defined in the Arduino IDE.

Fig. 4 - H-Bridge Logic Circuit.

  The L298N Driver is an electric compound that behaves similarly to a H-Bridge. Depending on the interrupters that are closed, the current will flow in 2 different directions across the DC motor. This allows the motor to rotate clockwise or counter-clockwise by always applying a positive voltage with the Arduino (vin). Furthermore, it also controls the velocity at which the axles rotate. These 2 sets of interrupters are controlled by the IN1 and IN2 pins present in the driver.
  Motor has 2 axles (1 pointing to the right and another to the left, moving synchronously).
  The car is powered by a 9V battery along with its adapter (on/off button incorporated to be easier to cut off circuit's power), which is connected to the L298N Driver. This is both feeding the motor and the Arduino (consequently, all the remaining circuitry).

Fig. 5 - Circuit representation of the car. Note that L298N Motor Driver has a slightly different wiring than the one in the figure. And the DC 3V Motor has an extra axis pointing in the opposite direction (both moving synchronously).


    // ------------------------------------------------ Including Libraries ------------------------------------------------

    #include  // Extra serial communication port
    #include  // GPS module
    #include  // Servo

    // GPS Parameters
    static const int RXPin = 12;
    static const uint32_t GPSBaud = 9600;

    // The serial connection to the GPS device
    NeoSWSerial ss (RXPin,13);

    // Creating Instances
    Servo servo;
    TinyGPSPlus gps;

    // --------------------------------------------------- Defining Pins ---------------------------------------------------

    int ledPin1 = 2;
    int ledPin2 = 3;
    int headLights = 5;
    int backLights = 7;

    boolean ledPin1State = LOW;
    boolean ledPin2State = LOW;

    int buzzer = 4;

    int motorVelocityControl = 11;
    int motorFrontDirectionControl = 9;
    int motorBackDirectionControl = 10;

    double aux;

    int state;
    int state2 = 4;

    int x, y = 0;
    int xAxis, yAxis;

    unsigned long previousMillis = 0;
    const long interval = 200;

    // ------------------------------------------------------- Setup -------------------------------------------------------

    void setup() {

    // --------------------------------------------------------------- Pin Mode (Input/Output)

    pinMode(ledPin1, OUTPUT); // Side Light
    pinMode(ledPin2, OUTPUT); // Side Light
    pinMode(backLights, OUTPUT); // Back Lights
    pinMode(headLights, OUTPUT); // Front Lights

    pinMode(motorVelocityControl, OUTPUT);
    pinMode(motorFrontDirectionControl, OUTPUT);
    pinMode(motorBackDirectionControl, OUTPUT);

    servo.attach (6);



    // ------------------------------------------------------------ Loop ---------------------------------------------------

    void loop() {

    unsigned long currentMillis = millis();

    // --------------------------------------------------------------- GPS Module

    while (ss.available() > 0)
    if (gps.encode(ss.read()))

    if (gps.location.isValid())
    Serial.print(gps.location.lat(), 6);
    Serial.println(gps.location.lng(), 6);

    // --------------------------------------------------------------- Bluetooth Module

    while (Serial.available() >= 2) {

    x = Serial.read();


    y = Serial.read();



    // --------------------------------------------------------------- Head Lights

    if (x == 1) {

    digitalWrite(headLights, HIGH);


    if (x == 0) {

    digitalWrite(headLights, LOW);


    // --------------------------------------------------------------- Back Lights

    if (motorBackDirectionControl == HIGH) {

    digitalWrite(backLights, HIGH);

    }  else {

    digitalWrite(backLights, LOW);


    // --------------------------------------------------------------- Buzzer

    if (x == 2) {

    tone(buzzer, 200, 80);

    } else if (x == 3) {

    digitalWrite(buzzer, LOW);


    // --------------------------------------------------------------- Left Light

    if (x == 5) {

    if (currentMillis - previousMillis >= interval) {

    previousMillis = currentMillis;

    if (ledPin1State == LOW) {
    digitalWrite(ledPin1, HIGH);
    ledPin1State = HIGH;
    } else {
    digitalWrite(ledPin1, LOW);
    ledPin1State = LOW;


    } else if (x == 4) {

    digitalWrite(ledPin1, LOW);


    // --------------------------------------------------------------- Right Light

    if (x == 6) {

    if (currentMillis - previousMillis >= interval) {

    previousMillis = currentMillis;

    if (ledPin2State == LOW) {
    digitalWrite(ledPin2, HIGH);
    ledPin2State = HIGH;
    } else {
    digitalWrite(ledPin2, LOW);
    ledPin2State = LOW;


    } else if (x == 7) {

    digitalWrite(ledPin2, LOW);


    // --------------------------------------------------------------- Servo Motor

    if ((x == 255 && y == 255) || x == 153) {

    servo.write(90 - 15);

    } else if (x > 153 & y < 153) {
    servo.write((180 / PI)*asin((153 - y) / (pow(pow(x - 153, 2) + pow(153 - y, 2), 0.5))) * 0.5 + 45 - 15);
    } else if (x < 153 & y < 153 & x > 10 & y > 10) {
    servo.write(160 - ((180 / PI)*asin((153 - y) / (pow(pow(x - 153, 2) + pow(153 - y, 2), 0.5))) * 0.5 + 45 - 15));
    } else if (x > 153 & y > 153) {
    servo.write((180 / PI)*abs(asin((153 - y) / (pow(pow(x - 153, 2) + pow(153 - y, 2), 0.5)))) * 0.5 + 45 - 15);
    } else if (x < 153 & y > 153) {
    servo.write(160 - ((180 / PI)*asin(abs(153 - y) / (pow(pow(x - 153, 2) + pow(153 - y, 2), 0.5))) * 0.5 + 45 - 15));

    // --------------------------------------------------------------- DC Motor

    aux = pow(pow(x - 153, 2) + pow(153 - y, 2), 0.5);

    if (x == 255 || y == 255) {

    analogWrite(motorVelocityControl, 0);

    } else if (y < 153 && aux < 120 && y > 10) {
    analogWrite(motorVelocityControl, 0.7 * aux * 255 / 120);
    digitalWrite(motorFrontDirectionControl, HIGH);
    digitalWrite(motorBackDirectionControl, LOW);

    } else if (y > 153 && aux < 120) {
    digitalWrite(motorFrontDirectionControl, LOW);
    digitalWrite(motorBackDirectionControl, HIGH);
    analogWrite(motorVelocityControl, 0.7 * aux * 255 / 120);
    digitalWrite(backLights, HIGH);

    } else if (y > 153 && aux < 120) {
    digitalWrite(motorFrontDirectionControl, LOW);
    digitalWrite(motorBackDirectionControl, HIGH);
    analogWrite(motorVelocityControl, 0.7 * aux * 255 / 120);
    digitalWrite(backLights, HIGH);

    } else if (y < 153 && aux < 120 && y > 10) {
    digitalWrite(motorFrontDirectionControl, HIGH);
    digitalWrite(motorBackDirectionControl, LOW);
    analogWrite(motorVelocityControl, 0.7 * aux * 255 / 120);




All the parts of the remote-controlled car were modelled using the CAD software SolidWorks. The complete model (Fig. 6) was divided in several parts (which were meant to be 3D printed separately): wheels, chassis, L-shape axles, connecting bar and the body of the car. The shape of the last component resulted from a funny try to roughly resemble FBI vehicles.

Fig. 6 - Isometric view of the remote-controlled car model.

  At the beginning, the first parts to be modelled were the back wheels. An initial design was obtained from GrabCad. However, some changes had to be made in order to fit our model. Since these wheels were meant to be attached to the motor (with a double axis, 1 pointing to the right and another to the left), a cylindrical axle with an appropriate length and internal radius had to be built. Instead of having the hexagonal cavity that was present in the original design, the shape of the hollow inner cylinder was changed to match the shape of the motor's axle, as we can see in Fig. 7.

Fig. 7 - Back wheel design.

  Special attention should be given to the fact the wheels were fixed to this double axle, consequently, these 2 move along at the motor speed. This is not the case for the 2 front wheels.
The same original design was used in the front wheels. However, the axles modelled were completely different, as these were meant to rotate around a vertical imaginary axle, synchronously with the servo's paddle. This movement was limited to 45º rotation to each side. Both wheels’ axles were designed in an L-shape, with a cylindrical and a rectangular end. The latter is always parallel to the servo’s paddle and has a cut where an elastic is to be wrapped around and connected to the paddle (Fig. 8).

Fig. 8 - Cut view of 1 of the front wheels. 2 features of the L-shaped axle are visible here: the cut where the elastic is to be wrapped and the connection between the axle and the wheel.

  Both ends of each axle were connected by a bar to guarantee the wheels move simultaneously to the sides. Furthermore, to assure the wheels rotate at the same angle as the servo’s paddle, the distance between the centre of the hinge of the axle and the centre of the cut was equal to the length of the paddle (Fig. 9).

Fig. 9 - Bottom view of the chassis. It is visible the connection between both front wheels’ axles.

  To guarantee the rotation of the wheels, a revolved cut was added to the cylindrical end of the axle and a complementary boss was designed in the wheel (Fig. 8). In order the joint to be detachable, a difference of 0.3mm between the internal and external radius was guaranteed. The same principle was applied to the hinges in both axles. Thus, 2 cylindrical structures were built on the bottom surface of the chassis, each with a revolved cut at the end. A complementary structure was built in each axle corner, again with the 0.3mm difference.

Fig. 10 - Isometric view of the chassis, wheels, axles and servo.

  As for the chassis of the car, besides the structures already referred, there are 2 other features worth mentioning. First, a cut in the chassis was made in order to fit the servo, as the paddle must be at the same height as the axles. Second, it had to be cut at the front in order the wheels to turn (Fig. 10).
  Finally, although this part was not printed due to its dimension and accessory nature, the body of the car was also designed. We made sure to include the cuts for the respective lighting system, place for (back and front) registration plates and 4 complementary supports to the ones present on the top surface of the chassis - tightly connecting both parts.
  It is shown below the side, front and back views of the completely assembled model (Fig.11).

Front View
Back View
Side View
Fig. 11 - Different views of the car prototype modeled using SoliWorks.

The biggest challenge faced in this part of the project was the design of the front wheels' rotation system. This had to be redone several times in order to allow the proper movement imposed by the servo. However, this was never tested, as the axles were meant to be connected to the servo’s paddle by an elastic, and this could only be done after printing.
  Furthermore, it is important to mention that in order to achieve the final design, all components had to be redone several times, particularly, the cuts and extrudes responsible for the connections between parts. This assured the pieces were aligned and had appropriate dimensions.
  After modelling, the main goal, in terms of design, was to 3D print (using Ultimaker 2+ Extended printer - Fig. 12) the several parts and use them to build the model. Finally, all the electric components were displaced in the car.

Fig. 12 - Ultimaker 2+ Extended, at iStartLab (IST, University of Lisbon).

  It is important to mention there was a dimension limitation associated with the printer, which did not allow us to print the body of the car. The printing required the use of a 2.85mm PLA filament. Although some smaller details of the model were not perfectly reproduced, printing was well succeeded.
   Regarding the 2 cylindrical structures designed on the bottom of the chassis (to fit the L-shape axles), they ended up slightly prone to break. This was fixed by wrapping some resistant tap glue. Moreover, still to secure the axles to the chassis, 2 elastics were wrapped around on each side, which helped keeping the car stable and all parts in place. In other words, they pushed both parts against each other. 1 way to avoid these issues, would have been to increase the size of these structures.
  The revolved structure inside the front wheels, which was designed to fit with the axle, was filled with support material (printed along with the car). This required a precision handwork to avoid loosening these joints while removing it. Although, later, we realized that due to dilation of PLA, these 2 parts did not fit. This was solved by shaving them. 1 problem encountered next was the wheels were not very secure, which resulted in them becoming crooked with the movement of the car. The solution was gluing an aluminium ring to each front wheel (after inserting the complementary part of the corresponding axle inside it) and wrapping some wire around each joint.
  Both axles were connected, as it was originally designed, by a bar (using 2 screws and corresponding nuts, as the joints) and an elastic. Originally, this elastic was supposed to connect to servo's paddle. After testing car's side movement and confirming the bar could flip the axles better if directly connected to the paddle, we decided to join both, using a thin wire of metal. Consequently, the elastic (parallel to the bar) was discarded. The servo was kept in place by gluing its sides to the hole in the chassis.
  For both the front and back wheels, hot glue was distributed along their perimeter to increase ground traction. Due to the added diameter the glue streaks added to the front wheels, part of the chassis had to be shaved off in order to avoid bumping in the side movement of the car.  
  Finally, the front, back and turn signal lights were glued in their usual positions to the car. The breadboard and the GPS were attached on the back. And the DC 3V Motor in the bottom of the chassis. All the other components were kept in place with several elastics to guarantee they would not affect the car movement or disconnect its circuitry.
  All in all, even though the design required some adaptations after being printed, the result was a success. The car was able to move stably, with enough traction and perfectly supported the weight of all components. Moreover, the cost of printing was negligible (< $1).

Video 1 - DIY RCar project. Includes design, electronics and programming explanation.

Download Files


Future Improvements