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

Arduino UNO Obstacle Avoiding Car with Ultrasonic Sensor and DC Motors

View and Edit Project In Cirkit DesignerImage of Arduino UNO Obstacle Avoiding Car with Ultrasonic Sensor and DC Motors

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to control a DC motor and a servo motor using an Arduino UNO. The circuit also includes an ultrasonic sensor for obstacle detection and a motor driver for controlling the DC motors. The power is supplied by a 18650 battery in a holder.

Component List

  1. 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
  2. DC Motor

    • Description: A simple DC motor.
    • Pins: pin 1, pin 2
  3. 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
  4. 18650 in Holder

    • Description: A battery holder for a 18650 lithium-ion battery.
    • Pins: GND, VCC
  5. HC-SR04 Ultrasonic Sensor

    • Description: An ultrasonic sensor for distance measurement.
    • Pins: VCC, TRIG, ECHO, GND
  6. Tower Pro SG90 Servo

    • Description: A small servo motor.
    • Pins: Signal, +5V, GND

Wiring Details

Arduino UNO

DC Motor 1

DC Motor 2

L298N DC Motor Driver

18650 in Holder

HC-SR04 Ultrasonic Sensor

Tower Pro SG90 Servo

Code Documentation

// Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Uno"

// The sketch name had to be modified.
// Sketch names must start with a letter or number, followed by letters,
// numbers, dashes, dots and underscores. Maximum length is 63 characters.

// my_car_project:2:13: error: expected constructor, destructor, or type conversion before 'Avoiding'
// * Obstacle Avoiding Car
// ^~~~~~~~

// In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\Servo\src/Servo.h:63:0,
// from C:\Users\DELL\Desktop\my_car_project\my_car_project.ino:8:

// C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\libraries\Servo\src/avr/ServoTimers.h:57:41: error: 'timer16_Sequence_t' does not name a type
// typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
// ^~~~~~~~~~~~~~~~~~

// exit status 1

// expected constructor, destructor, or type conversion before 'Avoiding'

// This report would have more information with
// "Show verbose output during compilation"
// option enabled in File -> Preferences.