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

Arduino UNO-Based Obstacle Avoiding and Bluetooth-Controlled Robot Car

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Obstacle Avoiding and Bluetooth-Controlled Robot Car

Circuit Documentation

Summary

This document provides a detailed overview of a robot car circuit designed for obstacle avoidance, Bluetooth control, and voice control. The circuit includes an Arduino UNO microcontroller, motor and wheels, an HC-SR04 Ultrasonic Sensor, an L293D motor driver, a Micro servo 9G, a 18650 Li-Ion battery, a Bluetooth HC-06 module, and a rocker switch. The Arduino UNO is programmed to control the motors and sensors to navigate and avoid obstacles.

Component List

Arduino UNO

Motor and Wheels

HC-SR04 Ultrasonic Sensor

L293D

Micro Servo 9G

18650 Li-Ion

Bluetooth HC-06

Rocker Switch

Wiring Details

Arduino UNO

Motor and Wheels

HC-SR04 Ultrasonic Sensor

L293D

Micro Servo 9G

18650 Li-Ion

Bluetooth HC-06

Rocker Switch

Documented Code

/*obstacle avoiding, Bluetooth control, voice control robot car.
   Home Page
*/
#include <Servo.h>
#include <AFMotor.h>
#define Echo A0
#define Trig A1
#define motor 10
#define Speed 170
#define spoint 103
char value;
int distance;
int Left;
int Right;
int L = 0;
int R = 0;
int L1 = 0;
int R1 = 0;
Servo servo;
AF_DCMotor M1(1);
AF_DCMotor M2(2);
AF_DCMotor M3(3);
AF_DCMotor M4(4);
void setup() {
  Serial.begin(9600);
  pinMode(Trig, OUTPUT);
  pinMode(Echo, INPUT);
  servo.attach(motor);
  M1.setSpeed(Speed);
  M2.setSpeed(Speed);
  M3.setSpeed(Speed);
  M4.setSpeed(Speed);
}
void loop() {
  Obstacle();
  //Bluetoothcontrol();
  //voicecontrol();
}
void Bluetoothcontrol() {
  if (Serial.available() > 0) {
    value = Serial.read();
    Serial.println(value);
  }
  if (value == 'F') {
    forward();
  } else if (value == 'B') {
    backward();
  } else if (value == 'L') {
    left();
  } else if (value == 'R') {
    right();
  } else if (value == 'S') {
    Stop();
  }
}
void Obstacle() {
  distance = ultrasonic();
  if (distance <= 12) {
    Stop();
    backward();
    delay(100);
    Stop();
    L = leftsee();
    servo.write(spoint);
    delay(800);
    R = rightsee();
    servo.write(spoint);
    if (L < R) {
      right();
      delay(500);
      Stop();
      delay(