Home > Projects > Robotics – Automation Projects > Build A Cheapest Possible Arduino-Robot

Build A Cheapest Possible Arduino-Robot

Summary of Build A Cheapest Possible Arduino-Robot


This article outlines building a low-cost Arduino robot using an Arduino UNO R3, two continuous rotation servos for movement, and a Sharp GP2Y0A21YK0F IR sensor for distance detection. The project involves installing the Arduino IDE, uploading sketches to control hardware, and calibrating the sensor via analog input mapping to centimeters.

Parts used in the Cheapest Possible Arduino-Robot:

  • Arduino UNO R3
  • USB cable
  • Mini solderless breadboard
  • IR sensor (Sharp GP2Y0A21YK0F)
  • Continuous rotation servo
  • Battery holder
  • AA battery
  • Color wires
3 min read

The aim is to build cheapest possible Arduino-robot

Step 1: Components

  1. Arduino UNO R3 x1
  2. USB cable x1
  3. Mini solderless breadboard x1
  4. IR sensor x1
  5. Continuous rotation servo x2
  6. Battery holder x1
  7. AA battery x4
  8. Bunch of color wires

Robot - Cheaper

Step 2: Getting Started With Arduino IDE

First of all we need to install Arduino IDE. The Getting Started Guide from the official Arduino website will tell you everything about it. Once you have installed Arduino IDE you can start writing your own programs for Arduino (often called sketches). We’ll use a language based on C to program our Arduino.

Let’s start.

  1. Open Arduino IDE. By default it will show an empty sketch.
  2. Open example sketch via *File → Examples → 01.Basics → Blink* (or see [Appendix 1](#appendix-1-led-blinking-example)).
  3. Compile this example (*Sketch → Verify/Compile*). You’ll see “Done compiling” and the size of the binary in bytes when the compilation is completed.
  4. Connect your Arduino board to your laptop using a USB cable. After that you will see some connected device in *Tools → Serial Port*. Select it. Now you are able to upload your sketch to the Arduino board.
  5. To start uploading simply press the Upload button on the toolbar or choose *File → Upload*. Arduino will start blinking its TX/RX LEDs and after a few seconds your sketch will have finished uploading indicated by “Done uploading” and the LEDs not flashing anymore.

Congratulations! You have just uploaded your program to the microcontroller.

Step 3: Connect IR Sensor

There is a wide range of different sensors that can be used with Arduino.

We will use a Sharp infrared distance sensor (GP2Y0A21YK0F) to measure distances of objects to your robot. Its range is restricted from 10cm to 80cm.

It’s easy to connect this sensor to Arduino. Take a look at the wiring diagram.

Connect wires as shown: * + (red wire) to +5V pin * ground (black wire) to one of the GND pins * signal (yellow wire) to pin A0

We will use following sketch to calibrate your IR distance sensor (see attachment).

The sketch converts the voltage values read from the first analog pin (A0) to distances in centimeters. To achieve that, it uses a prefilled table (2-dimensional array) that maps the measured value to its corresponding length in centimeters. It’s important to note that Arduino uses a 10-bit analog to digital converter. This means that the value read from the analog pins (0V to 5V) will be translated into integer values between 0 and 210 – 1 = 1023. If you open *Tools → Serial Monitor* after compiling and uploading the sketch, you will see the current analog value and the corresponding distance to the object in front of the sensor.

You can check the measurement by placing an object aligned to a ruler and matching the output from the Serial Monitor. If it’s not enough precise, you should tune the values in the table until you reach the level of precision you need.

Congratulations! You just learned how to read the output of an IR distance sensor!

Read More: Build A Cheapest Possible Arduino-Robot

 

Quick Solutions to Questions related to Cheapest Possible Arduino-Robot:

  • How do I install the Arduino IDE?
    The Getting Started Guide from the official Arduino website provides instructions on installation.
  • What programming language is used for Arduino sketches?
    A language based on C is used to program the Arduino.
  • Which example sketch should I open first?
    You should open the Blink example found under File → Examples → 01.Basics.
  • How do I upload a sketch to the board?
    Connect the board via USB, select the port in Tools, and press the Upload button or choose File → Upload.
  • What is the measurement range of the IR sensor?
    The Sharp infrared distance sensor has a restricted range from 10cm to 80cm.
  • Which pin does the signal wire connect to?
    The yellow signal wire connects to pin A0 on the Arduino.
  • What integer values does the analog converter produce?
    The 10-bit analog to digital converter translates voltage into integer values between 0 and 1023.
  • How can I verify the sensor's precision?
    Place an object aligned to a ruler and match the output from the Serial Monitor against it.
  • Can I tune the sensor values if they are not precise enough?
    Yes, you should tune the values in the table until you reach the desired level of precision.

About The Author

Avatar of Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Use Arduino for Projects

Free Arduino projects, circuits, code and tutorials. Pick a board, pick a sensor, build something.

Scroll to Top