กลับไปหน้ารวมไฟล์
line-follower-robot-v4-c84021.md

I present to you the advance of the robot following lines that I have worked lately.

Preview
Big Track

Components:

1 Arduino Nano

1 Arduino Nano Shield 5 CNY70 sensors

2 IR Sensors GP1A01 (Similar FC-03)

1 Driver L298N

2 Motors with gearbox and encoder

2 Batteries 3.7V 4200mAH 18650

1 18650 battery holder

1 5V USB charger

1 1P1T switch

1 Pushbutton

1 2-tier circular acrylic chassis

2 Wheels covered with eva foam

2 Sphere wheels

2 double-sided perforated breadboard

Some LEDs and SMD resistors and various connecting cables

This is one of the first functional tests, in which I included the use of the programming of the PID feedback algorithm in which at the moment I use the constants P and D.

Adjustments regarding speed control through RPM and activate the constant I are pending.

The sensors used five CNY70 and are read analogically. Initially it is necessary to calibrate the sensors for best performance (10 seconds).

CNY70 Datasheet: https://pdf1.alldatasheet.com/datasheet-pdf/view/252297/VISHAY/CNY70.html

Line Follower Robot 5xCNY70 Sensors

The motors are powered by 2x3.7V 4200mAH 18650 batteries in series (7.4V) and for the control part (Arduino Nano) I use a 5V USB portable charger.

I include the physical design made in TinkerCAD

I have made some templates with which depending on the way they are placed, any size of track can be made. I have done 2, but the limit is imatination.



This is a special bonus, where I show the simulation of this same robot on Webot. The code used to control it virtually is based on the Arduino code used in the real robot. In the description of the video you can find access to information regarding the Webots platform, documentation and corresponding code. I hope you like it.



Line Follower Robot V4 on Webots



Real versus Virtual Robot




🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

The Human Following Robot is a fascinating project that demonstrates basic computer vision principles using simple infrared (IR) sensors. It mimics the behavior of a faithful pet, following its "owner" autonomously as long as they stay within sensing range.

![images/projects/expanded/images/projects/expanded/human_following_robot_front_1772704505968.png)

The Sensing Principle

This robot relies on an array of sharp-edged infrared sensors. These sensors emit a beam and detect reflections from objects in front of them.

  1. Left Movement: If only the left sensor detects a reflection, the robot turns its motors to pivot left.
  2. Right Movement: If only the right sensor detects a reflection, it turns right.
  3. Forward: If the center sensor (or all sensors) detects an object at a certain distance, it moves forward to follow it.
  4. Safety Stop: The code ensures the robot stops before it actually hits the person it's following.

Hardware Components

  • Arduino Uno/Nano: Processes the sensor array and translates it into motor movements.
  • IR Obstacle Sensors (x3): Mounted on the front in a staggered pattern (Left, Center, Right).
  • L298N Motor Driver Shield: Controls the high-power DC gear motors.
  • Robot Chassis: 2-wheel or 4-wheel base with a caster for easy turning.
  • Li-ion/Li-po Battery: High-capacity power source to handle both motors and the Arduino.

![images/projects/expanded/images/projects/expanded/ir_sensor_array_detail_1772704523332.png)

Coding the Logic

The heart of the code is a series of if/else statements that compare the current sensor readings. We use conditional logic to decide between moving, turning, or stopping. Smoothing the motor speed using PWM (Pulse Width Modulation) prevents the robot from being too jerky, making the following behavior look much more natural and fluid.

ข้อมูล Frontmatter ดั้งเดิม

title: "Line Follower Robot V4"
description: "I present to you the advance of the robot following lines that I have worked lately"
author: "drakerdg"
category: "Motors & Robotics"
tags:
  - "line follower"
  - "l298n"
  - "cny70"
  - "arduino nano"
  - "18650"
views: 32763
likes: 7
price: 2450
difficulty: "Intermediate"
components:
  - "1x Arduino Nano R3"
  - "1x Dual H-Bridge motor drivers L298"
  - "2x FC-03 optical sensor"
  - "1x Arduino Nano I/O Shield"
  - "1x Multitool, Screwdriver"
  - "4x Resistor 1k ohm"
  - "1x 2WD Robot Chassis"
  - "1x Solder Wire, Lead Free"
  - "2x DC Motor, 12 V"
  - "5x Resistor 221 ohm"
  - "26x Jumper wires (generic)"
  - "1x Battery Holder, 18650 x 2"
  - "1x Tactile Switch, SPST-NO"
  - "6x Resistor 10k ohm"
  - "2x 18650 3.7V 4200mAH"
  - "4x LED (generic)"
  - "1x Soldering iron (generic)"
  - "5x CNY70"
  - "1x Toggle Switch, SPDT"
tools: []
apps: []
downloadableFiles:
  - "https://github.com/DrakerDG/Line-Follower-Robot-V4"
  - "https://github.com/DrakerDG/Line-Follower-Robot-V4"
documentationLinks: []
passwordHash: "ac4b6c93e66793bbc0824d5bc8d3a4373c016f62824b20a2efed9dbedb80c65a"
encryptedPayload: "U2FsdGVkX1/rntxlnDiAeYVEIMkvNgrM2apl8T+PTKgMHPiySu9cPpfh9WM2+bICzkJMU3BXXkt/bsQoGws60m0oeqrwytPdMNcUJ2IeWllxO4UC5sYLiIBnGMm4OryO+L64M8SutMKK1P6uCmTv8uOn1Th2tneT+Aips+uqx3+NeLfkPLODVpwBFWQa9njHTUPOUzkNsk+1bl78snw1KX44DKSP0ZwS9zvCUGJpE7Q="
seoDescription: "Discover the latest updates on the Line Follower Robot V4 project and its advanced robot navigation features."
videoLinks:
  - "https://www.youtube.com/embed/u0xS_Xet50M"
  - "https://www.youtube.com/embed/xTfeYsQx-Oo"
  - "https://www.youtube.com/embed/n3PUQIn_-08"
  - "https://www.youtube.com/embed/PcCipP1IfKc"
  - "https://www.youtube.com/embed/tanIEUHYbxE"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/line-follower-robot-v4-c84021_cover.gif"
lang: "en"