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

Arduino UNO Bluetooth-Controlled Robotic Car with Motor Driver and Relay

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

Circuit Documentation

Summary

This circuit is designed to control a set of motors and a relay using an Arduino UNO microcontroller. The circuit includes an L298N DC motor driver for motor control, an HC-05 Bluetooth module for wireless communication, and a 5V relay for switching operations. The Arduino UNO is programmed to receive commands via Bluetooth and control the motors and relay accordingly.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. L298N DC Motor Driver

    • Description: Dual H-Bridge motor driver for controlling DC motors.
    • 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
  3. HC-05 Bluetooth Module

    • Description: Bluetooth module for wireless communication.
    • Pins: Key, VCC, GND, TXD, RXD, State
  4. 5V Relay

    • Description: Relay module for switching operations.
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC
  5. Set Battery (7V)

    • Description: Power source for the circuit.
    • Pins: +, -
  6. Motor with Reducer

    • Description: DC motor with a gear reducer.
    • Pins: 3 - 6 VCC, GND
  7. DC 12V Gear Motor

    • Description: High-torque DC motor.
    • Pins: None

Wiring Details

Arduino UNO

L298N DC Motor Driver

HC-05 Bluetooth Module

5V Relay

Set Battery (7V)

Motor with Reducer

DC 12V Gear Motor

Documented Code

char t;
const int relayPin = 8; // Connect the relay to pin 8

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(relayPin, OUTPUT);
  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 relay on
    digitalWrite(relayPin, HIGH);
  } else if (t == 'w') {    // turn relay off
    digitalWrite(relayPin, 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 control the motors and relay based on commands received via Bluetooth. The commands 'F', 'B', 'L', 'R', 'W', 'w', and 'S' control the forward, backward, left, right movements, relay on, relay off, and stop actions, respectively.