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

Arduino UNO-Based Autonomous Robot with PIR and Ultrasonic Sensors

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Autonomous Robot with PIR and Ultrasonic Sensors

Circuit Documentation

Summary

This circuit is designed to control a robotic system using an Arduino UNO microcontroller. The system includes multiple sensors (PIR sensors and an Ultrasonic sensor), a servo motor, and several DC motors controlled via an L293D motor driver. The Arduino UNO reads sensor data and controls the motors based on the sensor inputs and predefined logic.

Component List

  1. 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
  2. L293D

    • Description: Motor driver IC used to control DC motors and servo motors.
    • Pins: 5V, GND, +, Servo1, Servo2, RX/DO, TX/D1, 9V, A0, A1, A2, A3, A4/SDA, A5/SCL, VIN, 3.3V, RESET, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13
  3. PIR Sensor (Left)

    • Description: Passive Infrared sensor used to detect motion.
    • Pins: VDD, SIG, GND
  4. PIR Sensor (Right)

    • Description: Passive Infrared sensor used to detect motion.
    • Pins: VDD, SIG, GND
  5. Ultrasonic Sensor

    • Description: Sensor used to measure distance by using ultrasonic waves.
    • Pins: +VCC, Trigger, Echo, GND
  6. Servo

    • Description: Servo motor used for precise control of angular position.
    • Pins: GND, VCC, PWM
  7. DC Motor (x4)

    • Description: Standard DC motor used for driving the robot.
    • Pins: pin 1, pin 2
  8. 7.4V Battery

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

Wiring Details

Arduino UNO

L293D

PIR Sensor (Left)

PIR Sensor (Right)

Ultrasonic Sensor

Servo

DC Motor (x4)

7.4V Battery

Code Documentation

#include <Servo.h> // Include the Servo library

// PIR Sensor Pins
const int pirLeft = A0;  // Left PIR Sensor
const int pirRight = A1; // Right PIR Sensor

// Ultrasonic Sensor Pins
const int trigPin = 9;
const int echoPin = 10;

// Motor Pins (L293D)
const int motorLeftForward = 4;
const int motorLeftBackward = 5;
const int motorRightForward = 6;
const int motorRightBackward = 7;

// Servo Motor
Servo servo; // Create a servo object
const int servoPin = 8; // Servo signal pin

// Distance thresholds (in cm)
const int minDistance = 10; // Stop if closer
const int maxDistance =