กลับไปหน้ารวมไฟล์
line-follower-using-arduino-easy-diy-project-25ee31.md

ชื่อโปรเจกต์: หุ่นยนต์เดินตามเส้นด้วย Arduino | โปรเจกต์ DIY ทำง่าย

เชื่อมต่อสายไฟเข้ากับมอเตอร์ จากนั้นยึดมอเตอร์เข้ากับโครงสร้าง (chassis) โดยใช้ Zip ties ติดตั้งล้อเข้ากับมอเตอร์

ตอนนี้โครงสร้างหลักเสร็จสมบูรณ์แล้ว

ในที่นี้เราใช้โมดูล L298N motor driver ซึ่งเป็น dual H-Bridge driver สามารถขับเคลื่อนมอเตอร์ได้ 2 ตัวแบบสองทิศทาง (bi-directionally) หรือ 4 ตัวแบบทิศทางเดียว (uni-directionally)

เชื่อมต่อมอเตอร์เข้ากับ driver

เชื่อมต่อแหล่งจ่ายไฟเข้ากับขาจ่ายไฟ (power pins) ของ driver

โมดูล IR sensor มีตัวส่ง (emitter) และตัวรับ (receiver) แสง IR จะถูกดูดซับโดยพื้นผิวสีดำและสะท้อนโดยพื้นผิวสีขาว สิ่งนี้ช่วยให้เราเดินตามเส้นสีดำได้

เชื่อมต่อสาย jumper 3 เส้นเข้ากับ IR sensors

หนึ่งเส้นสำหรับข้อมูล (data) และอีกสองเส้นสำหรับไฟเลี้ยง (power)

เชื่อมต่อขาอินพุต (input pins) ของ motor driver เข้ากับ digital pins ของ Arduino กำหนดค่าผ่านโค้ด และทำเช่นเดียวกันกับ IR sensors

ลิงก์ไปยังโค้ด: https://github.com/sairushan/Line-follower

อัปโหลดโค้ดแล้วสนุกได้เลย!

รายละเอียดทางเทคนิคเพิ่มเติม

การนำทางเชิงแสงที่แม่นยำ

โปรเจกต์นี้สร้างยานพาหนะอัตโนมัติที่ตอบสนองได้ ซึ่งเดินตามเส้นสีดำบนพื้นผิวสีขาวโดยใช้หลักการสะท้อนแสงที่แตกต่างกัน

  • IR Reflectance Matrix: ใช้ IR sensors รุ่น TCRT5000 สองตัว Arduino จะตรวจสอบสถานะดิจิทัลของเซ็นเซอร์แต่ละตัว สัญญาณ HIGH บ่งชี้การสะท้อน (พื้นผิวสีขาว) ในขณะที่ LOW บ่งชี้การดูดซับ (เส้นสีดำ)
  • Proportional Correction Logic: แทนที่จะเป็นการเปิด/ปิดแบบง่ายๆ Arduino ใช้ P-Controller พื้นฐานเพื่อปรับความเร็ว PWM ของมอเตอร์แต่ละตัว หากเซ็นเซอร์ด้านซ้ายตรวจจับเส้นได้ มอเตอร์ด้านขวาจะช้าลงเพื่อดึงหุ่นยนต์กลับเข้าสู่เส้นทาง

ศูนย์กลางฮาร์ดแวร์

  • L298N Power Drive: จัดการมอเตอร์เกียร์ 6V สองตัวโดยใช้ H-bridge ซึ่งช่วยให้สามารถควบคุมการเคลื่อนที่ที่ใช้กระแสสูงได้ในขณะที่ป้องกัน digital pins ของ Arduino

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

title: "Line Follower Using Arduino | Easy DIY Project"
description: "In this tutorial, we will be making a line follower using Arduino and L298N motor driver."
author: "sairushan"
category: ""
tags:
  - "line follower"
  - "l298n"
  - "diy projects"
  - "college projects"
  - "school projects"
  - "robots"
views: 3175
likes: 0
price: 1120
difficulty: "Easy"
components:
  - "1x SparkFun RedBot Sensor - Line Follower"
  - "1x Jumper wires (generic)"
  - "1x Solderless Breadboard Half Size"
  - "1x Arduino UNO"
  - "1x Dual H-Bridge motor drivers L298"
  - "1x DC Motor, 12 V"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles:
  - "https://github.com/sairushan/Line-follower"
documentationLinks: []
passwordHash: "c49778a43494ae57892fa0dad03b114546478f6dc1780efdd722335eee6bbe69"
encryptedPayload: "U2FsdGVkX1+ztGbO7BlbzJUkII8eoAeBDuYeV15W4UGQiGDsbUGo3fts3iuYfPLCEGm8iyWgvW1u6DsNKua8+8ttvhMF2UW4mxx0Z0EZaeU="
seoDescription: "Build a Line Follower using Arduino and L298N motor driver. Easy DIY tutorial for beginners to learn robotics and programming."
videoLinks:
  - "https://www.youtube.com/embed/_yT3qUGiSOk"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/line-follower-using-arduino-easy-diy-project-25ee31_cover.jpg"
lang: "th"