Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

How To Make DIY Remote control (RC) Car/Bot using Arduino Nano & Bluetooth module by WTC Zone

How To Make DIY Remote control (RC) Car/Bot using Arduino Nano & Bluetooth module by WTC Zone


To create an RC car using an Arduino Nano, HC-05 Bluetooth module, L298N motor driver, and 2 DC motors, you’ll need to use a smartphone Bluetooth app to control the car’s direction and speed. Here’s how you can build it.

Parts Required

  1. Arduino Nano
  2. HC-05 Bluetooth Module
  3. L298N Motor Driver Module
  4. 2 DC Motors (preferably geared for stability and torque)
  5. Battery Pack (7.4V - 12V, depending on the motor specs)
  6. Chassis (for mounting motors and other components)
  7. Jumper Wires and Breadboard (optional)

Circuit Connections

  1. Bluetooth Module (HC-05):

    • VCC5V on Arduino Nano.
    • GNDGND on Arduino Nano.
    • TXRX (Pin 0) on Arduino Nano.
    • RXTX (Pin 1) on Arduino Nano.
  2. L298N Motor Driver:

    • IN1D3 on Arduino Nano.
    • IN2D4 on Arduino Nano.
    • IN3D5 on Arduino Nano.
    • IN4D6 on Arduino Nano.
    • ENA (Enable A) → D9 on Arduino Nano.
    • ENB (Enable B) → D10 on Arduino Nano.
    • GNDGND on Arduino Nano.
    • VCC on L298N (motor power) → Battery Pack’s Positive terminal.
    • 12V power pin on the L298N should connect to the motor power source (e.g., battery pack).
    • Connect both motors:
      • Motor 1OUT1 and OUT2 on the L298N.
      • Motor 2OUT3 and OUT4 on the L298N.
  3. Power Connections:

    • Arduino Nano can be powered from the same battery pack through the VIN pin.
    • Ensure all grounds are connected to avoid inconsistent signals.

Circuit Diagram

Video Link: - Click Here For Video

Bluetooth App Link: - Click Here For Android App

How To Make DIY Remote control (RC) Car/Bot using Arduino Nano & Bluetooth module by WTC Zone simple Circuit: -


How To Make DIY Remote control (RC) Car/Bot using Arduino Nano & Bluetooth module by WTC Zone Arduino Programming: -

Arduino IDE Program

Code for DIY Remote control (RC) Car/Bot using Arduino Nano & Bluetooth module by WTC Zone

// Pin Definitions
const int motor1Pin1 = 3; // IN1 for Motor 1
const int motor1Pin2 = 4; // IN2 for Motor 1
const int motor2Pin1 = 5; // IN3 for Motor 2
const int motor2Pin2 = 6; // IN4 for Motor 2
const int enableA = 9;    // ENA pin for Motor 1
const int enableB = 10;   // ENB pin for Motor 2

char command = 0;

void setup() {
  Serial.begin(9600);            // Start serial communication for Bluetooth
  pinMode(motor1Pin1, OUTPUT);
  pinMode(motor1Pin2, OUTPUT);
  pinMode(motor2Pin1, OUTPUT);
  pinMode(motor2Pin2, OUTPUT);
  pinMode(enableA, OUTPUT);
  pinMode(enableB, OUTPUT);
  analogWrite(enableA, 200);     // Set motor speed (0-255)
  analogWrite(enableB, 200);
}

void loop() {
  if (Serial.available() > 0) {
    command = Serial.read();    // Read command from Bluetooth
    moveCar(command);           // Call function to move car
  }
}

void moveCar(char command) {
  switch (command) {
    case 'F':  // Move Forward
      digitalWrite(motor1Pin1, HIGH);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, HIGH);
      digitalWrite(motor2Pin2, LOW);
      break;
    case 'B':  // Move Backward
      digitalWrite(motor1Pin1, LOW);
      digitalWrite(motor1Pin2, HIGH);
      digitalWrite(motor2Pin1, LOW);
      digitalWrite(motor2Pin2, HIGH);
      break;
    case 'L':  // Turn Left
      digitalWrite(motor1Pin1, LOW);
      digitalWrite(motor1Pin2, HIGH);
      digitalWrite(motor2Pin1, HIGH);
      digitalWrite(motor2Pin2, LOW);
      break;
    case 'R':  // Turn Right
      digitalWrite(motor1Pin1, HIGH);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, LOW);
      digitalWrite(motor2Pin2, HIGH);
      break;
    case 'S':  // Stop
      digitalWrite(motor1Pin1, LOW);
      digitalWrite(motor1Pin2, LOW);
      digitalWrite(motor2Pin1, LOW);
      digitalWrite(motor2Pin2, LOW);
      break;
  }
}


-----------------------------------------------------------------------------------------------------------------------------

Explanation of the Code

  1. Bluetooth Commands: The code reads commands from the Bluetooth app. Based on the received character ('F', 'B', 'L', 'R', or 'S'), it controls the motor pins to move the car forward, backward, left, right, or stop.
  2. Motor Control: The L298N motor driver has two sets of inputs for each motor. Setting a high and low combination on the inputs makes each motor rotate in the desired direction.
  3. PWM Control: The enableA and enableB pins control motor speed using PWM signals. Adjusting the values in analogWrite (0 to 255) will change the speed of the motors.

How the Project Works

  • Bluetooth App: Use a smartphone Bluetooth app to send characters to the Arduino (e.g., 'F' for forward, 'B' for backward).
  • HC-05 Module: Receives commands from the smartphone and sends them to the Arduino Nano via serial communication.
  • L298N Motor Driver: Drives two DC motors based on the received commands.
  • Arduino: Interprets the Bluetooth commands to control the L298N module, adjusting the car’s movement direction and speed.

Testing and Final Setup

  1. Bluetooth App Setup: Pair the HC-05 module with your phone (default PIN is usually 1234 or 0000).
  2. Motor Direction Adjustment: If motors run in the opposite direction, swap the motor leads.
  3. Control Test: Verify each command ('F', 'B', 'L', 'R', 'S') to ensure they work as expected.

Share, Support, and Subscribe!!! 1. PRO KAM EXPLAINED 2. Knowledge KAM 3. PRO KAM Follow us on 1. Facebook 2. Instagram 3. Pinterest 4. Blogspot 5 Twitter If you have any other ideas to make me design, you can describe them in the comment section and if I can, I will make a designing video on it. So I am waiting #prokam #wtc #Arduino #ideas #projects #diy #how #to #ArduinoProjects #UltrasonicSensor #HeightMeasurement #TechDIY #WeTechCreators

Post a Comment

0 Comments

Ad Code

Responsive Advertisement