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

Arduino Uno R3 Bluetooth-Controlled Robot

Image of Arduino Uno R3 Bluetooth-Controlled Robot

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 system also includes an HC-05 Bluetooth module for wireless communication and a 4 x AAA battery mount to provide power. The Arduino Uno R3 is programmed to interpret serial commands and control the motors accordingly, allowing for forward, reverse, left, and right movements, as well as stopping the motors and controlling an LED.

Component List

Arduino Uno R3

  • Microcontroller board based on the ATmega328P
  • Features digital I/O pins, analog input pins, and various power options
  • Equipped with USB connection for programming and serial communication

L298N DC Motor Driver

  • Module for controlling up to two DC motors
  • Provides high current and high voltage capabilities
  • Includes enable and input pins for controlling motor direction and speed

DC Motors (4x)

  • Electric motors that convert electrical energy into mechanical rotation
  • Each motor has two connection pins for power and control

HC-05 Bluetooth Module

  • Wireless communication module for Bluetooth connectivity
  • Allows for serial communication over Bluetooth

4 x AAA Battery Mount

  • Power source for the circuit
  • Holds four AAA batteries to provide a voltage supply

Wiring Details

Arduino Uno R3

  • 5V connected to HC-05 VCC
  • GND connected to L298N GND, HC-05 GND, and 4 x AAA Battery Mount -
  • VIN connected to L298N 5V
  • Digital pins 13, 12, 11, 10 connected to L298N IN1, IN2, IN3, IN4 respectively
  • Pins 1 and 0 connected to HC-05 TXD and RXD for serial communication

L298N DC Motor Driver

  • GND connected to Arduino Uno R3 GND and 4 x AAA Battery Mount -
  • 5V connected to Arduino Uno R3 VIN
  • IN1, IN2, IN3, IN4 connected to Arduino Uno R3 digital pins 13, 12, 11, 10
  • OUT1, OUT2 connected to two DC Motors
  • OUT3, OUT4 connected to the other two DC Motors
  • 12V connected to 4 x AAA Battery Mount +

DC Motors

  • Each motor has two pins, one connected to either OUT1, OUT2, OUT3, or OUT4 on the L298N

HC-05 Bluetooth Module

  • VCC connected to Arduino Uno R3 5V
  • GND connected to Arduino Uno R3 GND
  • TXD connected to Arduino Uno R3 pin 1
  • RXD connected to Arduino Uno R3 pin 0

4 x AAA Battery Mount

  • + connected to L298N 12V
  • - connected to Arduino Uno R3 GND and L298N GND

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 necessary pins 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.