Question

In: Electrical Engineering

the track movement of the Arduino autonomous vehicle

the track movement of the Arduino autonomous vehicle 

Solutions

Expert Solution

An arduino autonomous robot has four tracking modes forward, backward, left and right. You will need two DC motors attached to the two wheels of robot. These motor should be driven by L293d or any other motor driver. This motor driver is then should be connected to the Arduino pins. Arduino will control the movement of the robot by using these pins.

An autonomous robot should have a capabilty of sensing any object or obstacle. To perform this function, you can use an ultrasonic sensor like HC SR04 and attach it to Arduino.

You sense obstacle by HCSR04 and the arduino control the DC motors (wheel). Here is the code that I used in Automatic braking system. You can easily understand what the code is doing? and you can also modify the code to suits your application.


const int trigPin = 10;
const int echoPin = 12;

long duration;
int distance;
void forward();
void stop();

int motor1_pin1 = 4;
int motor1_pin2 = 3;
int motor2_pin1 = 9;
int motor2_pin2 = 8;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(12, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);

pinMode(motor1_pin1, OUTPUT);
pinMode(motor1_pin2, OUTPUT);
pinMode(motor2_pin1, OUTPUT);
pinMode(motor2_pin2, OUTPUT);
   forward();

}

void loop()

{

digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = duration * 0.034 / 2;

Serial.print("Distance: ");
Serial.println(distance);

if (distance < 25) {
    stop();
}
else {
    forward();
}

  

}


void forward() {
digitalWrite(motor2_pin1, HIGH);
digitalWrite(motor2_pin2, LOW);
digitalWrite(motor1_pin1, HIGH);
digitalWrite(motor1_pin2, LOW);

}

void backward() {
digitalWrite(motor2_pin1, LOW);
digitalWrite(motor2_pin2, HIGH);
digitalWrite(motor1_pin1, LOW);
digitalWrite(motor1_pin2, HIGH);

}

void right() {
digitalWrite(motor2_pin1, HIGH);
digitalWrite(motor2_pin2, LOW);
digitalWrite(motor1_pin1, LOW);
digitalWrite(motor1_pin2, LOW);

}
void left() {
digitalWrite(motor2_pin1, LOW);
digitalWrite(motor2_pin2, LOW);
digitalWrite(motor1_pin1, HIGH);
digitalWrite(motor1_pin2, LOW);

}

void stop() {
digitalWrite(motor2_pin1, LOW);
digitalWrite(motor2_pin2, LOW);
digitalWrite(motor1_pin1, LOW);
digitalWrite(motor1_pin2, LOW);

}

 

 


Related Solutions

Consider a simplification of a autonomous vehicle project on Markov processes. The process has three states...
Consider a simplification of a autonomous vehicle project on Markov processes. The process has three states that describe the driving environment: s1:= “driving in city,” s2 := “driving in suburbs,” s3 := “driving in rural area (‘country’).” If the car is driving in the city, there is a 50% chance the next passenger pickup assignment will also be in the city. If the car is driving in the suburbs, there is a 40% chance the next passenger pickup assignment will...
Consider three vehicles running on a circular track of circumference 2 km. Vehicle A travels at...
Consider three vehicles running on a circular track of circumference 2 km. Vehicle A travels at a constant speed of 30 km/h, vehicle B travels at 60 km/h and vehicle C travels at 90 km/hr. Calculate the ratio of space mean speed over time mean speed.
what is the following (ARDUINO): -Examples of a standard Arduino library -The Arduino uses a structured...
what is the following (ARDUINO): -Examples of a standard Arduino library -The Arduino uses a structured programming language-what type -Channels of A/D conversion on the Arduino Uno -The Arduino correlates temperature readings with what
witches »   HW-20: Arduino - Motor Speed.problem Arduino - Measuring Motor Speed Arduino sketch with...
witches »   HW-20: Arduino - Motor Speed.problem Arduino - Measuring Motor Speed Arduino sketch with corresponding line numbers per coding line. Match line # 1 through #17 with the corresponding instruction purpose. _____________________________________________________________________ 1.   int count = 0;      float f = 0;      float PPR = 500;      float RPM= 0; 2.   void setup() 3.      pinMode(2,INPUT); 4.      attachInterrupt(0,freq,RISING); 5.      Serial.begin(9600); 6.    void loop()       { 7.      count=0; 8.      delay(100); 9.      f=10*count; 10.    RPM=f/PPR; 11.    Serial.print(count); 12.    Serial.print(" Pulses/100ms");...
case: Now because of COVID-19, the lockdown makes this industry highly shattered, Less movement of vehicle,...
case: Now because of COVID-19, the lockdown makes this industry highly shattered, Less movement of vehicle, less or no manufacturing sectors apart from few commodity, all these creates again a big dilemma in this industry. Question: -Show how the equilibrium price will change in oil industries the in relation to the fluctuation of prices
Pharaphrase and rewrite the following paragraph: Arduino Arduino Uno is a microcontroller board b... pharaphrase and...
Pharaphrase and rewrite the following paragraph: Arduino Arduino Uno is a microcontroller board b... pharaphrase and rewrite the following paragraph: Arduino Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to...
How is GEOMETRIC OPTICS relevant to the development of autonomous or semi-autonomous technology and include? How...
How is GEOMETRIC OPTICS relevant to the development of autonomous or semi-autonomous technology and include? How is Magnetic field relevant to the development of autonomous or semi-autonomous technology and include?
The economy of Irinika has the following parameters: Autonomous exports = $520 million Autonomous imports =...
The economy of Irinika has the following parameters: Autonomous exports = $520 million Autonomous imports = $220 million MPM = 0.20 a. The balance of trade at an income of $700 is $ . Remember to enter a minus (-) sign to indicate negative values. b. The balance of trade at an income of $2,000 is $. c. The income level at which there is a zero balance of trade is $ . Complete the balancing row, in the table...
334) An Arduino analog input voltage is 4.320 volts. The Arduino PWM output pin drives a...
334) An Arduino analog input voltage is 4.320 volts. The Arduino PWM output pin drives a low-pass filter, which converts the PWM signal back to an average-DC voltage. Arduino specifications include: I/O voltage ranges of 0 to 5VDC; 10-bit A/D; and 8-bit D/A PWM output. The analog voltage DC input results in an analog output DC volage at the low-pass filter. Determine (Vout - Vin). Arduino functions include: analogRead(), map(), and analogWrite(). The analogRead() and map() use integer I/O.
Design and program an Arduino-based circuit that contains the following items - 1 Arduino Uno microcontroller....
Design and program an Arduino-based circuit that contains the following items - 1 Arduino Uno microcontroller. - 1 IR remote control, - 1 IR sensor - 1 LCD 16x2 Display - Any other components you find necessary. The circuit will do the following: - The circuit represents a 2-digit calculator. - At start of operation, the LCD display should display “0” in line 2 of the LCD display. - Pressing the On/Off button on the IR remote represents the “Clear”...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT