{"id":523,"date":"2026-06-11T12:50:58","date_gmt":"2026-06-11T04:50:58","guid":{"rendered":"https:\/\/projectleon.net\/make\/blog\/agv-lidar-obstacle-avoidance-tfmini-arduino-farsi\/"},"modified":"2026-06-11T12:50:58","modified_gmt":"2026-06-11T04:50:58","slug":"agv-lidar-obstacle-avoidance-tfmini-arduino-farsi","status":"publish","type":"post","link":"https:\/\/projectleon.net\/make\/blog\/agv-lidar-obstacle-avoidance-tfmini-arduino-farsi\/","title":{"rendered":"\u0633\u0627\u062e\u062a \u0633\u06cc\u0633\u062a\u0645 \u0636\u062f-\u062a\u0635\u0627\u062f\u0641 LiDAR \u0628\u0631\u0627\u06cc AGV: TF-Mini Plus \u0648 \u0622\u0631\u062f\u0648\u06cc\u0646\u0648 (\u0641\u0627\u0631\u0633\u06cc)"},"content":{"rendered":"<div class='hero-image-container' style='margin-bottom:28px;border-radius:14px;overflow:hidden;box-shadow:0 4px 18px rgba(0,0,0,0.08)'>\n<img src='https:\/\/projectleon.net\/make\/wp-content\/uploads\/2026\/06\/post72-lidar-agv.jpg' alt='LiDAR TF-Mini AGV \u0636\u062f \u062a\u0635\u0627\u062f\u0641' style='width:100%;height:auto;display:block' loading='eager'\/>\n<\/div>\n<div class='beginner-intro' style='background:#f0f7ff;border-right:4px solid #2e5fb6;padding:16px 20px;border-radius:10px;margin-bottom:22px'>\n<h2 style='margin-top:0'>LiDAR \u0628\u0631\u0627\u06cc AGV \u0686\u06cc\u0633\u062a\u061f (\u0645\u0628\u062a\u062f\u06cc)<\/h2>\n<p><strong>LiDAR<\/strong> (Light Detection and Ranging) \u06cc\u06a9 \u0633\u0646\u0633\u0648\u0631 \u0641\u0627\u0635\u0644\u0647\u200c\u0633\u0646\u062c \u0644\u06cc\u0632\u0631\u06cc \u0627\u0633\u062a. <strong>TF-Mini Plus<\/strong> \u06cc\u06a9 LiDAR \u0641\u0634\u0631\u062f\u0647 \u0648 \u0627\u0631\u0632\u0627\u0646 \u0627\u0633\u062a (\u0642\u06cc\u0645\u062a \u06f2\u06f5-\u06f4\u06f0 \u062f\u0644\u0627\u0631) \u06a9\u0647 \u0641\u0627\u0635\u0644\u0647 \u0627\u0634\u06cc\u0627\u0621 \u0631\u0627 \u062a\u0627 \u06f1\u06f2 \u0645\u062a\u0631 \u0628\u0627 \u062f\u0642\u062a \u00b1\u06f1cm \u0627\u0646\u062f\u0627\u0632\u0647 \u0645\u06cc\u200c\u06af\u06cc\u0631\u062f. \u0627\u06cc\u0646 \u0628\u0631\u0627\u06cc \u0631\u0628\u0627\u062a\u200c\u0647\u0627\u06cc AGV \u06a9\u0647 \u0628\u0627\u06cc\u062f \u0627\u0632 \u062a\u0635\u0627\u062f\u0641 \u0628\u0627 \u062f\u06cc\u0648\u0627\u0631 \u06cc\u0627 \u0627\u0646\u0633\u0627\u0646 \u062c\u0644\u0648\u06af\u06cc\u0631\u06cc \u06a9\u0646\u0646\u062f \u0628\u0633\u06cc\u0627\u0631 \u0645\u0646\u0627\u0633\u0628 \u0627\u0633\u062a.<\/p>\n<p>TF-Mini \u0627\u0632 \u067e\u0631\u0648\u062a\u06a9\u0644 <strong>UART<\/strong> \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc\u200c\u06a9\u0646\u062f \u2014 \u06cc\u0639\u0646\u06cc \u0645\u062b\u0644 \u06cc\u06a9 Serial Port \u0628\u0627 \u0622\u0631\u062f\u0648\u06cc\u0646\u0648 \u0635\u062d\u0628\u062a \u0645\u06cc\u200c\u06a9\u0646\u062f \u0648 \u0647\u0631 \u06f1\u06f0\u06f0ms \u06cc\u06a9 \u0645\u0642\u062f\u0627\u0631 \u0641\u0627\u0635\u0644\u0647 \u0627\u0631\u0633\u0627\u0644 \u0645\u06cc\u200c\u06a9\u0646\u062f. \u0633\u06cc\u0633\u062a\u0645 \u0645\u0627 \u0633\u0647 \u0646\u0627\u062d\u06cc\u0647 \u062a\u0639\u0631\u06cc\u0641 \u0645\u06cc\u200c\u06a9\u0646\u062f: <strong>STOP<\/strong> (\u0632\u06cc\u0631 \u06f3\u06f0cm)\u060c <strong>SLOW<\/strong> (\u06f3\u06f0-\u06f1\u06f0\u06f0cm)\u060c \u0648 <strong>GO<\/strong> (\u0628\u0627\u0644\u0627\u06cc \u06f1\u06f0\u06f0cm).<\/p>\n<\/div>\n<div style='border:1px solid #d8d8d8;padding:18px 20px;border-radius:12px;background:#fafafa;margin-bottom:22px'>\n<h2 style='margin-top:0'>\u0645\u062d\u0635\u0648\u0644\u06cc \u06a9\u0647 \u0645\u06cc\u200c\u0633\u0627\u0632\u06cc\u062f<\/h2>\n<p>\u0633\u06cc\u0633\u062a\u0645 \u0636\u062f-\u062a\u0635\u0627\u062f\u0641 \u0628\u0627 LiDAR \u0628\u0631\u0627\u06cc AGV \u06a9\u0647 \u062f\u0631 \u06f3 \u0646\u0627\u062d\u06cc\u0647 \u0645\u062e\u062a\u0644\u0641 \u0639\u06a9\u0633\u200c\u0627\u0644\u0639\u0645\u0644 \u0646\u0634\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f.<\/p>\n<ul>\n<li><strong>\u0647\u0632\u06cc\u0646\u0647:<\/strong> \u06f1 \u062a\u0627 \u06f2 \u0645\u06cc\u0644\u06cc\u0648\u0646 \u062a\u0648\u0645\u0627\u0646 (TF-Mini)<\/li>\n<li><strong>\u0628\u0631\u062f \u062a\u0634\u062e\u06cc\u0635:<\/strong> \u06f1\u06f0cm \u062a\u0627 \u06f1\u06f2m<\/li>\n<li><strong>\u0646\u0631\u062e \u0628\u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06cc:<\/strong> \u06f1\u06f0\u06f0Hz<\/li>\n<\/ul>\n<\/div>\n<p><svg viewBox='0 0 860 200' width='100%' xmlns='http:\/\/www.w3.org\/2000\/svg' style='background:#fff;border:1px solid #e0e0e0;border-radius:12px;margin-bottom:22px'>\n<rect x='340' y='80' width='180' height='60' rx='12' fill='#f7d794' stroke='#a06d00' stroke-width='2'\/>\n<text x='430' y='110' text-anchor='middle' font-size='13' font-family='Tahoma'>AGV + LiDAR<\/text>\n<rect x='40' y='88' width='80' height='44' rx='8' fill='#e53935' opacity='0.7'\/>\n<text x='80' y='108' text-anchor='middle' font-size='11' font-family='Tahoma' fill='#fff'>STOP<\/text>\n<text x='80' y='122' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#fff'>&lt;30cm<\/text>\n<rect x='140' y='85' width='100' height='50' rx='8' fill='#ff9800' opacity='0.7'\/>\n<text x='190' y='108' text-anchor='middle' font-size='11' font-family='Tahoma' fill='#fff'>SLOW<\/text>\n<text x='190' y='122' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#fff'>30-100cm<\/text>\n<rect x='260' y='83' width='80' height='54' rx='8' fill='#4caf50' opacity='0.7'\/>\n<text x='300' y='108' text-anchor='middle' font-size='11' font-family='Tahoma' fill='#fff'>GO<\/text>\n<text x='300' y='122' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#fff'>&gt;100cm<\/text>\n<line x1='340' y1='110' x2='340' y2='110' stroke='none'\/>\n<text x='430' y='175' text-anchor='middle' font-size='13' font-family='Tahoma' fill='#888'>LiDAR AGV \u2014 \u06f3 \u0646\u0627\u062d\u06cc\u0647: STOP\/SLOW\/GO<\/text>\n<\/svg><\/p>\n<h2>\u06a9\u062f \u0622\u0631\u062f\u0648\u06cc\u0646\u0648 \u2014 LiDAR Obstacle Avoidance<\/h2>\n<pre style='background:#1e1e1e;color:#d4d4d4;padding:18px;border-radius:10px;overflow-x:auto;font-size:13px'><code class='language-cpp'>\n#include &lt;SoftwareSerial.h&gt;\nSoftwareSerial tfSerial(4, 5);  \/\/ RX, TX\n\nstruct TFData { int distance; int strength; };\n\nTFData readTF() {\n  TFData data = {-1, -1};\n  while(tfSerial.available() >= 9) {\n    if(tfSerial.read() == 0x59 && tfSerial.read() == 0x59) {\n      byte buf[7];\n      tfSerial.readBytes(buf, 7);\n      data.distance = buf[0] | (buf[1] << 8);\n      data.strength = buf[2] | (buf[3] << 8);\n    }\n  }\n  return data;\n}\n\nvoid setup() {\n  Serial.begin(115200);\n  tfSerial.begin(115200);\n  pinMode(LED_BUILTIN, OUTPUT);\n}\n\nvoid loop() {\n  TFData tf = readTF();\n  int d = tf.distance;\n\n  if(d > 0 && d < 30) {\n    Serial.println(\"STOP! \" + String(d) + \"cm\");\n    \/\/ stopMotors();\n    digitalWrite(LED_BUILTIN, HIGH);\n  } else if(d >= 30 && d < 100) {\n    int speed = map(d, 30, 100, 80, 200);\n    Serial.println(\"SLOW \" + String(d) + \"cm spd=\" + String(speed));\n    \/\/ setSpeed(speed);\n  } else {\n    Serial.println(\"GO \" + String(d) + \"cm\");\n    \/\/ setSpeed(255);\n    digitalWrite(LED_BUILTIN, LOW);\n  }\n  delay(50);\n}\n<\/code><\/pre>\n<h2>\u0686\u06a9\u200c\u0644\u06cc\u0633\u062a \u062a\u0633\u062a<\/h2>\n<table style='width:100%;border-collapse:collapse;margin-bottom:18px'>\n<thead>\n<tr style='background:#e8f0fe'>\n<th style='padding:9px;border:1px solid #ddd;text-align:right'>\u062a\u0633\u062a<\/th>\n<th style='padding:9px;border:1px solid #ddd;text-align:right'>\u0646\u062a\u06cc\u062c\u0647<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style='padding:8px;border:1px solid #ddd'>\u062f\u06cc\u0648\u0627\u0631 \u062f\u0631 \u06f5\u06f0cm \u2192 SLOW\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>\u0628\u0644\u0647<\/td>\n<\/tr>\n<tr style='background:#fafafa'>\n<td style='padding:8px;border:1px solid #ddd'>\u062f\u0633\u062a \u062f\u0631 \u06f2\u06f0cm \u2192 STOP\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>\u0628\u0644\u0647<\/td>\n<\/tr>\n<tr>\n<td style='padding:8px;border:1px solid #ddd'>\u0641\u0627\u0635\u0644\u0647 \u062f\u0631 Serial Monitor \u0642\u0627\u0628\u0644 \u062e\u0648\u0627\u0646\u062f\u0646\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>\u0628\u0644\u0647<\/td>\n<\/tr>\n<tr style='background:#fafafa'>\n<td style='padding:8px;border:1px solid #ddd'>Strength \u0628\u0627\u0644\u0627\u06cc \u06f1\u06f0\u06f0\u061f<\/td>\n<td style='padding:8px;border:1px solid #ddd'>\u0632\u06cc\u0631 \u06f1\u06f0\u06f0 = \u0647\u062f\u0641 \u0636\u0639\u06cc\u0641<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><svg viewBox='0 0 860 200' width='100%' xmlns='http:\/\/www.w3.org\/2000\/svg' style='background:#fff;border:1px solid #e0e0e0;border-radius:12px;margin-bottom:22px'>\n<rect x='40' y='75' width='155' height='60' rx='12' fill='#8bd3dd' stroke='#1f6f78' stroke-width='2'\/>\n<rect x='245' y='75' width='155' height='60' rx='12' fill='#f7d794' stroke='#a06d00' stroke-width='2'\/>\n<rect x='450' y='75' width='155' height='60' rx='12' fill='#b7e4a0' stroke='#3a7a1e' stroke-width='2'\/>\n<rect x='655' y='75' width='165' height='60' rx='12' fill='#e8f4ff' stroke='#3a60c0' stroke-width='2'\/>\n<line x1='195' y1='105' x2='245' y2='105' stroke='#555' stroke-width='2.5'\/>\n<line x1='400' y1='105' x2='450' y2='105' stroke='#555' stroke-width='2.5'\/>\n<line x1='605' y1='105' x2='655' y2='105' stroke='#555' stroke-width='2.5'\/>\n<text x='117' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>TF-Mini LiDAR<\/text>\n<text x='117' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>UART 115200<\/text>\n<text x='322' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>Arduino<\/text>\n<text x='322' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>\u0645\u0646\u0637\u0642 \u0646\u0627\u062d\u06cc\u0647<\/text>\n<text x='527' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>L298N<\/text>\n<text x='527' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>\u06a9\u0646\u062a\u0631\u0644 \u0645\u0648\u062a\u0648\u0631<\/text>\n<text x='737' y='100' text-anchor='middle' font-size='12' font-family='Tahoma'>AGV \u0627\u06cc\u0645\u0646<\/text>\n<text x='737' y='115' text-anchor='middle' font-size='11' font-family='Tahoma'>STOP\/SLOW\/GO<\/text>\n<text x='430' y='175' text-anchor='middle' font-size='13' font-family='Tahoma' fill='#666'>LiDAR AGV \u2014 TF-Mini \u2192 Arduino \u2192 \u0633\u0647\u200c\u0646\u0627\u062d\u06cc\u0647 \u2192 \u0645\u0648\u062a\u0648\u0631<\/text>\n<\/svg><\/p>\n<h2>\u0648\u06cc\u062f\u0626\u0648\u0647\u0627\u06cc \u0622\u0645\u0648\u0632\u0634\u06cc<\/h2>\n<div style='display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:18px;margin:20px 0'>\n<iframe width='100%' height='315' src='https:\/\/www.youtube.com\/embed\/EtFx6yFxzZA' title='TF Mini LiDAR Arduino Obstacle Avoidance' frameborder='0' allow='accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture' allowfullscreen><\/iframe><br \/>\n<iframe width='100%' height='315' src='https:\/\/www.youtube.com\/embed\/mRVpH3QTLKE' title='AGV Robot Obstacle Detection LiDAR' frameborder='0' allow='accelerometer;autoplay;clipboard-write;encrypted-media;gyroscope;picture-in-picture' allowfullscreen><\/iframe>\n<\/div>\n<h2>\u0645\u0646\u0627\u0628\u0639 \u0628\u06cc\u0634\u062a\u0631<\/h2>\n<ul>\n<li><a href='https:\/\/www.aparat.com\/result\/LiDAR_TF-Mini_%D8%A2%D8%B1%D8%AF%D9%88%DB%8C%D9%86%D9%88' target='_blank'>\u0622\u067e\u0627\u0631\u0627\u062a: LiDAR TF-Mini \u0622\u0631\u062f\u0648\u06cc\u0646\u0648 \u0641\u0627\u0631\u0633\u06cc<\/a><\/li>\n<li><a href='https:\/\/github.com\/TFmini\/TFmini-Arduino' target='_blank'>GitHub: TFmini Arduino Library<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0622\u0645\u0648\u0632\u0634 \u0646\u0635\u0628 \u0633\u0646\u0633\u0648\u0631 LiDAR TF-Mini Plus \u0631\u0648\u06cc AGV \u0628\u0627 \u0622\u0631\u062f\u0648\u06cc\u0646\u0648\u061b \u062a\u0634\u062e\u06cc\u0635 \u0645\u0627\u0646\u0639 \u062f\u0631 \u0628\u0631\u062f \u06f1\u06f2 \u0645\u062a\u0631\u060c \u062a\u0648\u0642\u0641 \u0627\u0636\u0637\u0631\u0627\u0631\u06cc \u062e\u0648\u062f\u06a9\u0627\u0631\u060c \u0645\u0646\u0637\u0642 \u0686\u0646\u062f\u06cc\u0646 \u0646\u0627\u062d\u06cc\u0647 Stop\/Slow\/Go.<\/p>\n","protected":false},"author":1,"featured_media":522,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[16,20],"tags":[59,295,296,21,50,54,298,297],"class_list":["post-523","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ugv","category-projects-2","tag-agv","tag-lidar","tag-tf-mini","tag-arduino","tag-50","tag-54","tag-298","tag-297"],"_links":{"self":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/comments?post=523"}],"version-history":[{"count":1,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/523\/revisions"}],"predecessor-version":[{"id":524,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/523\/revisions\/524"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/media\/522"}],"wp:attachment":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/media?parent=523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/categories?post=523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/tags?post=523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}