You can build an automatic Solar grass cutter with obstacle avoidance syste.
Details of this project is given below.
You are going to Arduino, ultrasonic sensor, motor driver moduleS, Solar panel, geared DC motor, Four wheel robotic model to build this projects.
Layout of the project is shown below.
Here is the coding for this project
const int trigPin = 10;
const int echoPin = 11;
// defines variables
long duration;
int distance;
int MOTOR1A= 6;
int MOTOR1B =7;
int MOTOR2A =8;
int MOTOR2B =9;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
pinMode(MOTOR1A, OUTPUT);
pinMode(MOTOR1B, OUTPUT);
pinMode(MOTOR2A, OUTPUT);
pinMode(MOTOR2B, OUTPUT);
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in
microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
if (distance<50){
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
}
else if (distance>50){
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
}
}
Your final project will look like below
kindly thumbsup if answer helped you.
Final Project Apr 30, 2019 12:15 PM Greetings Please do a final project which can be...