# Arduino car and controller - code to make your own

**URL:** <https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021>\
**Category:** Showcase\
**Created:** [September 30, 2025, 12:02pm UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021 "2025-09-30T12:02:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shash\_arduino\_lover](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/shash_arduino_lover/32/1124501_2.png) [@shash\_arduino\_lover](https://forum.arduino.cc/u/shash_arduino_lover)\
**Post date:** [September 30, 2025, 12:02pm UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/1 "2025-09-30T12:02:08Z")

</div>

Controller:

```arduino
const int accel(0);
const int steer(1);

void setup() {
  // SETUP CODE:
  Serial.begin(9600);
}

void loop() {
  // MAIN CODE:
  int accelVal(map(analogRead(accel), 0, 1023, -255, 255));
  int steerVal(map(analogRead(steer), 0, 1023, 45, 135));

  Serial.print(accelVal);
  Serial.print(",");
  Serial.println(steerVal);
}

```

Car:

```arduino
#include <Servo.h>

Servo steering;

const int motorF(11);
const int motorB(10);

void setup() {
  // SETUP CODE:
  Serial.begin(9600);

  pinMode(motorF, OUTPUT);
  pinMode(motorB, OUTPUT);

  steering.attach(9);
}

void loop() {
  // MAIN CODE:
  if (Serial.available()) {
    String values(Serial.readStringUntil('\n'));

    values.trim();

    char vals[10];

    values.toCharArray(vals, 10);

    int accel(atoi(strtok(vals, ",")));
    int steer(atoi(strtok(NULL, ",")));

    if (accel < 0) {
      accel = 0 - accel;
      
      analogWrite(motorF, 0);
      analogWrite(motorB, accel);
    } else if (accel == 0) {
      analogWrite(motorF, 0);
      analogWrite(motorB, 0);
    } else {
      analogWrite(motorF, accel);
      analogWrite(motorB, accel);
    }

    steering.write(steer);
  }
}

```

Parts:

Receiver:  
Servo motor (x1)

DC motor (any quantity will work; use a double shaft motor if using only one motor)

HC-05 Bluetooth module.

L293D motor driver

Transmitter:

X-axis 1-dimensional joystick

Y-axis 1-dimensional joystick

HC-05 Bluetooth module

Note: You can use a single 2-dimensional joystick, but the two 1-dimensional joystick configuration is recommended for a better user experience.

To make the car, make sure you give forward motor output by connecting pin 11, and give backward motor output with pin 10 to the motor driver. Connect the motor(s) to the driver to spin in two directions. You can use a setup with more motors in parallel, though a single motor setup, utilizing a double-shaft motor, is recommended. Connect your servo motor to pin 9, and make sure that 90 degrees on the servo motor corresponds to the wheels of the car pointing straight ahead. Connect the HC-05 Bluetooth module’s RX to the TX of the Arduino, and the TX to the RX of the Arduino. Additionally, for safety, you can opt to add a voltage divider to safely operate the HC-05 with a 1kΩ resistor between the Arduino TX and HC-05 RX, and a 2kΩ resistor between the HC-05 RX and the ground.

To make the controller, hook up the Y-axis to analog pin 0, and the X-axis to analog pin 1, and in the same manner from above, connect the HC-05 to the Arduino, and make sure everything is grounded properly.

Additionally, make sure that the two HC-05 Bluetooth modules are paired in a master-slave configuration.

Happy building!

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [September 30, 2025, 2:33pm UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/2 "2025-09-30T14:33:09Z")

</div>

> [@shash\_arduino\_lover](#):
>
> small motors can run from the Arduino

NO NO NO

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [September 30, 2025, 2:33pm UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/3 "2025-09-30T14:33:58Z")

</div>

Draw the wiring diagram and label everything then take a picture and post.

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [September 30, 2025, 4:07pm UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/4 "2025-09-30T16:07:20Z")

</div>

> [@shash\_arduino\_lover](#):
>
> To wire the car based on this code

What car?

---

<div class="post-metadata">

**Author:** ![shash\_arduino\_lover](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/shash_arduino_lover/32/1124501_2.png) [@shash\_arduino\_lover](https://forum.arduino.cc/u/shash_arduino_lover)\
**Post date:** [October 4, 2025, 6:07am UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/6 "2025-10-04T06:07:41Z")

</div>

It’s just a mini toy car with a controller that you can make.

---

<div class="post-metadata">

**Author:** ![shash\_arduino\_lover](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/shash_arduino_lover/32/1124501_2.png) [@shash\_arduino\_lover](https://forum.arduino.cc/u/shash_arduino_lover)\
**Post date:** [October 4, 2025, 6:20am UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/7 "2025-10-04T06:20:19Z")

</div>

Here are two ASCII circuit schematics:

Car:

```arduino
                              +5V
                               |
                               |
                              .-.
                              | | (Power Bus)
                              '-'
                               |
                               | +---------------------+
                               | | HC-05 Module |
                               | +----------------------+ | |
                               | | Arduino UNO | | RX <----/\/\--+-- TX|
                               | | | | 1kΩ | |
                               | | [5V]-----------------+--+--------------+ |
                               | | [GND]----------------+-----------------+-----+
                               | | [TX]----/\/\----+---------------------------+
                               | | 1kΩ |
                               | | +--/\/\--> GND
                               | | 2kΩ
                               | | [RX]<-------------------- TX (HC-05)
                               | | [D9] ---> Servo Signal
                               | | [D10]--> IN2 (L293D)
                               | | [D11]--> IN1 (L293D)
                               | +----------------------+
                               | |
                               | |
                              GND GND
                               | |
                               | |
                               +----------------+-------------+
                                                |
                                                |
                                                v
                                     +---------------------+
                                     | L293D Motor Driver |
                                     |---------------------|
                                     | IN1 <--- D11 |
                                     | IN2 <--- D10 |
                                     | ENA ---> +5V (jumper)|
                                     | OUT1 ---> Motor + |
                                     | OUT2 ---> Motor - |
                                     | Vcc1 ---> +5V |
                                     | Vcc2 ---> +9V ext. |
                                     | GND ----> GND |
                                     +---------------------+
                                                |
                                                v
                                             (MOTOR)
                                                |
                                               GND

                               +5V
                                |
                                |
                                +----------------+
                                | |
                                | +------------+
                                | | Servo Motor|
                                | | Sig -> D9 |
                                | | +V -> 5V |
                                | | GND -> GND |
                                | +------------+
                                |
                               GND

```

Controller:

```arduino
                               +5V
                                |
                                |
                              .-.
                              | | (Power Bus)
                              '-'
                                |
                                | +---------------------+
                                | | HC-05 Module |
                                | +----------------------+ | |
                                | | Arduino UNO/Nano | | RX <----/\/\--+-- TX|
                                | | | | 1kΩ | |
                                | | [5V]-----------------+-+--------------+ |
                                | | [GND]----------------+----------------+-----+
                                | | [A0] <--- Joystick Y-Axis |
                                | | [A1] <--- Joystick X-Axis |
                                | | [TX]----/\/\----+-------------------------+
                                | | 1kΩ |
                                | | +--/\/\--> GND
                                | | 2kΩ
                                | | [RX]<-------------------- TX (HC-05)
                                | +----------------------+
                                | |
                               GND GND
                                | |
                                | |
                                +---------------+--------------+
                                                |
                                                |
                                                v
                                       +------------------+
                                       | Joystick Module |
                                       |------------------|
                                       | VRx -> A1 |
                                       | VRy -> A0 |
                                       | +5V -> 5V |
                                       | GND -> GND |
                                       +------------------+

```

---

<div class="post-metadata">

**Author:** ![TomGeorge](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tomgeorge/32/215261_2.png) [@TomGeorge](https://forum.arduino.cc/u/TomGeorge)\
**Post date:** [October 4, 2025, 6:52am UTC](https://forum.arduino.cc/t/arduino-car-and-controller-code-to-make-your-own/1408021/8 "2025-10-04T06:52:10Z")

</div>

> [@shash\_arduino\_lover](#):
>
> Here are two ASCII circuit schematics:

Sorry but...

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?  
Hand drawn and photographed is perfectly acceptable.  
Please include ALL hardware, power supplies, component names and pin labels.

Also some images of your project.

Tom.... 😃 👍 ☕ 🇦🇺
