Introduction: "GRECO" - Arduino Object Avoiding Robot for Beginners

Well, if you are a beginner, here you will find the easiest way to build your own object avoiding robot!

We will use a mini round robot chassis with two dc motors to build it easier.

For one more time we choose to use the famous Arduino UNO board.

Our tiny robot "GRECO" will scan for object in front of it by using a Ultrasonic sensor. If an object is detected, the robot will stop and "look" right and left for the best escape route!

Official project page and future updates: http://www.ardumotive.com/greco-roboten.html

Are you ready? Let's get started!

Step 1: About Ultrasonic Sensor

Ultrasonic sensors work on a principle similar to radar or sonar, which evaluate attributes of a target by interpreting the echoes from radio or sound waves respectively.

Active ultrasonic sensors generate high frequency sound waves and evaluate the echo which is received back by the sensor, measuring the time interval between sending the signal and receiving the echo to determine the distance to an object.

Passive ultrasonic sensors are basically microphones that detect ultrasonic noise that is present under certain conditions.

The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats or dolphins do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package. From 2cm to 400 cm or 1” to 13 feet. It operation is not affected by sunlight or black material like Sharp rangefinders are (although acoustically soft materials like cloth can be difficult to detect). It comes complete with ultrasonic transmitter and receiver module.

Technical info:

  • Power Supply :+5V DC
  • Quiescent Current : <2mA
  • Working Currnt: 15mA
  • Effectual Angle: <15°
  • Ranging Distance : 2cm – 400 cm/1" - 13ft
  • Resolution : 0.3 cm
  • Measuring Angle: 30 degree
  • Trigger Input Pulse width: 10uS
  • Dimension: 45mm x 20mm x 15mm

Step 2: What You Will Need - Hardware

For this project you will need:

You will also need some cables and some extra spacers.

Tools: Screwdriver, heat glue gun

Step 3: Assembly the Mini Round Robot Chassis Kit

Follow the images below !

A picture is worth a thousand words!

Step 4: The Circuit

The motor shield that we are using has some header pins labeled as Digital I/O and Analog I/O. We will use them to connect our hardware parts together with Arduino uno board.

Servo Motor

Connect your servo cable to first header (D7 5V GND). Make sure that the brown cable is connected to pin GND (right side)

Buzzer

Connect to the first pin of second header (D8) the "+" buzzer pin and the "-" to GND

Ultrasonic Sensor

We will use the third and fourth header, make the following connections:

  • Vcc - 5V (3d header)
  • Trig - A2 (3d header)
  • GND- GND (3d header)
  • Echo - A3 (4th header)

Motors (look your robot from behind)

  • Right DC Motor : Red cable to "M1+" and black to "M1-"
  • Left DC Motor: Red cable to "M2+" and black to "M2-"

Power - Battery holder

Connect it to shield "Vin -GND" screw terminal. Add one more cable and connect it with "Vin" pin of Arduino Uno board. If you want you can add an ON/OFF SW on the red cable of your battery holder pack.

Step 5: The Code

Make the "GRECO" alive by program it with the following code!

Notes

  • If your robot moves to fast and hit the objects, change the speed variable in line 26. (PWM value)
  • If your robot doesn't move forward, go to lines 43 and 44 and add to "speedPWM" an offset. Make sure that the sum is bellow 255. In my case I need to add plus 50 to left motor, so my right motor has a PWM speed value 150 and left 250.

Download the code from here and open it with Arduino IDE. Inside you will also find the ultrasonic library file.

Step 6: ​Well Done!

Well...that's it!I hope you liked this, let me know in the comments!

Post me some photos of your Arduino robot!

You can find more Arduino DIY projects at www.Ardumotive.com

Thank you!