Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO-Based Obstacle Avoidance Robot with Ultrasonic Sensors and L298N Motor Driver

Image of Arduino UNO-Based Obstacle Avoidance Robot with Ultrasonic Sensors and L298N Motor Driver

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller interfacing with multiple HC-SR04 ultrasonic sensors, an L298N DC motor driver, two hobby motors, and a rocker switch. The circuit is powered by a 7.4V battery. The Arduino UNO is used to control the ultrasonic sensors and the motor driver, which in turn controls the hobby motors.

Component List

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

HC-SR04 Ultrasonic Sensor

  • Description: An ultrasonic distance sensor.
  • Pins: VCC, TRIG, ECHO, GND

L298N DC Motor Driver

  • Description: A dual H-Bridge motor driver.
  • 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

7.4V Battery

  • Description: A power source for the circuit.
  • Pins: +, -

Motor amarillo motorreductor hobby

  • Description: A hobby motor with a gearbox.
  • Pins: vcc, GND

Rocker Switch

  • Description: A switch to control the power supply.
  • Pins: 1, 2

Wiring Details

Arduino UNO

  • 5V connected to:

    • VCC of HC-SR04 Ultrasonic Sensor (3 instances)
  • GND connected to:

    • GND of HC-SR04 Ultrasonic Sensor (3 instances)
    • GND of L298N DC Motor Driver
      • of 7.4V Battery
  • Vin connected to:

    • 5V of L298N DC Motor Driver
  • A0 connected to:

    • TRIG of HC-SR04 Ultrasonic Sensor (1 instance)
  • A1 connected to:

    • ECHO of HC-SR04 Ultrasonic Sensor (1 instance)
  • A2 connected to:

    • ECHO of HC-SR04 Ultrasonic Sensor (1 instance)
  • A3 connected to:

    • TRIG of HC-SR04 Ultrasonic Sensor (1 instance)
  • A4 connected to:

    • ECHO of HC-SR04 Ultrasonic Sensor (1 instance)
  • A5 connected to:

    • TRIG of HC-SR04 Ultrasonic Sensor (1 instance)
  • D10 connected to:

    • ENB of L298N DC Motor Driver
  • D9 connected to:

    • IN4 of L298N DC Motor Driver
  • D8 connected to:

    • IN3 of L298N DC Motor Driver
  • D7 connected to:

    • IN2 of L298N DC Motor Driver
  • D6 connected to:

    • IN1 of L298N DC Motor Driver
  • D5 connected to:

    • ENA of L298N DC Motor Driver

HC-SR04 Ultrasonic Sensor

  • VCC connected to:

    • 5V of Arduino UNO
  • GND connected to:

    • GND of Arduino UNO
  • TRIG connected to:

    • A0, A3, A5 of Arduino UNO (one instance each)
  • ECHO connected to:

    • A1, A2, A4 of Arduino UNO (one instance each)

L298N DC Motor Driver

  • GND connected to:

    • GND of Arduino UNO
      • of 7.4V Battery
  • 5V connected to:

    • Vin of Arduino UNO
  • ENB connected to:

    • D10 of Arduino UNO
  • IN4 connected to:

    • D9 of Arduino UNO
  • IN3 connected to:

    • D8 of Arduino UNO
  • IN2 connected to:

    • D7 of Arduino UNO
  • IN1 connected to:

    • D6 of Arduino UNO
  • ENA connected to:

    • D5 of Arduino UNO
  • OUT1 connected to:

    • GND of Motor amarillo motorreductor hobby (1 instance)
  • OUT2 connected to:

    • vcc of Motor amarillo motorreductor hobby (1 instance)
  • OUT3 connected to:

    • GND of Motor amarillo motorreductor hobby (1 instance)
  • OUT4 connected to:

    • vcc of Motor amarillo motorreductor hobby (1 instance)
  • 12V connected to:

    • 1 of Rocker Switch

7.4V Battery

  • - connected to:

    • GND of L298N DC Motor Driver
    • GND of Arduino UNO
  • + connected to:

    • 2 of Rocker Switch

Motor amarillo motorreductor hobby

  • vcc connected to:

    • OUT2, OUT4 of L298N DC Motor Driver (one instance each)
  • GND connected to:

    • OUT1, OUT3 of L298N DC Motor Driver (one instance each)

Rocker Switch

  • 1 connected to:

    • 12V of L298N DC Motor Driver
  • 2 connected to:

      • of 7.4V Battery

Documented Code

Arduino UNO Code (sketch.ino)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Documentation (documentation.txt)