Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Bluetooth-Controlled Car with L298N Motor Driver and Four Motors

View and Edit Project In Cirkit DesignerImage of Arduino Bluetooth-Controlled Car with L298N Motor Driver and Four Motors

Circuit Documentation

Summary

This document provides a detailed overview of a Bluetooth-controlled car circuit using an Arduino Uno R3, an L298N motor driver, four motors with wheels, an HC-05 Bluetooth module, and two 9V batteries. The car can move forward, backward, turn left, turn right, and stop based on commands received via Bluetooth.

Component List

  1. 9V Battery

    • Description: Provides power to the circuit.
    • Pins: +, -
  2. Motor and Wheels

    • Description: Drives the car's movement.
    • Pins: vcc, GND
  3. Arduino Uno R3

    • Description: Microcontroller that controls the car's movement based on Bluetooth commands.
    • Pins: USB Port, Power Jack, Not Connected, IOREF, RESET, 3.3V, 5V, GND, VIN, A0, A1, A2, A3, A4/SDA, A5/SCL, SCL, SDA, AREF, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
  4. HC-05 Bluetooth Module

    • Description: Receives Bluetooth commands to control the car.
    • Pins: EN, VCC, GND, TXD, RXD, STATE
  5. L298N DC Motor Driver

    • Description: Controls the motors based on signals from the Arduino.
    • Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB

Wiring Details

9V Battery

Motor and Wheels

Arduino Uno R3

HC-05 Bluetooth Module

L298N DC Motor Driver

Code Documentation

/*
 * Arduino Sketch for a Bluetooth-controlled car using an L298N motor driver
 * and four motors. The car can move forward, backward, turn left, turn right,
 * and stop based on commands received via Bluetooth.
 */

char t;

void setup() {
  pinMode(5, OUTPUT);   // IN1
  pinMode(6, OUTPUT);   // IN2
  pinMode(9, OUTPUT);   // IN3
  pinMode(10, OUTPUT);  // IN4
  pinMode(13, OUTPUT);  // LED
  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    t = Serial.read();
    Serial.println(t);
  }

  if (t == 'F') {            // Move forward
    digitalWrite(5, HIGH);
    digitalWrite(6, LOW);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
  } else if (t == 'B') {     // Move backward
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, HIGH);
  } else if (t == 'L') {     // Turn left
    digitalWrite(5, LOW);
    digitalWrite(6, HIGH);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
  } else if (t == 'R') {     // Turn right
    digitalWrite(5, HIGH);
    digitalWrite(6, LOW);
    digitalWrite(9, LOW);
    digitalWrite(10, HIGH);
  } else if (t == 'S') {     // Stop
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);
  } else if (t == 'W') {     // Turn LED on
    digitalWrite(13, HIGH);
  } else if (t == 'w') {     // Turn LED off
    digitalWrite(13, LOW);
  }

  delay(100);
}

This code is an Arduino sketch for controlling a car via Bluetooth. The car can move forward, backward, turn left, turn right, and stop based on commands received from the HC-05 Bluetooth module. The commands are processed in the loop function, and the corresponding motor control signals are sent to the L298N motor driver.