FATCVDVI0HYWS19
FATCVDVI0HYWS19
FATCVDVI0HYWS19
BASIC REQUIREMENTS:
ARDUINO UNO
Ultrasonic sensor (SR 04)
2 low current motors
12v battery
What is an ARDUINO?
Arduino Uno is a single board microcontroller intended to make the
application of interactive objects or environmentsmore accessible. The hardware
consists of an open source hardware board designed around an 8-bit atmel AVR
microcontroller or a 32 bit atmel ARM. The Arduino board used for this purpose is
Arduino UNO. You can find more about this board in Arduino UNO.
STEP 1:
Take an ARDUINO UNO and connect it with your PC using a data
cable. ARDUINO IDE is the platform that is used to write the codes
and burn it in the microcontroller of ARDUINO. Hence, it is
necessary to have this software installed in the PC before
connecting the ARDUINO UNO. You can ping through the options
available in this software before it is used. You can get started in
an Arduino IDE environment very easily by seeing, Getting started
with Arduino IDE
STEP 2:
An ARDUINO code which is written in ARDUINO IDE (Software) is
shown below. Here ultrasonic sensor reading is used to calculate
the distance from the sensor to any obstacle before it and these
readings are used to control the motor.
If you are a novice you could try this simple ARDUINO IDE code
which is given below.
-----------------------------------------------------------------
//ARDUINO IDE code for Obstacle detecting Robot
const int trig = 12;
const int echo = 11;
const int motorPin1 = 2;//left motor of the robot
const int motorPin1 = 3;//right motor of the robot
long duration, inches, cm;
void setup()
{
Serial.begin(9600);
pinMode(trig,OUTPUT);
pinMode(echo,INPUT);
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
}
void loop()
{
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(5);
digitalWrite(trig, LOW);
Serial.print(inches);
Serial.print(“in, “);
Serial.print(cm);
Serial.print(“cm”);
Serial.println();
delay(100);//this delays the code by 0.1 second and repeats the loop again
}
----------------------------------------------------
You have to burn this code into the ARDUINO UNO board using
the UPLOAD option.
In this code we first initialize the ultrasonic and the 2 motors
with the pins in which they are connected. Then we get an input
from the ultrasonic sensor and convert the duration(time period)
into cm and inches in order to measure distance. The distance
recorded is compared with 4cm (in this case) and the condition is
checked. If the condition is TRUE the two MOTORS are in high
state and they roll forward. But when the condition fails, the right
motor stops rotating and the left motor continues to rotate for a
specified time period in the delay. This makes the robot to turn
towards the right direction. The loop is executed once again and
the process continues and the process goes on…
STEP 3:
Make the circuit connections as shown in the picture below.
This circuit is exclusively for low current motors used in toy cars. In case you use a
high power DC motor, you may need to add a Motor driver circuit. You can find
more about it in blog.iqubean.in
STEP 4:
Make a trial test before you build up a chassis for the robot.
STEP 5:
Now it is ready. All you need is to build a chassis and fit these
modules in the chase and experiment yourself….