Git Product home page Git Product logo

git-utkarsh / obstacle-avoiding-robot Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 3.92 MB

This Arduino code utilizes an ultrasonic sensor to measure distances. When an object is detected within a fix distance , the connected motors trigger a sequence: move backward, turn right, turn left, then move forward. Motor control is achieved using the AFMotor library, and the distance calculation is based on the sensor's pulse duration.

License: MIT License

C++ 100.00%
arduino l293d obstacle-avoidance obstacle-avoidance-robot obstacle-detection ultrasonic-sensor

obstacle-avoiding-robot's Introduction

Award Winning Obstacle Avoidance Robot

github

Description

This Arduino code implements an object avoidance mechanism using an ultrasonic sensor and a four-wheeled robot with individual motors. When an object is detected within 15 cm, the robot performs a predefined sequence: it moves backward, turns right, turns left, and then moves forward. Motor control is facilitated through the AFMotor library, while the distance calculation relies on the pulse duration from the ultrasonic sensor.

Components Used

  • Ultrasonic Sensor
  • AFMotor Library
  • Motor Shield
  • Four DC Motors (M1, M2, M3, M4)
  • Arduino Board

Circuit Setup

circuit image

  1. Connect the ultrasonic sensor's trigPin to A2 and echoPin to A3 on the Arduino.
  2. Connect the four DC motors to the motor controller, assigning each to motorM1, motorM2, motorM3, and motorM4.
  3. Ensure the AFMotor library is installed in your Arduino IDE.

How It Works

The Arduino continuously measures the distance using the ultrasonic sensor. When an object is detected within 15 cm, it triggers a sequence of movements to avoid the obstacle: move backward, turn right, turn left, and then move forward. Motor speed and direction are controlled through the AFMotor library.

Usage

  1. Upload the provided code to your Arduino board.
  2. Ensure the hardware setup is correct.
  3. Power up the robot.
  4. Observe the robot's behavior in response to obstacles within its detection range.

Note: Adjustments to motor speeds and delay times can be made in the code to optimize performance for your specific robot.

Feel free to contribute by forking the repository and submitting pull requests.

Test.Video.mp4

License

This project is licensed under the MIT License.

obstacle-avoiding-robot's People

Contributors

git-utkarsh avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

github-shashank

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.