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 document provides a detailed overview of a circuit that includes multiple HC-SR04 Ultrasonic Sensors, an L298N DC motor driver, an Arduino UNO, a Rocker Switch, a pair of 18650 Li-ion Batteries, and two DC Motors. The circuit is designed to interface with the Arduino UNO, which controls the ultrasonic sensors and the DC motors via the L298N motor driver.

Component List

HC-SR04 Ultrasonic Sensor

  • Description: Ultrasonic distance sensor
  • Pins: VCC, TRIG, ECHO, GND

L298N DC Motor Driver

  • Description: 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

Arduino UNO

  • Description: 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

Rocker Switch

  • Description: On/Off switch
  • Pins: 1, 2

18650 Li-ion Battery x 2

  • Description: Rechargeable lithium-ion battery
  • Pins: +, -

DC Motor

  • Description: Standard DC motor
  • Pins: pin 1, pin 2

Wiring Details

HC-SR04 Ultrasonic Sensor 1

  • GND: Connected to Arduino UNO GND
  • VCC: Connected to Arduino UNO 5V
  • TRIG: Connected to Arduino UNO A3
  • ECHO: Connected to Arduino UNO A2

HC-SR04 Ultrasonic Sensor 2

  • GND: Connected to Arduino UNO GND
  • VCC: Connected to Arduino UNO 5V
  • TRIG: Connected to Arduino UNO D13
  • ECHO: Connected to Arduino UNO D12

HC-SR04 Ultrasonic Sensor 3

  • GND: Connected to Arduino UNO GND
  • VCC: Connected to Arduino UNO 5V
  • TRIG: Connected to Arduino UNO A5
  • ECHO: Connected to Arduino UNO A4

L298N DC Motor Driver

  • OUT1: Connected to DC Motor 2 pin 2
  • OUT2: Connected to DC Motor 2 pin 1
  • 12V: Connected to Rocker Switch pin 2
  • GND: Connected to Arduino UNO GND and 18650 Li-ion Battery x 2 -
  • 5V: Connected to Arduino UNO Vin
  • OUT3: Connected to DC Motor 1 pin 2
  • OUT4: Connected to DC Motor 1 pin 1
  • ENA: Connected to Arduino UNO D6
  • IN1: Connected to Arduino UNO D7
  • IN2: Connected to Arduino UNO D8
  • IN3: Connected to Arduino UNO D9
  • IN4: Connected to Arduino UNO D10
  • ENB: Connected to Arduino UNO D11

Rocker Switch

  • Pin 1: Connected to 18650 Li-ion Battery x 2 +
  • Pin 2: Connected to L298N DC Motor Driver 12V

18650 Li-ion Battery x 2

  • +: Connected to Rocker Switch pin 1
  • -: Connected to L298N DC Motor Driver GND

DC Motor 1

  • Pin 1: Connected to L298N DC Motor Driver OUT4
  • Pin 2: Connected to L298N DC Motor Driver OUT3

DC Motor 2

  • Pin 1: Connected to L298N DC Motor Driver OUT2
  • Pin 2: Connected to L298N DC Motor Driver OUT1

Documented Code

Arduino UNO Code

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

}

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

}

This code is a basic template for the Arduino UNO. The setup() function is where you initialize your components, and the loop() function is where you place the code that needs to run continuously.

This concludes the documentation for the circuit.