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

Arduino and L298P Motor Shield Controlled Robotic Car with LED Indicators and Bluetooth Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino and L298P Motor Shield Controlled Robotic Car with LED Indicators and Bluetooth Connectivity

Circuit Documentation

Summary

This circuit is designed to control a motorized vehicle with LED indicators and a piezo buzzer. The vehicle is controlled using an Arduino UNO and an L298P drive shield. The circuit also includes Bluetooth communication for remote control. The LEDs and piezo buzzer provide visual and audio feedback, respectively.

Component List

  1. Motor and Wheels

    • Description: Motor and wheel assembly for vehicle movement.
    • Pins: VCC, GND
  2. L298P Drive Shield

    • Description: Motor driver shield for controlling the motors.
    • Pins: B-, B+, A-, A+, GND, VIN
  3. Battery 12V

    • Description: Power source for the circuit.
    • Pins: +, -
  4. Resistor (1000 Ohms)

    • Description: Current limiting resistor.
    • Pins: pin1, pin2
  5. LED: Two Pin (Red)

    • Description: Red LED for visual indication.
    • Pins: Cathode, Anode
  6. LED: Two Pin (Blue)

    • Description: Blue LED for visual indication.
    • Pins: Cathode, Anode
  7. Arduino UNO

    • Description: Microcontroller for controlling the circuit.
    • 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
  8. Piezo Buzzer

    • Description: Buzzer for audio feedback.
    • Pins: pin 1, pin 2
  9. Bluetooth HC-06

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

Wiring Details

Motor and Wheels

L298P Drive Shield

Battery 12V

Resistors

LEDs

Arduino UNO

Piezo Buzzer

Bluetooth HC-06

Documented Code

L298P Drive Shield Code

#include <AFMotor.h>

AF_DCMotor leftMotor(1);  
AF_DCMotor rightMotor(2); 

#define BLUE_LED 3
#define RED_LED 4

void setup() {
  leftMotor.setSpeed(200);  
  rightMotor.setSpeed(200);

  pinMode(BLUE_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  if (Serial.available()) {
    char command = Serial.read();

    switch (command) {
      case 'F': 
        leftMotor.run(FORWARD);
        rightMotor.run(FORWARD);
        break;

      case 'B': 
        leftMotor.run(BACKWARD);
        rightMotor.run(BACKWARD);
        break;

      case 'L': 
        leftMotor.run(BACKWARD);
        rightMotor.run(FORWARD);
        break;

      case 'R': 
        leftMotor.run(FORWARD);
        rightMotor.run(BACKWARD);
        break;

      case 'S': 
        leftMotor.run(RELEASE);
        rightMotor.run(RELEASE);
        break;

      case 'P': 
        for (int i = 0; i < 5; i++) {
          digitalWrite(BLUE_LED, HIGH);
          delay(200);
          digitalWrite(BLUE_LED, LOW);
          digitalWrite(RED_LED, HIGH);
          delay(200);
          digitalWrite(RED_LED, LOW);
        }
        break;

      default:
        break;
    }
  }
}

Arduino UNO Code

#define PIEZO_PIN 7
#define RED_LED_PIN_1 11
#define RED_LED_PIN_2 10
#define BLUE_LED_PIN_1 9
#define BLUE_LED_PIN_2 8
#define POTENTIOMETER_PIN A0

void setup() {
  pinMode(PIEZO_PIN, OUTPUT);
  pinMode(RED_LED_PIN_1, OUTPUT);
  pinMode(RED_LED_PIN_2, OUTPUT);
  pinMode(BLUE_LED_PIN_1, OUTPUT);
  pinMode(BLUE_LED_PIN_2, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  runSirenAndLEDs();
}

void runSirenAndLEDs() {
  for (int i = 0; i < 350; i++) {
    digitalWrite(PIEZO_PIN, HIGH); 
    digitalWrite(RED_LED_PIN_1, HIGH);
    digitalWrite(RED_LED_PIN_2, LOW);
    digitalWrite(BLUE_LED_PIN_1, HIGH);
    digitalWrite(BLUE_LED_PIN_2, LOW);
    delay(1);
    digitalWrite(PIEZO_PIN, LOW); 
    delay(1);
  }
  delay(50);

  for (int i = 0; i < 150; i++) {
    digitalWrite(PIEZO_PIN, HIGH); 
    digitalWrite(RED_LED_PIN_1, LOW);
    digitalWrite(RED_LED_PIN_2, HIGH);
    digitalWrite(BLUE_LED_PIN_1, LOW);
    digitalWrite(BLUE_LED_PIN_2, HIGH);
    delay(2);
    digitalWrite(PIEZO_PIN, LOW); 
    delay(2);
  }
}

This documentation provides a comprehensive overview of the circuit, including a summary, detailed component list, wiring details, and documented code for the microcontrollers.