|
Pure
Software code |
| |
Lebanon
| |
|
|
|
|
Home :
Chapter 4: 4WD Robot Car, Line Follower
|
| | |
|
Multi-Functional 4
Wheel Drive Robot Car |
|
|
|
|
The Chapters :
1
2
3
4 5 6 |
|
Chapter 4: 4WD Robot Car,
Line Follower. |
|
|
|
|
|
|
|
1-
Line following robot, Project description |
|
The concept of the line follower robot is
related to light. Here, we use the behavior of
light on the black-and-white surface. The
white color reflects all the light that
falls on it, whereas the black color absorbs the
light.
In this line-follower robot, we use IR
transmitters and receivers (photodiodes). They are
used to send and receive the lights. When IR
rays fall on a white surface, they are
reflected toward the IR receiver, generating
some voltage changes.
Black surfaces absorb infrared
radiation and do not reflect any of the rays
that fall on them; therefore, no photons
reach the infrared receiver.
In this
project, when the IR sensor senses a white
surface, an Arduino gets 1 (high) as input, and when it
senses a black line, an Arduino gets 0 (low) as
input. Based on these inputs, an Arduino Uno
provides the proper output to control the motors to move as
it is. |
|
|
|
|
|
|
2-
Components Used in Line Follower Robot |
|
|
Types |
Qty |
2.1 |
Arduino Uno R3 |
1pcs |
2.2 |
V5.0 Expansion board |
1pcs |
2.3 |
L293D motor driver board |
1pcs |
2.4 |
IR sensors (Line tracking module) |
3pcs |
2.5 |
BO motor |
4pcs |
2.6 |
Wheel |
4pcs |
2.7 |
Battery Case + Lithium-ion battery |
1pcs + 2pcs |
2.8 |
Acrylic plates |
2pcs |
2.9 |
USB cable |
1pcs |
2.10 |
Aluminium Block |
4pcs |
2.11 |
F-F dupont wire |
|
2.12 |
Black tape |
1pcs | |
|
|
|
|
|
3-
Video,
Line Following Of the Multi-Functional 4 Wheel Drive Robot
Car |
|
|
3.1- Watch Video on Youtube,
Arduino Smart Car,
Line Tracking Robot
- Part 3 |
|
السيارة الذكية -
روبوت تتبع الخط، الدرس 32 - الجزء
3 - للمهندس
حمزة عمار |
|
|
|
|
|
|
|
4- IR sensors (Line tracking module) |
مستشعرات الخط الاسود |
|
|
|
|
Line
Tracking module is an infrared sensor
that detects whether the surface in front of it
is reflective or opaque. Sensitivity to ambient
light can be adjusted using the knob to achieve
a fairly accurate reading. |
|
|
|
|
|
5-
Line Following Project 1, Line Tracking of the 4 WD
Robot Car |
|
|
|
5.1- Schemas of Movements ... |
|
|
|
|
|
|
5.2- Connections |
|
|
5.3- the Code of the
Current Application, using the Mixly Software |
Current Mixly application - (5.08 KB zip
file)
download |
|
|
5.3.1- Picture, the Mixly
Blocks(block programming) of the Current Application |
|
|
5.3.2- Picture, the Mixly
Code of the Current Application, Equivalent to C / C++ |
|
|
5.3.3- the Code of
the Current Application -
C / C++ |
volatile int IN1;
volatile int IN2;
volatile int IN3;
volatile int IN4;
volatile int rightS;
volatile int centerS;
volatile int leftS;
void forward(int speed) {
left_side_forward(speed);
right_side_forward(speed);
}
void left1(int speed) {
left_side_forward(speed / 2);
right_side_forward(speed);
}
void left2(int speed) {
left_side_backward(speed);
right_side_forward(speed);
}
void left_side_backward(int speed) {
// Left
analogWrite(IN1,0);
analogWrite(IN2,(speed * 0.90));
}
void left_side_forward(int speed) {
// Left
analogWrite(IN1,(speed * 0.90));
analogWrite(IN2,0);
}
int mixly_digitalRead(uint8_t pin) {
pinMode(pin, INPUT);
return digitalRead(pin);
}void right1(int speed) {
left_side_forward(speed);
right_side_forward(speed / 2);
}
void right2(int speed) {
left_side_forward(speed);
right_side_backward(speed);
}
void right_side_backward(int speed) {
// Right
analogWrite(IN3,0);
analogWrite(IN4,speed);
}
void right_side_forward(int speed) {
// Right
analogWrite(IN3,speed);
analogWrite(IN4,0);
}
void stop() {
left_side_forward(0);
right_side_forward(0);
}
void setup(){
IN1 = 11;
IN2 = 6;
IN3 = 5;
IN4 = 3;
rightS = 8;
centerS = 9;
leftS = 10;
}
void loop(){
if (mixly_digitalRead(leftS) == 1 && (mixly_digitalRead(centerS)
== 1 && mixly_digitalRead(rightS) == 1)) {
forward(120);
}
if (mixly_digitalRead(leftS) == 1 && (mixly_digitalRead(centerS)
== 1 && mixly_digitalRead(rightS) == 0)) {
left1(150);
}
if (mixly_digitalRead(leftS) == 1 && (mixly_digitalRead(centerS)
== 0 && mixly_digitalRead(rightS) == 0)) {
left2(150);
}
if (mixly_digitalRead(leftS) == 0 && (mixly_digitalRead(centerS)
== 1 && mixly_digitalRead(rightS) == 1)) {
right1(150);
}
if (mixly_digitalRead(leftS) == 0 && (mixly_digitalRead(centerS)
== 0 && mixly_digitalRead(rightS) == 1)) {
right2(150);
}
if (mixly_digitalRead(leftS) == 0 && (mixly_digitalRead(centerS)
== 0 && mixly_digitalRead(rightS) == 0)) {
stop();
}
} |
|
|
5.3.4- Test the Current
Application |
1-
Connect the Arduino UNO board of the 4WD robot car to
computer’s USB port with USB cable to upload the code
2- if the Code upload success, Turn the Power Slide
switch ON |
|
|
|
|
|
|
|
6-
Line Following Project 2, Line Tracking
with Ultrasonic of the 4 WD
Robot Car |
|
|
|
6.1- Schemas of Movements ... |
|
|
|
|
|
|
6.2- Connections |
|
|
6.3- the Code of the
Current Application, using the Mixly Software |
Current Mixly application - (5.37 KB zip
file)
download |
|
|
6.3.1- Picture, the Mixly
Blocks(block programming) of the Current Application |
|
|
6.3.2- Picture, the Mixly
Code of the Current Application, Equivalent to C / C++ |
|
|
6.3.3- the Code of the
Current Application -
C / C++ |
volatile int IN1;
volatile int IN2;
volatile int IN3;
volatile int IN4;
volatile int rightS;
volatile int centerS;
volatile int leftS;
float checkdistance_A1_A2() {
digitalWrite(A1, LOW);
delayMicroseconds(2);
digitalWrite(A1, HIGH);
delayMicroseconds(10);
digitalWrite(A1, LOW);
float distance = pulseIn(A2, HIGH) / 58.00;
delay(10);
return distance;
}
void forward(int speed) {
left_side_forward(speed);
right_side_forward(speed);
}
void left1(int speed) {
left_side_forward(speed / 2);
right_side_forward(speed);
}
void left2(int speed) {
left_side_backward(speed);
right_side_forward(speed);
}
void left_side_backward(int speed) {
// Left
analogWrite(IN1,0);
analogWrite(IN2,(speed * 0.90));
}
void left_side_forward(int speed) {
// Left
analogWrite(IN1,(speed * 0.90));
analogWrite(IN2,0);
}
int mixly_digitalRead(uint8_t pin) {
pinMode(pin, INPUT);
return digitalRead(pin);
}void right1(int speed) {
left_side_forward(speed);
right_side_forward(speed / 2);
}
void right2(int speed) {
left_side_forward(speed);
right_side_backward(speed);
}
void right_side_backward(int speed) {
// Right
analogWrite(IN3,0);
analogWrite(IN4,speed);
}
void right_side_forward(int speed) {
// Right
analogWrite(IN3,speed);
analogWrite(IN4,0);
}
void stop() {
left_side_forward(0);
right_side_forward(0);
}
void setup(){
IN1 = 11;
IN2 = 6;
IN3 = 5;
IN4 = 3;
rightS = 8;
centerS = 9;
leftS = 10;
pinMode(A1, OUTPUT);
pinMode(A2, INPUT);
}
void loop(){
while (checkdistance_A1_A2() > 20) {
if (mixly_digitalRead(leftS) == 1 && (mixly_digitalRead(centerS)
== 1 && mixly_digitalRead(rightS) == 1)) {
forward(120);
}
if (mixly_digitalRead(leftS) == 1 && (mixly_digitalRead(centerS)
== 1 && mixly_digitalRead(rightS) == 0)) {
left1(150);
}
if (mixly_digitalRead(leftS) == 1 && (mixly_digitalRead(centerS)
== 0 && mixly_digitalRead(rightS) == 0)) {
left2(150);
}
if (mixly_digitalRead(leftS) == 0 && (mixly_digitalRead(centerS)
== 1 && mixly_digitalRead(rightS) == 1)) {
right1(150);
}
if (mixly_digitalRead(leftS) == 0 && (mixly_digitalRead(centerS)
== 0 && mixly_digitalRead(rightS) == 1)) {
right2(150);
}
if (mixly_digitalRead(leftS) == 0 && (mixly_digitalRead(centerS)
== 0 && mixly_digitalRead(rightS) == 0)) {
stop();
}
}
stop();
}
} |
|
|
6.3.4- Test the Current
Application |
1-
Connect the Arduino UNO board of the 4WD robot car to
computer’s USB port with USB cable to upload the code
2- if the Code upload success, Turn the Power Slide
switch ON |
|
|
|
|
|
|
|
|
The Chapters :
1
2
3
4 5 6 |
|
www.puresoftwarecode.com
: |
CHRISTIANITY
Institute |
HUMANITIES
Institute |
ART Institute &
Others |
SOFTWARE Institute - "All Courses Free" |
|
History of the MARONITES in
Arabic |
Basilica Architecture, in the Shape
of a Cross |
Python, Teach yourSelf Programs in 6
pages |
Holy BIBLE in 22 Languages and Studies
... |
Le HANDICAP c'est quoi ? (in
French) |
|
VISUAL STUDIO 2019, C# Programs, in
English |
220 Holy Christian
ICONS |
Drugs and Treatment in English, french,
Arabic |
Old Traditional Lebanese
houses |
VISUAL STUDIO 2010 in
English |
Catholic Syrian MARONITE
Church |
Classification of Wastes from the Source
in Arabic |
5 DRAWING Courses & 3
Galleries |
VISUAL STUDIO .NET, Windows & ASP in
En |
HOLY MASS of Maronite Church - Audio
in Arabic |
Christianity in the Arabian Peninsula in
Arabic |
Meteora,
Christianity Monasteries - En, Ar,
Fr |
VISUAL STUDIO 6.0 in
English |
VIRGIN MARY, Mother of JESUS CHRIST
GOD |
Summary of the Lebanese history in
Arabic |
Monasteries of Mount Athos &
Pilgrimage |
Microsoft ACCESS in
English |
SAINTS of the Church |
LEBANON EVENTS 1840 & 1860, in
Arabic |
Carved Rock Churches, Lalibela -
Ethiopia |
PHP & MySQL in
English |
Saint SHARBEL - Sharbelogy in 10
languages, Books |
Great FAMINE in LEBANON 1916, in
Arabic |
4 Different
STUDIES |
SOFTWARE GAMES in
English |
Catholic RADIO in Arabic, Sawt el
Rab |
Great FAMINE and Germny Role 1916,
in Arabic |
SOLAR Energy & Gas
Studies |
WEB DESIGN in English |
Saint SHARBEL Family -
Evangelization |
Armenian Genocide 1915 in
Arabic |
Personal Protective
Equipment |
JAVA SCRIPT in
English |
Читать -
БИБЛИЯ и Шарбэль cвятой, in Russe |
Sayfo or Assyrian Genocide 1915 in
Arabic |
WELCOME to LEBANON |
FLASH - ANIMATION in
English |
Apparitions of Virgin Mary -
Ar |
Christianity in Turkey in
Arabic |
YAHCHOUCH, my Lebanese
Village |
PLAY, 5 GAMES |
Neocatechumenal Way |
Prononce English and French and Arabic
Letters |
ZOUEIN, my Family - History &
Trees |
Multi-Functional 4 Wheel Drive
Robot Car
New |
Holy BIBLE, for the Maronite Liturgical
Year |
Andree Zouein
Foundation |
|
HERMEZ Steel, Steel Decor
Artwork |
Holy BIBLE, according to Maronite
Calendar, (2023) |
GIGI L'AMOROSO Fashion and
Jewellery |
my PRODUCTS, and Statistiques
... |
SAADEH BEJJANE
Architecture |
Holy BIBLE, Online Translation in
133 Languages |
Josette Zoueïn. Psychanalyste
Psychologue |
REPORT, Cyber Attack Attacks the Current
Site |
CARLOS SLIM HELU Site. new
design |
|
|
|
| |
|
|
|
|