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

Arduino-Controlled Robot with Ultrasonic Sensor and Dual DC Motors

Image of Arduino-Controlled Robot with Ultrasonic Sensor and Dual DC Motors

Circuit Documentation

Summary

This circuit is designed to control a servo and two DC motors using an Arduino UNO microcontroller. It includes an L298N DC motor driver to manage the motors' operations and an HC-SR04 Ultrasonic Sensor for distance measurement. The circuit is powered by a 3xAAA Battery Pack with a switch and JST connector. The Arduino UNO is the central processing unit that interfaces with the motor driver, servo, and ultrasonic sensor to perform specific tasks as programmed.

Component List

Arduino UNO

  • Microcontroller board based on the ATmega328P
  • It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.

DC Motor (x2)

  • An electric motor that runs on direct current (DC) electricity.
  • Typically used for driving mechanical loads.

Servo

  • A rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity, and acceleration.
  • It consists of a suitable motor coupled to a sensor for position feedback.

L298N DC Motor Driver

  • A high current dual full-bridge driver designed to accept standard TTL logic levels.
  • It is capable of driving high voltage/high current DC motors.

HC-SR04 Ultrasonic Sensor

  • An ultrasonic distance sensor that provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm.

3xAAA Battery Pack with Switch and JST

  • A battery holder for three AAA batteries with an integrated switch and JST connector for easy power supply management.

Wiring Details

Arduino UNO

  • 5V connected to Servo VCC and HC-SR04 VCC
  • GND connected to Servo GND, HC-SR04 GND, and L298N GND
  • Vin connected to 3xAAA Battery Pack POS
  • D11 connected to L298N ENA
  • D10 connected to L298N IN1
  • D9 connected to L298N IN2
  • D8 connected to L298N IN3
  • D7 connected to L298N IN4
  • D6 connected to L298N ENB
  • D5 connected to Servo pulse
  • D3 connected to HC-SR04 ECHO
  • D2 connected to HC-SR04 TRIG

DC Motor #1

  • pin 1 connected to L298N OUT4
  • pin 2 connected to L298N OUT3

DC Motor #2

  • pin 1 connected to L298N OUT2
  • pin 2 connected to L298N OUT1

Servo

  • vcc connected to Arduino UNO 5V
  • gnd connected to Arduino UNO GND
  • pulse connected to Arduino UNO D5

L298N DC Motor Driver

  • OUT1 to OUT4 connected to DC Motors
  • 12V connected to 3xAAA Battery Pack POS
  • GND connected to Arduino UNO GND
  • ENA and ENB connected to Arduino UNO D11 and D6 respectively
  • IN1 to IN4 connected to Arduino UNO D10 to D7 respectively

HC-SR04 Ultrasonic Sensor

  • VCC connected to Arduino UNO 5V
  • GND connected to Arduino UNO GND
  • ECHO connected to Arduino UNO D3
  • TRIG connected to Arduino UNO D2

3xAAA Battery Pack with Switch and JST

  • POS connected to Arduino UNO Vin and L298N 12V
  • NEG connected to Arduino UNO GND

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:

}

Note: The provided code is a template and does not contain any functional code. It needs to be populated with instructions to control the motors, servo, and read data from the ultrasonic sensor.