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

Arduino-Based Bluetooth-Controlled Robotic Car with LED Indicators and Siren

View and Edit Project In Cirkit DesignerImage of Arduino-Based Bluetooth-Controlled Robotic Car with LED Indicators and Siren

Circuit Documentation

Summary

This circuit is designed to control a motor and wheels system using an Arduino UNO and an L298P drive shield. It also includes a Bluetooth module for remote control, LEDs for visual indicators, a piezo buzzer for sound alerts, and a pushbutton for user input. The circuit is powered by a 12V battery.

Component List

  1. Motor and Wheels

    • Description: Motor and wheels assembly
    • Pins: VCC, GND
  2. L298P Drive Shield

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

    • Description: 12V power source
    • Pins: +, -
  4. Resistor

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

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

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

    • Description: Microcontroller board
    • 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: Sound alert device
    • Pins: pin 1, pin 2
  9. Bluetooth HC-06

    • Description: Bluetooth module
    • Pins: VCC, GND, TXD, RXD
  10. Pushbutton

    • Description: User input button
    • Pins: Pin 3 (out), Pin 4 (out), Pin 1 (in), Pin 2 (in)

Wiring Details

Motor and Wheels

L298P Drive Shield

Battery 12V

Resistor

LED: Two Pin (Red)

LED: Two Pin (Blue)

Arduino UNO

Piezo Buzzer

Bluetooth HC-06

Pushbutton

Code Documentation

Arduino UNO (Motor and Bluetooth Control)

//we are going to be using different variables in order to define our motor and bluetooth pins because the motor sheild is directly on top of our arudino and we cant see the pins, this makes it easier to code and debug
int E1 = 3;
int M1 = 12;
int E2 = 11;
int M2 = 13;
#define BT_RX_PIN 1
#define BT_TX_PIN 0

//we are using a char to store our incoming byte from the bluetooth module
char incomingByte;

//setup the output motor pins and also use a serial begin function in order to configure the arduino to the correct frequency for our bluetooth module to be recieving inputs
void setup() {
  pinMode(M1, OUTPUT);
  pinMode(M2, OUTPUT);  
  Serial.begin(9600);
}

void loop() {
  //this means that if there is a read from the bluetooth module it will start reading those commands
  if (Serial.available() > 0) {
    //defining our incoming bytes as the read from the bluetooth module
    incomingByte = Serial.read();
    
    /*each of these if statements will assign 5 input commands from the bluetooth module to a specific action, 
    F is forward, B is back, L is left, R is right, S is stop
    the M1 and M2 represents which direction the motors are going to be turning, high is forward, low is back, 
    the E1 and E2 represents the speed control of the motors, the higher the quicker*/
    if (incomingByte == 'F') {
      digitalWrite(M1, HIGH);
      digitalWrite(M2, HIGH);
      analogWrite(E1, 100);
      analogWrite(E2, 100);

    }
    else if (incomingByte == 'B') {
      digitalWrite(M1, LOW);
      digitalWrite(M2, LOW);
      analogWrite(E1, 100);
      analogWrite(E2, 100);
    }
    else if (incomingByte == 'L') {
      digitalWrite(M1, LOW);
      digitalWrite(M2, HIGH);
      analogWrite(E1, 200);
      analogWrite(E2, 100);
    }
    else if (incomingByte == 'R') {
      digitalWrite(M1, HIGH);
      digitalWrite(M2, LOW);
      analogWrite(E1, 100);
      analogWrite(E2, 200);
    }
    else if (incomingByte == 'S') {
      analogWrite(E1, 0);
      analogWrite(E2, 0);
    }
  }
}

Arduino UNO (Lights and Sirens Control)

//This is the section of code reserved for the arduino controlling the lights and sirens

//define each pin for the 4 lights and piezo//
#define PIEZO_PIN 7
#define RED_LED_PIN_1 11
#define RED_LED_PIN