กลับไปหน้ารวมไฟล์
arduino-iot-robotic-arm-cloud.md

กลไกที่เชื่อมต่อกับเว็บ: แขนกล IoT

การสร้างแขนกลที่ควบคุมด้วย potentiometers ภายในเครื่องเป็นเรื่องที่ยอดเยี่ยม แต่ Arduino IoT Robotic Arm ยกระดับไปสู่การควบคุมระยะไกลทั่วโลก (telepresence). ด้วยการเปลี่ยนจาก Arduino Uno แบบมาตรฐานไปใช้ ESP8266 หรือ Arduino MKR WiFi คุณสามารถเคลื่อนย้ายวัตถุหนักๆ ในห้องของคุณได้จริง เพียงแค่ลาก sliders บน smartphone app ในขณะที่คุณนั่งอยู่คนละทวีป!

smart_dustbin_internal_servo_1772704583966.png

ตัวแปร Over-The-Air (Arduino Cloud)

โค้ดนี้ไม่ได้ใช้ analogRead(A0) เพื่อควบคุม servos แต่ใช้ Cloud Property Variables.

  1. ภายใน Arduino IoT Cloud Dashboard คุณสร้าง slider widgets ขนาดใหญ่ 4 ตัว (Base, Shoulder, Elbow, Gripper) ที่มีค่าตั้งแต่ 0 ถึง 180.
  2. ไฟล์ thingProperties.h จะเชื่อมโยง Web Sliders เหล่านี้เข้ากับ variables ในโค้ด C++ ของคุณโดยอัตโนมัติ!
  3. ตัวกระตุ้นเหตุการณ์ (Event Triggers): ฟังก์ชัน loop() จะยังคงว่างเปล่าโดยสมบูรณ์ แต่โค้ดจะใช้ onChange interrupts แทน!
void onBaseAngleChange() {
  Serial.println("Web Update Received: Moving Base...");
  baseServo.write(baseAngle); // Physically swing the massive gear!
}

ความสมบูรณ์ของฮาร์ดแวร์แขนกล

  • NodeMCU ESP8266 หรือ Arduino MKR WiFi 1010
  • MG996R Metal Gear Servos สี่ตัว (อย่าพยายามยกแขนกลด้วย SG90 servos ที่เป็นพลาสติก; base servo จะเฟืองรูดทันทีและยุบตัวลงภายใต้แรงบิดทางกายภาพ!).
  • PCA9685 16-Channel PWM Module (เป็นอุปกรณ์เสริม แต่แนะนำเป็นอย่างยิ่งหาก timer ภายในของ ESP8266 เริ่มมีอาการสั่นสะดุดทางดิจิทัลในขณะที่จัดการ Wi-Fi JSON interrupts จำนวนมาก!).
  • แหล่งจ่ายไฟภายนอก 5V 5-Amp (อย่าจ่ายไฟให้กับ metal servos 4 ตัวจาก USB! มันจะทำให้ ESP8266 chip เกิดอาการ brown-out ทันทีและทำลายการเชื่อมต่อ Wi-Fi ของคุณทันทีที่แขนพยายามจะยกวัตถุ!).

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

title: "Arduino IoT Robotic Arm"
description: "Global tele-manipulation! Combine high-torque MG996R servo-kinematics with ESP8266 IoT Cloud infrastructure to build an absolute remote-operated robotic assembly arm controllable from any web dashboard worldwide."
category: "Motors & Robotics"
difficulty: "Advanced"