I got the inspiration from wall-e movie which talk about line follower robot who's try to clean the earth after pandemic , also i want my design look like one of my favorite cars the all now electric car jeep wrangler 4xe
so i want to make line following bot with ability to move on line and stop when a body come in front of it
I used fusion 360 in the design
first i used canvas mode to have back ground of car image to help me draw
take lines of the car and the diminution of it (37x17 cm)
extrude the side and look for any issues
draw the base with t-slot and tips
extrude the base
copy the side
project the base on the side and cut the drew parts to have place to nails and screws for t-slot
we do the same process to have all parts
we add the electronic parts to fusion to project it on the body frame of the car
design the motor supporter with 2 t-slot to keep the motor from any strass
design ultra sonic sensor holder
design the batter holder
And voilà you are just finished a great wood jeep wrangler design
All sketches
front
glass
ultrasonic sensor base
hood
ultra sonic sensor front
car base
car roof
car back
motor supporter
car side
wood
Laser cutting
export dxf file from fusion 360 then use RD software to prepare file for laser cutting machine upload the dxf file to laser work and adjust the cutting speed 20 mm\sec and power 65% 300 mm/s the last step to download the file as rld.then using the laser cutting machine, uploaded the file to the machine computer then downloaded it o the machine , adjust the focus and choose the start point and start cutting it.
it takes 21 mins. and two sheets
Software
For Circuit Design
Hardware
1x Arduino UNO.
1x ultrasonic sensor.
1x L298N (Motor Driver).
1x TCRT5000 line follower (there is no TCRT5000 in fritzing i used 3 IR )
4x Yellow Motor with four wheels.
1x white breadboard.
1x7.4 battery (2x3.7 battery in series because fritzing didn't have 7.4)
Wires (Male — Male & Female — Male).
A Battery with 7.4v is enough to power the circuit because Adriano can have 7.4 v of power from Vin input and also it will be enough to power my single motor drive
#define left 6
#define center 7
#define right 8
int var = 0;
int if2 = 0;
//motor one
#define ENA 9
#define IN1 2
#define IN2 3
//motor two
#define ENB 10
#define IN3 4
#define IN4 5
// ultra sonic sesnsor
long readUltrasonicDistance(int triggerPin, int echoPin){
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
return pulseIn(echoPin, HIGH);
}
int Speed = 255; // speed of this bot
void setup() {
pinMode(A0, INPUT_PULLUP);
Serial.begin(9600);
pinMode(left, INPUT);
pinMode(center, INPUT);
pinMode(right, INPUT);
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);
}
void loop() {
bool leftV = digitalRead(left);
bool centerV = digitalRead(center);
bool rightV = digitalRead(right);
if (digitalRead(A0) == LOW){
var = 0.01723*readUltrasonicDistance(11, 12);
Serial.println(var);
if (var >= 20 && var != 0) {
Serial.println(rightV);
if (leftV == 0 && centerV == 1 && rightV == 0) {
carforward();
Serial.println("forward");
} else if (leftV == 0 && centerV == 0 && rightV == 0) {
carStop();
} else if (leftV == 1 && centerV == 1 && rightV == 1) {
carStop();
} else if (leftV == 1 && centerV == 0 && rightV == 0) {
carturnleft();
} else if (leftV == 0 && centerV == 0 && rightV == 1) {
carturnright();
} else if (leftV == 1 && centerV == 1 && rightV == 0) {
carturnleft();
} else if (leftV == 0 && centerV == 1 && rightV == 1) {
carturnright();
}
}else {
carStop();
}
}
}
void carforward() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, LOW) ;
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void carturnleft() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void carturnright() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void carStop() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
1- Getting to know the new TCRT5000 module and how to program it
the code was very easy
TCRT5000 code alone
#define left 6
#define center 7
#define right 8
//motor one
#define ENA 9
#define IN1 2
#define IN2 3
//motor two
#define ENB 10
#define IN3 4
#define IN4 5
int Speed = 120; // speed of this robot
void setup() {
Serial.begin(9600);
pinMode(left, INPUT);
pinMode(center, INPUT);
pinMode(right, INPUT);
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);
}
void loop() {
bool leftV = digitalRead(left);
bool centerV = digitalRead(center);
bool rightV = digitalRead(right);
Serial.println(rightV);
if (leftV == 1 && centerV == 0 && rightV == 1) {
carforward();
Serial.println("forward");
} else if (leftV == 0 && centerV == 0 && rightV == 0) {
carStop();
} else if (leftV == 1 && centerV == 1 && rightV == 1) {
carStop();
} else if (leftV == 0 && centerV == 0 && rightV == 1) {
carturnleft();
} else if (leftV == 1 && centerV == 0 && rightV == 0) {
carturnright();
} else if (leftV == 0 && centerV == 1 && rightV == 1) {
carturnleft();
} else if (leftV == 1 && centerV == 1 && rightV == 0) {
carturnright();
}
}
void carforward() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void carturnleft() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void carturnright() {
analogWrite(ENA, Speed);
analogWrite(ENB, Speed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void carStop() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
2- test the code alone with the new module in serial monitor
3- integrate the new code with old code from week 6 based on IF-condition
int var = 0;
int if2 = 0;
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}
void setup()
{
pinMode(A2, INPUT);
Serial.begin(9600);
pinMode(8, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
}
void loop()
{
if (analogRead(A2) == HIGH) {
var = 0.01723 * readUltrasonicDistance(11, 12);
Serial.println(var);
if (var <= 20) {
digitalWrite(8, LOW);
digitalWrite(10, HIGH);
analogWrite(9, 90);
digitalWrite(A0, LOW);
digitalWrite(A1, LOW);
} else {
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(10, LOW);
analogWrite(9, 90);
digitalWrite(A0, HIGH);
digitalWrite(A1, LOW);
}
} else {
digitalWrite(8, HIGH);
digitalWrite(10, HIGH);
analogWrite(9, 90);
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH);
}
delay(10); // Delay a little bit to improve simulation performance
}
verifying the code
select Arduino from tools and upload the code to it
The integration divided into two part the first one to integrate the non-electrical parts like the catted wood from design
the second part was integrate the electronics parts
After I Tested Every part in the circuit alone first with the Arduino, I begin to add the parts to the body frame of the car
Please check all the videos, they contain explanations
Every member of the group helped me in every step I took in the project
In the design part my instructors Shreef and Esraa help me find idea to install the motor and peering it
Merit also help me a lot with cutting machine
Farida give me silver tape from her components to make the line way of the bot
Mohab help me in integration part
Ghazel help me also a lot of times
Problem: Pieces burn and do not continue cutting
Solution: We install the board on three brackets in the cutter
I want control my rc car by xbox controller by connect it to Arduino using Bluetooth module and also mobile app