Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino Uno R3 Controlled Bluetooth Robot with L298N Motor Driver and LED Indicator

Image of Arduino Uno R3 Controlled Bluetooth Robot with L298N Motor Driver and LED Indicator

Circuit Documentation

Summary

This circuit is designed to control a set of DC motors using an Arduino Uno R3 microcontroller and an L298N DC motor driver. The circuit also includes an HC-05 Bluetooth module for wireless communication and a red LED as an indicator. Power is supplied by a 4 x AAA battery mount. The Arduino Uno R3 is programmed to interpret serial commands to control the motion of the motors (forward, reverse, left, right, stop) and to toggle the LED on or off.

Component List

Arduino Uno R3

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a USB connection, a power jack, an ICSP header, and a reset button.

L298N DC Motor Driver

  • A dual H-bridge motor driver that can drive two DC motors or one stepper motor.
  • It has pins for motor outputs, power supply, and control inputs.

DC Motor (4 units)

  • A standard DC motor used for creating rotational motion.
  • Each motor has two pins for power connection.

HC-05 Bluetooth Module

  • A wireless communication module that allows for serial communication via Bluetooth.
  • It has pins for enabling, power supply, ground, and serial communication (TX/RX).

LED: Two Pin (red)

  • A basic red LED used as an indicator.
  • It has an anode and a cathode pin for power connection.

4 x AAA Battery Mount

  • A battery holder for four AAA batteries to provide power to the circuit.
  • It has positive and negative terminals for power output.

Wiring Details

Arduino Uno R3

  • 3.3V connected to the anode of the red LED.
  • 5V connected to the VCC of the HC-05 Bluetooth module.
  • GND connected to the ground of the L298N motor driver, HC-05 Bluetooth module, and the negative terminal of the battery mount.
  • VIN connected to the 5V input of the L298N motor driver.
  • Digital pins 13, 12, 11, and 10 connected to the IN1, IN2, IN3, and IN4 of the L298N motor driver respectively.
  • Digital pin 9 connected to the cathode of the red LED.
  • Digital pins 1 and 0 (TX/RX) connected to the RXD and TXD of the HC-05 Bluetooth module respectively.

L298N DC Motor Driver

  • OUT1 and OUT2 connected to the first pair of DC motors.
  • OUT3 and OUT4 connected to the second pair of DC motors.
  • 12V connected to the positive terminal of the battery mount.
  • GND connected to the ground of the Arduino Uno R3 and the negative terminal of the battery mount.
  • 5V connected to the VIN of the Arduino Uno R3.
  • IN1, IN2, IN3, and IN4 connected to the digital pins 13, 12, 11, and 10 of the Arduino Uno R3 respectively.

DC Motors

  • Each motor has two pins connected to the corresponding output pins of the L298N motor driver.

HC-05 Bluetooth Module

  • VCC connected to the 5V of the Arduino Uno R3.
  • GND connected to the ground of the Arduino Uno R3.
  • TXD connected to the RX (pin 0) of the Arduino Uno R3.
  • RXD connected to the TX (pin 1) of the Arduino Uno R3.

LED: Two Pin (red)

  • Anode connected to the 3.3V of the Arduino Uno R3.
  • Cathode connected to the digital pin 9 of the Arduino Uno R3.

4 x AAA Battery Mount

  • + connected to the 12V of the L298N motor driver.
  • - connected to the ground of the L298N motor driver and the Arduino Uno R3.

Documented Code

char t;

void setup() {
  pinMode(13, OUTPUT);   // Left motors forward
  pinMode(12, OUTPUT);   // Left motors reverse
  pinMode(11, OUTPUT);   // Right motors forward
  pinMode(10, OUTPUT);   // Right motors reverse
  pinMode(9, OUTPUT);    // LED
  Serial.begin(9600);
}

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

  if (t == 'F') {            // Move forward (all motors rotate in forward direction)
    digitalWrite(13, HIGH);
    digitalWrite(11, HIGH);
  } else if (t == 'B') {     // Move reverse (all motors rotate in reverse direction)
    digitalWrite(12, HIGH);
    digitalWrite(10, HIGH);
  } else if (t == 'L') {     // Turn right (left side motors rotate in forward direction, right side motors don't rotate)
    digitalWrite(11, HIGH);
  } else if (t == 'R') {     // Turn left (right side motors rotate in forward direction, left side motors don't rotate)
    digitalWrite(13, HIGH);
  } else if (t == 'W') {     // Turn LED on
    digitalWrite(9, HIGH);
  } else if (t == 'w') {     // Turn LED off
    digitalWrite(9, LOW);
  } else if (t == 'S') {     // STOP (all motors stop)
    digitalWrite(13, LOW);
    digitalWrite(12, LOW);
    digitalWrite(11, LOW);
    digitalWrite(10, LOW);
  }
  delay(100);
}

This code is designed to run on the Arduino Uno R3. It sets up the digital pins connected to the motor driver and LED as outputs and initializes serial communication. The loop function reads a character from the serial port and controls the motors and LED based on the received command.