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

Bluetooth-Controlled Arduino UNO Robotic Car with L298N Motor Driver

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

Circuit Documentation

Summary of the Circuit

This circuit is designed to control a car using Bluetooth technology. It consists of an Arduino UNO microcontroller that interfaces with a Bluetooth HC-06 module for wireless communication and an L298N DC motor driver to control two hobby motors. The motors are powered by 9V batteries connected through a 2.1mm Barrel Jack with Terminal Block. The Arduino UNO receives commands via Bluetooth and drives the motors to move the car forward, backward, turn left, turn right, or stop.

Component List

Arduino UNO

Motor Amarillo Motorreductor Hobby (x2)

Bluetooth HC-06

Battery 9V (x2)

L298N DC Motor Driver

2.1mm Barrel Jack with Terminal Block

Wiring Details

Arduino UNO

Motor Amarillo Motorreductor Hobby

Bluetooth HC-06

Battery 9V

L298N DC Motor Driver

2.1mm Barrel Jack with Terminal Block

Documented Code

/*
 * Arduino Sketch for controlling a car using Bluetooth technology.
 * This code reads commands from the Serial input (Bluetooth module) and
 * controls the car's movement accordingly. The car can move forward,
 * backward, turn left, turn right, and stop based on the received commands.
 */

int Input_Pin_4 = 4; // Connected to L298N IN4
int Input_Pin_3 = 5; // Connected to L298N IN3
int Input_Pin_2 = 6; // Connected to L298N IN2
int Input_Pin_1 = 7; // Connected to L298N IN1
char Value;

void setup() {
  pinMode(Input_Pin_4, OUTPUT);  // Digital pin 4
  pinMode(Input_Pin_3, OUTPUT);  // Digital pin 5
  pinMode(Input_Pin_2, OUTPUT);  // Digital pin 6
  pinMode(Input_Pin_1, OUTPUT);  // Digital pin 7
  Serial.begin(9600);
}

void loop() {
  while (Serial.available() > 0) {
    Value = Serial.read();
    Serial.println(Value);
  }
  if (Value == 'F') {
    // Move Forward
    digitalWrite(Input_Pin_1, HIGH);
    digitalWrite(Input_Pin_2, LOW);
    digitalWrite(Input_Pin_3, HIGH);
    digitalWrite(Input_Pin_4, LOW);
  } else if (Value == 'B') {
    // Move Backward
    digitalWrite(Input_Pin_1, LOW);
    digitalWrite(Input_Pin_2, HIGH);
    digitalWrite(Input_Pin_3, LOW);
    digitalWrite(Input_Pin_4, HIGH);
  } else if (Value == 'L') {
    // Turn Left
    digitalWrite(Input_Pin_1, LOW);
    digitalWrite(Input_Pin_2, LOW);
    digitalWrite(Input_Pin_3, HIGH);
    digitalWrite(Input_Pin_4, LOW);
  } else if (Value == 'R') {
    // Turn Right
    digitalWrite(Input_Pin_1, HIGH);
    digitalWrite(Input_Pin_2, LOW);
    digitalWrite(Input_Pin_3, LOW);
    digitalWrite(Input_Pin_4, LOW);
  } else if (Value == 'S') {
    // Stop
    digitalWrite(Input_Pin_1, LOW);
    digitalWrite(Input_Pin_2, LOW);
    digitalWrite(Input_Pin_3, LOW);
    digitalWrite(Input_Pin_4, LOW);
  }
}

This code is designed to be uploaded to the Arduino UNO microcontroller. It sets up the digital pins connected to the L298N motor driver as outputs and initializes serial communication for receiving Bluetooth commands. The loop function reads the incoming serial data and controls the motor driver to move the car based on the received command character.