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

Arduino UNO Bluetooth-Controlled Robotic Car with L298N Motor Driver and 18650 Li-Ion Battery

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

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to control multiple motors using an Arduino UNO, an L298N DC motor driver, and an HC-05 Bluetooth module. The circuit is powered by a 18650 Li-Ion battery. The Arduino UNO receives commands via Bluetooth and controls the motors accordingly.

Component List

  1. Motor with reducer

    • Description: A motor with an integrated reducer to control speed and torque.
    • Pins: 3 - 6 VCC, GND
  2. Arduino UNO

    • Description: A 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
  3. L298N DC motor driver

    • Description: A dual H-Bridge motor driver module.
    • 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
  4. 18650 Li-Ion

    • Description: A rechargeable lithium-ion battery.
    • Pins: Positive, Negative
  5. HC-05 Bluetooth Module

    • Description: A Bluetooth module for wireless communication.
    • Pins: Key, VCC, TXD, RXD, State, GND

Wiring Details

Motor with reducer

Arduino UNO

L298N DC motor driver

18650 Li-Ion

HC-05 Bluetooth Module

Documented Code

char data; // Variable to store received data

void setup() {
  Serial.begin(9600); // Start serial communication at 9600 baud rate

  // Set motor control pins as output
  pinMode(7, OUTPUT); 
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
}

void loop() {
  if (Serial.available() > 0) {
    data = Serial.read(); // Read received data

    // Control motor movement based on received data
    switch (data) {
      case 'F': // Move Forward
        digitalWrite(7, HIGH);
        digitalWrite(6, LOW);
        digitalWrite(5, HIGH);
        digitalWrite(4, LOW);
        break;
      case 'B': // Move Backward
        digitalWrite(7, LOW);
        digitalWrite(6, HIGH);
        digitalWrite(5, LOW);
        digitalWrite(4, HIGH);
        break;
      case 'R': // Turn Right
        digitalWrite(7, LOW);
        digitalWrite(6, HIGH);
        digitalWrite(5, HIGH);
        digitalWrite(4, LOW);
        break;
      case 'L': // Turn Left
        digitalWrite(7, HIGH);
        digitalWrite(6, LOW);
        digitalWrite(5, LOW);
        digitalWrite(4, HIGH);
        break;
      case 'S': // Stop
        digitalWrite(7, LOW);
        digitalWrite(6, LOW);
        digitalWrite(5, LOW);
        digitalWrite(4, LOW);
        break;
    }
  }
}

This code initializes the serial communication and sets the motor control pins as outputs. It reads data from the Bluetooth module and controls the motors based on the received commands.