I designed and programmed a Line Follower Robot (LFR), a robotic vehicle capable of following a designated path autonomously. With this, I participated in the World Robotics Championship organised by Technoxian. The competition required intricate engineering, problem-solving, and programming skills. It was not just a test of our technical abilities but also a platform that encouraged creativity and innovation.
Material used:
5 IR Sensors
Arduino UNO
L28n Motor Driver
12 Volt Battery
Switch
Acrylic Chassis
Few Jumper Wires
Source Code:
#define IR_SENSOR_RIGHT 11
#define IR_SENSOR_LEFT 12
#define IR_SENSOR_RIGHT_MIDDLE 2
#define IR_SENSOR_LEFT_MIDDLE 3
#define IR_SENSOR_MIDDLE 4
#define MOTOR_SPEED 100
//Right motor
int enableRightMotor=6;
int rightMotorPin1=7;
int rightMotorPin2=8;
//Left motor
int enableLeftMotor=5;
int leftMotorPin1=9;
int leftMotorPin2=10;
void setup()
{
//The problem with TT gear motors is that, at very low pwm value it does not even rotate.
//If we increase the PWM value then it rotates faster and our robot is not controlled in that speed and goes out of line.
//For that we need to increase the frequency of analogWrite.
//Below line is important to change the frequency of PWM signal on pin D5 and D6
//Because of this, motor runs in controlled manner (lower speed) at high PWM value.
//This sets frequecny as 7812.5 hz.
TCCR0B = TCCR0B & B11111000 | B00000010 ;
// put your setup code here, to run once:
pinMode(enableRightMotor, OUTPUT);
pinMode(rightMotorPin1, OUTPUT);
pinMode(rightMotorPin2, OUTPUT);
pinMode(enableLeftMotor, OUTPUT);
pinMode(leftMotorPin1, OUTPUT);
pinMode(leftMotorPin2, OUTPUT);
pinMode(IR_SENSOR_RIGHT, INPUT);
pinMode(IR_SENSOR_LEFT, INPUT);
pinMode(IR_SENSOR_RIGHT_MIDDLE, INPUT);
pinMode(IR_SENSOR_LEFT_MIDDLE, INPUT);
pinMode(IR_SENSOR_MIDDLE, INPUT);
rotateMotor(0,0);
}
void loop()
{
int rightIRSensorValue = digitalRead(IR_SENSOR_RIGHT);
int leftIRSensorValue = digitalRead(IR_SENSOR_LEFT);
int middlerightIRSensorValue = digitalRead(IR_SENSOR_RIGHT_MIDDLE);
int middleleftIRSensorValue = digitalRead(IR_SENSOR_LEFT_MIDDLE);
int middleIRSensorValue = digitalRead(IR_SENSOR_MIDDLE);
//If none of the sensors detects black line, then go straight
if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == HIGH && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW)
{
rotateMotor(MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == HIGH && middleleftIRSensorValue == HIGH && middleIRSensorValue == HIGH && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED,-MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == HIGH && middlerightIRSensorValue == HIGH && rightIRSensorValue == HIGH )
{
rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == HIGH && middleIRSensorValue == LOW && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED,-MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == LOW && middlerightIRSensorValue == HIGH && rightIRSensorValue == LOW )
{
rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == HIGH && middleleftIRSensorValue == HIGH && middleIRSensorValue == LOW && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED, -MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == LOW && middlerightIRSensorValue == HIGH && rightIRSensorValue == HIGH )
{
rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == LOW && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == HIGH && middleleftIRSensorValue == HIGH && middleIRSensorValue == HIGH && middlerightIRSensorValue == HIGH && rightIRSensorValue == HIGH )
{
rotateMotor(MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == HIGH && middleIRSensorValue == HIGH && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED, -MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == HIGH && middlerightIRSensorValue == HIGH && rightIRSensorValue == LOW )
{
rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);
}
//sesor 5 right motor reverse
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == LOW && middleIRSensorValue == LOW && middlerightIRSensorValue == LOW && rightIRSensorValue == HIGH )
{
rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == HIGH && middleleftIRSensorValue == LOW && middleIRSensorValue == LOW && middlerightIRSensorValue == LOW && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED, -MOTOR_SPEED);
}
else if (leftIRSensorValue == HIGH && middleleftIRSensorValue == LOW && middleIRSensorValue == LOW && middlerightIRSensorValue == LOW && rightIRSensorValue == HIGH )
{
rotateMotor(MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == HIGH && middleleftIRSensorValue == HIGH && middleIRSensorValue == LOW && middlerightIRSensorValue == HIGH && rightIRSensorValue == HIGH )
{
rotateMotor(MOTOR_SPEED, MOTOR_SPEED);
}
else if (leftIRSensorValue == LOW && middleleftIRSensorValue == HIGH && middleIRSensorValue == LOW && middlerightIRSensorValue == HIGH && rightIRSensorValue == LOW )
{
rotateMotor(MOTOR_SPEED, MOTOR_SPEED);
}
//If both the sensors detect black line, then stop
else
{
// Move left for 1 second
rotateMotor(-MOTOR_SPEED, MOTOR_SPEED);
delay(1000); // 1 second delay
// Move right for 1 second
rotateMotor(MOTOR_SPEED, -MOTOR_SPEED);
delay(1000); // 1 second delay
}
}
void rotateMotor(int rightMotorSpeed, int leftMotorSpeed)
{
if (rightMotorSpeed < 0)
{
digitalWrite(rightMotorPin1,LOW);
digitalWrite(rightMotorPin2,HIGH);
}
else if (rightMotorSpeed > 0)
{
digitalWrite(rightMotorPin1,HIGH);
digitalWrite(rightMotorPin2,LOW);
}
else
{
digitalWrite(rightMotorPin1,LOW);
digitalWrite(rightMotorPin2,LOW);
}
if (leftMotorSpeed < 0)
{
digitalWrite(leftMotorPin1,LOW);
digitalWrite(leftMotorPin2,HIGH);
}
else if (leftMotorSpeed > 0)
{
digitalWrite(leftMotorPin1,HIGH);
digitalWrite(leftMotorPin2,LOW);
}
else
{
digitalWrite(leftMotorPin1,LOW);
digitalWrite(leftMotorPin2,LOW);
}
analogWrite(enableRightMotor, abs(rightMotorSpeed));
analogWrite(enableLeftMotor, abs(leftMotorSpeed));
105 thoughts on “Line Follower Robot”
it’s good
I really liked your site. Do you mind https://zetds.seychellesyoga.com/info
Here’s what I can offer for the near future https://zetds.seychellesyoga.com/info
You will definitely like it https://zetds.seychellesyoga.com/info
Content for your website https://ztd.bardou.online/adm
Web Development Wizards https://ztd.bardou.online/adm
Can provide a link mass to your website https://ztd.bardou.online/adm
Your site’s position in the search results https://ztd.bardou.online/adm
Free analysis of your website https://ztd.bardou.online/adm
SEO Optimizers Team https://ztd.bardou.online/adm
I offer mutually beneficial cooperation https://ztd.bardou.online/adm
Cool website. There is a suggestion https://ztd.bardou.online/adm
I really liked your site. Do you mind https://ztd.bardou.online/adm
Here’s what I can offer for the near future https://ztd.bardou.online/adm
Content for your website https://ztd.bardou.online/adm
Web Development Wizards https://ztd.bardou.online/adm
Can provide a link mass to your website https://ztd.bardou.online/adm
Your site’s position in the search results https://ztd.bardou.online/adm
Free analysis of your website https://ztd.bardou.online/adm
SEO Optimizers Team https://ztd.bardou.online/adm
I offer mutually beneficial cooperation https://ztd.bardou.online/adm
Cool website. There is a suggestion https://ztd.bardou.online/adm
Content for your website http://myngirls.online/
Web Development Wizards http://myngirls.online/
Can provide a link mass to your website http://myngirls.online/
Your site’s position in the search results http://myngirls.online/
Free analysis of your website http://myngirls.online/
SEO Optimizers Team http://myngirls.online/
I offer mutually beneficial cooperation http://myngirls.online/
Content for your website http://fertus.shop/info/
Web Development Wizards http://fertus.shop/info/
Can provide a link mass to your website http://fertus.shop/info/
Your site’s position in the search results http://fertus.shop/info/
Free analysis of your website http://fertus.shop/info/
SEO Optimizers Team http://fertus.shop/info/
Outstanding feature
I offer mutually beneficial cooperation http://fertus.shop/info/
Cool website. There is a suggestion http://fertus.shop/info/
I really liked your site. Do you mind http://fertus.shop/info/
Here’s what I can offer for the near future http://fertus.shop/info/
You will definitely like it http://fertus.shop/info/
The best prices from the best providers http://fertus.shop/info/
Additional earnings on your website http://fertus.shop/info/
Analytics of your website http://fertus.shop/info/
I would like to post an article http://fertus.shop/info/
How to contact the administrator on this issue http://fertus.shop/info/
The offer is still valid. Details http://fertus.shop/info/
We offer cooperation on SEO optimization http://fertus.shop/info/
Content for your website http://fertus.shop/info/
Web Development Wizards http://fertus.shop/info/
Can provide a link mass to your website http://fertus.shop/info/
Web Development Wizards http://fertus.shop/info/
Your site’s position in the search results http://fertus.shop/info/
I offer mutually beneficial cooperation http://fertus.shop/info/
Качественно перетянем мебель в Минске – долгое время сохранится ее вид
обивка мебели в минске https://obivka-divana.ru/ .
?Gana dinero sin invertir! Bono casino sin deposito
casino online bono por registro sin deposito bono de casino sin deposito .
Какие проблемы могут возникнуть при использовании рулонного газона
рулонный газон купить цена https://rulonnyygazon177.ru/ .
Семейное гнездышко в окружении природы
18. Современный дом из бруса 9х12: дизайнерские решения
проект дома из бруса 9х12 https://domizbrusa9x12spb.ru/ .
?Gana grandes premios en los casinos en linea en Peru!
mejor casino online peru mejor casino online peru .
Как составить рейтинг букмекеров
лучшие букмекерские конторы в беларуси букмекерская контора бетвиннер .
prednisone price in india
prinivil drug
Play and Earn Real Money Online in Kenya
best online casino games kenya casino games online for real money .
Легендарные казино Монако
казино олимп
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Создайте свою удачу вместе с онлайн казино Беларусь и выигрывайте с каждым спином
онлайн казино Беларусь лучшие онлайн казино в Беларуси .
prednisone acetate
83. Клининговая компания в Челябинске предоставляет услуги по уборке квартир перед продажей или сдачей в аренду, включая глубокую мойку полов, стен, окон, мебели, уборку кухни, санузла, устранение неприятных запахов и другие работы для повышения привлекательности объекта.
Клининговая компания Челябинск .
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
zestril pill
Приобрести диплом без лишних хлопот, онлайн.
Как купить диплом без риска, узнайте сейчас.
Заказать официальный документ о образовании, важная информация.
Почему выгодно купить диплом, рассказываем.
Где купить диплом без проблем, на проверенных ресурсах.
Купить диплом по выгодной цене, интересные варианты.
Дипломы на заказ по лучшим ценам, подробности на сайте.
Скрытая покупка дипломов, проверенные решения.
Как быстро купить диплом, подробности на сайте.
Купить диплом срочно и законно, лучшие условия.
Как выбрать диплом, лучшие цены.
Как купить диплом срочно, без рисков.
Почему стоит заказать диплом, подробности у нас.
Как выбрать и купить диплом, лучшие предложения.
Легальная покупка дипломов безопасно, безопасность на первом месте.
Купить дипломы легко, интересные варианты.
Официальная покупка диплома, подробности здесь.
Официальный документ об образовании, подробности у нас.
купить диплом https://www.7arusak-diploms.com/ .
Приобрести диплом без лишних хлопот, онлайн.
Как купить диплом без риска, без заморочек.
Какой диплом купить, проверенные варианты.
Преимущества покупки диплома, все секреты.
Где купить диплом без проблем, без риска.
Как выбрать диплом для покупки, секреты выбора.
Дипломы на заказ по лучшим ценам, лучшие условия.
Скрытая покупка дипломов, проверенные решения.
Лучшие дипломы для покупки, только актуальная информация.
Как купить диплом онлайн, подробности у нас.
Официальные документы для покупки, лучшие цены.
Легальная покупка дипломов, лучшие условия.
Почему стоит заказать диплом, подробности у нас.
Дипломы на всех условиях, лучшие предложения.
Купить диплом без риска, подробности у нас.
Купить дипломы легко, интересные варианты.
Заказать диплом онлайн без проблем, лучшие условия.
Официальный документ об образовании, гарантированный результат.
купить диплом https://www.7arusak-diploms.com .
flomax 0.8
Секреты оформления пропуска на МКАД, советы, рекомендации, Какие документы нужны для оформления пропуска на МКАД, 10 вопросов о пропуске на МКАД, Пропуск на МКАД: сроки и стоимость, основные моменты, Пропуск на МКАД: основные преимущества, Сроки и порядок продления пропуска на МКАД, подробная информация
Проверить пропуск на мкад Проверить пропуск на мкад .
child porn
synthroid 137 mcg tab
Whats up this is kind of of off topic but I
was wanting to know if blogs use WYSIWYG editors or if
you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get advice from
someone with experience. Any help would be enormously appreciated!
Outstanding feature
Excellent write-up
xnxx
порно
xnxx
metformin hydrochloride 500 mg
cost of flomax
can you buy zovirax tablets over the counter in australia
valtrex on line
lyrica 250 mg
buy tretinoin without prescription
Great article! I found your perspective on this topic both enlightening and thought-provoking. The way you break down complex ideas into understandable insights is truly commendable. It’s interesting to see how these developments could shape our future. I’m particularly intrigued by your point about potential challenges and would love to dive deeper into that.
For those who are interested in exploring this topic further, I recommend checking out this resource for more detailed information: comprehensive guide. It offers additional insights that complement what’s discussed here.
Looking forward to hearing others’ thoughts and continuing this discussion. Thanks for sharing such valuable information!
cipro discount
Great article! I appreciate the clear and insightful perspective you’ve shared. It’s fascinating to see how this topic is developing. For those interested in diving deeper, I found an excellent resource that expands on these ideas: check it out here. Looking forward to hearing others’ thoughts and continuing the discussion!
strattera 100 mg
buy modafinil 200 mg
cheap tretinoin cream 0.25
combivent inhaler generic
buy lyrica online europe
bactrim forte
This was both informative and hilarious! For further reading, check out: LEARN MORE. What do others think?
can i buy azithromycin over the counter in canada
flomax 0.4 mg capsules
propecia cost nz
tretinoin cream price in canada
baclofen price 10mg in usa
can you buy zithromax over the counter in canada
advair disc