Arduino Robotics - Sách hướng dẫn xây dựng robot thực tế của John-David Warren

Chuyên ngành

Robot học

Người đăng

Ẩn danh

Thể loại

Sách

2011

626
0
0

Phí lưu trữ

135 Point

Tóm tắt

I. Tổng quan về cuốn sách Arduino Robotics 1st Edition

Cuốn sách Arduino Robotics do John-David Warren, Josh Adams và Harald Molle biên soạn là một trong những tài liệu hướng dẫn toàn diện nhất về chế tạo robot sử dụng nền tảng Arduino. Được xuất bản bởi Apress vào năm 2011 với ISBN-13 bản in là 978-1-4302-3183-7, cuốn sách nhanh chóng trở thành nguồn tham khảo quan trọng cho người yêu thích robotics. Nội dung sách bao gồm các kiến thức nền tảng về điện tử, lập trình Arduino và kỹ thuật cơ khí cần thiết để xây dựng các dự án robot thực tế. Người đọc được hướng dẫn từ những khái niệm cơ bản nhất như cách đo dòng điện, điện dung cho đến việc viết sketch điều khiển LED và motor. Cuốn sách phù hợp với nhiều đối tượng, từ người mới bắt đầu đến người có kinh nghiệm muốn mở rộng kiến thức về robot tự hành. Phần mềm mã nguồn đi kèm được cung cấp miễn phí cho độc giả, giúp việc thực hành trở nên dễ dàng hơn. Đây là tài liệu không thể thiếu cho bất kỳ ai muốn tìm hiểu sâu về lĩnh vực Arduino robotics.

1.1. Thông tin xuất bản và đội ngũ tác giả

Cuốn Arduino Robotics ấn bản đầu tiên được xuất bản bởi Apress, một nhà xuất bản chuyên về sách công nghệ thông tin và kỹ thuật. Đội ngũ biên soạn bao gồm ba tác giả chính: John-David Warren, Josh Adams và Harald Molle. Trong đó, Josh Adams đóng vai trò vừa là tác giả vừa là người đánh giá kỹ thuật (Technical Reviewer) cùng với Guilherme Martins. Quá trình xuất bản có sự tham gia của nhiều biên tập viên chuyên nghiệp như Michelle Lowman, James Markham và điều phối viên Anita Castro. Cuốn sách được phân phối toàn cầu thông qua Springer Science+Business Media, đảm bảo khả năng tiếp cận rộng rãi cho độc giả quốc tế. Bản quyền thuộc về các tác giả năm 2011.

1.2. Phạm vi nội dung và cấu trúc sách

Cuốn Arduino Robotics được xây dựng với cấu trúc logic, bắt đầu từ các khái niệm cơ bản về điện tử trước khi tiến đến các dự án robot phức tạp. Nội dung bao gồm các chủ đề chính: cách đo dòng điện sử dụng đồng hồ vạn năng và cảm biến dòng, hiểu về điện dung và tụ điện, cùng với các nguyên tắc lập trình Arduino cơ bản. Sách sử dụng ví dụ cụ thể như sketch Blink để minh họa cách sử dụng hàm digitalWrite() và delay(). Mỗi chương đi kèm mã nguồn minh họa rõ ràng, giúp người đọc dễ dàng thực hành. Phần nội dung về đo dòng điện giải thích chi tiết cách pin được đánh giá theo Amp/Giờ (AH) và milliamp/giờ (mAH).

II. Phân tích các kiến thức kỹ thuật trong Arduino Robotics

Cuốn sách Arduino Robotics cung cấp nền tảng kỹ thuật vững chắc cho người đọc muốn hiểu sâu về hệ thống điện tử trong robot. Một khía cạnh quan trọng được phân tích chi tiết là cách đo và hiểu dòng điện trong mạch. Sách giải thích rằng dòng điện (amperage) phụ thuộc vào điện áp hoạt động và điện trở của mạch. Khi điện áp giảm do pin xả hoặc điện trở dao động, dòng điện tiêu thụ cũng thay đổi theo. Đối với robot lớn di chuyển liên tục, dòng điện thay đổi mỗi khi robot đi qua đá hoặc lên dốc, vì motor DC tiêu thụ nhiều dòng hơn khi gặp điện trở lớn hơn. Ngược lại, đèn LED tiêu thụ dòng ổn định khoảng 20-100mA cho đến khi pin hết. Sách cũng đề cập đến việc sử dụng cảm biến dòng, ampe kìm hoặc kẹp điện áp để đo dòng lớn trên 10A. Kiến thức về điện dung cũng được trình bày, giải thích rằng 1 Farad là giá trị rất lớn nên hầu hết dự án sử dụng tụ điện ở mức microfarad (uF).

2.1. Đo dòng điện và hiểu hệ thống nguồn cho robot

Việc đo dòng điện là kỹ năng cơ bản và quan trọng khi làm việc với robot Arduino. Cuốn sách hướng dẫn sử dụng đồng hồ vạn năng để đo dòng, lưu ý rằng đồng hồ có giới hạn đo khác nhau - loại ít tính năng hơn chỉ đo được tối đa 150mA. Để đo dòng lớn hơn 10A, cần sử dụng cảm biến dòng chuyên dụng hoặc ampe kìm. Sách nhấn mạnh rằng pin được đánh giá theo Amp/Giờ (AH), ví dụ pin 6V và 12AH có thể cung cấp 1 ampe trong 12 giờ hoặc 12 ampe trong 1 giờ. Pin nhỏ như loại AA được đánh giá theo milliamp/giờ (mAH), chẳng hạn pin 2200mAH tương đương 2.2AH.

2.2. Điện dung và vai trò của tụ điện trong mạch robot

Điện dung là đại lượng đo điện tích có thể lưu trữ trong một thiết bị, được đo bằng đơn vị Farad. Cuốn sách giải thích rằng 1 Farad là giá trị cực kỳ lớn, vì vậy các dự án robot thường sử dụng tụ điện có giá trị ở mức microfarad (uF). Tụ điện đóng vai trò quan trọng trong mạch robot như lọc nhiễu nguồn, ổn định điện áp và lưu trữ năng lượng tạm thời. Việc hiểu cách chọn và sử dụng tụ điện đúng cách giúp cải thiện độ ổn định của hệ thống robot Arduino. Sách cung cấp hướng dẫn thực tế về cách đọc giá trị tụ điện và tích hợp chúng vào mạch điều khiển.

III. Phương pháp lập trình Arduino trong cuốn sách Robotics

Phần lập trình trong cuốn Arduino Robotics được trình bày một cách hệ thống và dễ tiếp cận. Sách bắt đầu với ví dụ Blink kinh điển, minh họa cách viết sketch cơ bản nhất cho Arduino. Cấu trúc sketch bao gồm hai hàm chính: setup() và loop(). Hàm setup() chạy một lần khi khởi động, sử dụng pinMode() để cấu hình chân kỹ thuật số. Hàm loop() lặp lại liên tục, điều khiển hành vi của robot. Ví dụ Blink sử dụng digitalWrite() để bật tắt LED trên chân 13, kết hợp với hàm delay(ms) để tạo khoảng thời gian chờ. Thay đổi giá trị trong delay(1000) sẽ ảnh hưởng trực tiếp đến thời gian LED sáng và tắt. Sách khuyến khích người đọc thử nghiệm thay đổi các giá trị này để quan sát kết quả. Phương pháp học qua thực hành này giúp người đọc nắm vững nguyên lý hoạt động của Arduino trước khi tiến đến các dự án phức tạp hơn. Mã nguồn ví dụ được cung cấp đầy đủ, cho phép người đọc tải về và thử nghiệm ngay trên board Arduino của mình.

3.1. Cấu trúc cơ bản của sketch Arduino

Mỗi sketch Arduino bao gồm hai phần bắt buộc là hàm setup() và hàm loop(). Hàm setup() được gọi một lần duy nhất khi Arduino khởi động, thường dùng để cấu hình các chân vào/ra. Hàm loop() chạy lặp lại vô hạn từ đầu đến cuối, đây là nơi chứa logic điều khiển chính. Cuốn sách giải thích rõ ràng cách khai báo biến, ví dụ dòng lệnh 'int my_led = 13' đặt tên cho chân LED. Lệnh pinMode(my_led, OUTPUT) trong setup() cấu hình chân 13 là đầu ra. Hàm loop() sử dụng digitalWrite() với giá trị HIGH hoặc LOW để bật tắt LED, kết hợp delay() để kiểm soát thời gian.

3.2. Ví dụ thực hành Blink và hàm delay

Ví dụ Blink là dự án đầu tiên trong cuốn sách, giúp người đọc hiểu cách Arduino hoạt động. Sketch này sử dụng LED tích hợp sẵn trên chân kỹ thuật số 13 của board Arduino. Hàm digitalWrite(my_led, HIGH) đặt chân ở mức cao để bật LED, trong khi digitalWrite(my_led, LOW) đặt chân ở mức thấp để tắt LED. Hàm delay(1000) tạo khoảng chờ 1000 millisecond (1 giây) giữa các trạng thái. Sách khuyến khích thay đổi giá trị delay để quan sát sự khác biệt. Ví dụ, giảm delay xuống 200ms sẽ làm LED nhấp nháy nhanh hơn, tăng lên 3000ms sẽ làm LED chớp chậm hơn. Đây là nền tảng để hiểu timing trong robot.

IV. Kết luận và ứng dụng thực tế của Arduino Robotics

Cuốn Arduino Robotics của John-David Warren, Josh Adams và Harald Molle đã trở thành một trong những tài liệu tham khảo hàng đầu trong lĩnh vực robot giáo dục. Ấn bản đầu tiên năm 2011 cung cấp nền tảng kiến thức toàn diện, từ lý thuyết điện tử cơ bản đến thực hành lập trình và chế tạo robot. Giá trị cốt lõi của cuốn sách nằm ở cách tiếp cận thực tiễn, mỗi khái niệm lý thuyết đều đi kèm với ví dụ minh họa cụ thể và mã nguồn có thể chạy ngay. Người đọc học được cách hiểu hệ thống nguồn, đo lường điện năng và viết chương trình điều khiển cho robot. Cuốn sách mở ra cánh cửa cho nhiều ứng dụng thực tế như robot dò đường, robot tránh chướng ngại vật và robot điều khiển từ xa. Với sự phát triển mạnh mẽ của cộng đồng Arduino toàn cầu, kiến thức trong cuốn sách vẫn giữ nguyên giá trị. Đây là tài liệu lý tưởng cho sinh viên kỹ thuật, người đam mê DIY và bất kỳ ai muốn bước vào thế giới robot tự hành.

4.1. Ứng dụng kiến thức vào dự án robot thực tế

Kiến thức từ cuốn Arduino Robotics có thể áp dụng trực tiếp vào nhiều dự án robot thực tế. Việc hiểu cách đo dòng điện giúp người chế tạo tính toán dung lượng pin phù hợp cho robot, đảm bảo thời gian hoạt động tối ưu. Kiến thức về motor DC và cách tiêu thụ dòng khi gặp điện trở lớn hơn được áp dụng trong robot leo dốc hoặc di chuyển trên địa hình gồ ghề. Kỹ năng lập trình Arduino với hàm setup() và loop() là nền tảng cho mọi dự án robot tự hành. Người đọc có thể mở rộng từ ví dụ Blink đơn giản sang điều khiển nhiều motor, cảm biến và module giao tiếp phức tạp hơn.

4.2. Giá trị lâu dài của cuốn sách trong cộng đồng Arduino

Dù được xuất bản từ năm 2011, cuốn Arduino Robotics vẫn giữ giá trị tham khảo quan trọng trong cộng đồng Arduino. Các nguyên tắc cơ bản về điện tử và lập trình Arduino không thay đổi theo thời gian, khiến nội dung sách luôn phù hợp. Mã nguồn đi kèm được cung cấp miễn phí cho phép người đọc dễ dàng bắt đầu thực hành. Cuốn sách đã truyền cảm hứng cho hàng nghìn người trên toàn thế giới tìm hiểu về robotics. Cộng đồng Arduino phát triển mạnh mẽ với hàng triệu thành viên, và cuốn sách này là điểm khởi đầu lý tưởng. Tài liệu cũng hữu ích cho giảng viên xây dựng giáo trình dạy robotics tại các trường đại học và trung tâm đào tạo kỹ thuật.

21/04/2026

Trích đoạn nội dung tài liệu

Arduino Robotics          „ „ „ John-David Warren Josh Adams Harald Molle www.org Arduino Robotics Copyright © 2011 by John-David Warren, Josh Adams, and Harald Molle All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-3183-7 ISBN-13 (electronic): 978-1-4302-3184-4 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. President and Publisher: Paul Manning Lead Editor: Michelle Lowman and James Markham Technical Reviewer: Guilherme Martins and Josh Adams Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Anita Castro Copy Editor: Ginny Munroe and Mary Ann Fugate Compositor: Bytheway Publishing Services Indexer: BIM Indexing & Proofreading Services Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer- sbm.com, or visit www. For information on translations, please e-mail rights@apress.com, or visit www. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www. You will need to answer questions pertaining to this book in order to successfully download the code.org To my dad, Poppy, and Papa Bert for showing me that even ordinary men can be extraordinary. John-David Warren www.info Contents at a Glance „ About the Authors. xix „ About the Technical Reviewers . xxiv „ Chapter 1: Introducing Oracle APEX .1 „ Chapter 1: The Basics .1 „ Chapter 2: Arduino for Robotics .51 „ Chapter 3: Let’s Get Moving.83 „ Chapter 4: Linus the Line-Bot .119 „ Chapter 5: Wally the Wall-Bot.169 „ Chapter 6: Making PCBs .203 „ Chapter 7: The Bug-Bot.257 „ Chapter 8: Explorer-Bot .331 „ Chapter 10: Lawn-Bot 400 .403 „ Chapter 11: The Seg-Bot .453 „ Chapter 12: The Battle-Bot .513 „ Chapter 13: Alternate Control .info Contents „ About the Authors. xix „ About the Technical Reviewers . xxiv „ Chapter 1: The Basics . 10 Calculating Resistor Power Using Ohm’s Law.info „ CONTENTS Integrated Circuits . 17 Through-Hole Components.49 „ Chapter 2: Arduino for Robotics . 58 Interfacing a Motor-Controller . 68 Radio Control Systems . 72 Distance and Reflection Sensing.info „ CONTENTS Orientation (Positioning) . 76 Non-Autonomous Sensors.81 „ Chapter 3: Let’s Get Moving.83 Brushed DC Motor (Permanent Magnet Type) . 88 Finding the Right Motor . 93 Changing PWM Frequencies. 100 Nickel Metal Hydride (NiMH).info „ CONTENTS Materials. 104 Nuts and Bolts . 105 Chain and Sprockets .105 „ Chapter 4: Linus the Line-Bot .119 Parts List for Linus.120 How Linus Works . 123 Building the IR Sensor Board.123 Modifying a Servo for Continuous Rotation .132 Method 1: Direct DC Drive with External Speed Controller. 133 Method 2: Servo Pulse Drive with Internal Motor Driving Circuitry . 135 Fitting the Drive wheels.150 Install Power Switch. 150 Loading the Code.150 Making the Track.info „ CONTENTS Adding Speed Regulator (Potentiometer) .167 „ Chapter 5: Wally the Wall-Bot.169 How Wally Works.170 Parts List for Wally.172 The Motor-Controller .173 The High-Side Switches . 174 The Low-Side Switches. 174 Building the Circuit . 176 Building the Frame .182 Installing the Sensors .187 Installing the Battery and Power Switch.190 Installing a Power Switch.201 „ Chapter 6: Making PCBs .203 What You Need to Get Started .206 Searching for Open-Source Designs . 207 Making Your Own Designs. 208 Working with the Schematic Editor . 211 Working with the Board Editor. 216 Transferring the Design .226 Let’s Make an Arduino Clone: the Jduino . 227 Making the Transfer .info „ CONTENTS Etching.236 Measuring the Solution. 239 Removing the Toner .246 Building the Arduino Clone . 247 Building the BJT H-Bridge .256 „ Chapter 7: The Bug-Bot.257 Reading a Switch with Arduino .258 How the Bug-bot Works. 260 Parts List for the Bug-bot .261 Modifying the Servo Motors . 261 Controlling the Servo Motors. 264 Converting the Pulse Value to Degrees . 265 Mounting the Wheels to the Servos. 266 Building the Frame .267 Marking the PlexiGlass . 267 Cutting the PlexiGlass. 269 Mounting the Motors . 271 Mounting the Caster Wheels .info „ CONTENTS Mounting the Arduino . 274 Installing the Battery . 275 Making the Sensors.277 The Front Antennae Sensors . 277 The Rear Bump Sensors . 278 Making Wire Connections.281 Loading the Code. 285 Making a Top Hat.294 „ Chapter 8: Explorer-Bot .295 How the Explorer-Bot Works . 297 Parts List for the Explorer-Bot .298 Building the Frame . 300 Adding Battery Bracket. 301 Cut Top Frame Brackets . 303 Cut Top Frame Braces . 303 Cut and Bend Main Frame Piece . 304 Add Crossbar and Mount Caster Wheel .info „ CONTENTS Building the Motor Controller.308 Current Sensing and Limiting . 309 Setting Up the Arduino.313 Connecting the H-Bridges . 314 Setting Up Xbee .315 Testing the Xbees .318 Pan and Tilt. 319 Make First Bracket . 319 Make Second Bracket. 321 Loading the Code.331 Some Words in Advance.332 Parts List for the RoboBoat. 338 Styrofoam Cutter and Razor Knife . 338 The RoboBoat Design.338 Assembling the Boat. 340 Gluing the Templates on the EPS/XPS Board .org „ CONTENTS Cutting Out the Segments . 343 Gluing the Segments Together . 346 Inserting the Foam Anchors . 348 Applying the Finish . 351 Completing the Assembly. 352 The Propulsion Assembly. 359 The Rudder Horns.361 The Heart of the System: The ArduPilot PCB . 362 The GPS Module . 363 The Electronic Speed Controller (ESC). 365 The Rudder Servo . 365 The Battery Pack . 365 Assembling the Electronics . 365 Software and Mission Planning .info „ CONTENTS Installing the Software . 392 Putting It All Together .396 Integrating the System .400 The Thrust of the Motor/Propeller Is Not Sufficient. 400 The Motor Does Not Start .402 „ Chapter 10: Lawn-Bot 400 .403 How the Lawn-bot 400 Works .404 Lawn Mower Deck. 405 High-Capacity Batteries. 407 Tools and Parts List .408 Front Caster Wheels . 409 Rear Drive Wheels .412 The Drive-Train .info „ CONTENTS Motor Mount Brackets . 420 Installing the Chain. 424 The Motor Controller.427 Buying a Motor Controller. 429 Motor Controller feedback.430 Securing Connections for a Bumpy Ride . 439 Avoiding an R/C Failsafe.442 Adding Cosmetics and Accessories. 449 Lawnmower Kill-Switch .451 „ Chapter 11: The Seg-Bot .453 How the Seg-Bot Works.455 Inertial Measurement Unit . 455 Steering and Gain . 455 Parts List for the Seg-Bot .456 Selecting the Right Sensors . 461 Gyroscope Versus Accelerometer Summary . 463 Filtering the Angle . 463 Making the IMU Adapter Board.464 Selecting the Motors.465 Electric Brake Removal . 467 Motor Mounting Position . 471 Selecting the Motor Controller. 473 Sabertooth Simplified Serial.475 Sealed Lead-Acid. 478 Building the Frame . 483 Mounting the Inputs to the Frame . 484 Installing the Electronics .488 Soldering the Inputs . 491 Wiring the Connections .info „ CONTENTS Reviewing the Code .493 The sample_accel() Function . 494 The sample_gyro() Function . 494 Checking the Angle Readings. 496 The calculate_angle() Function . 496 The read_pots() Function. 497 The auto_level() Function . 498 The update_motor_speed() Function . 499 The time_stamp() Function. 501 The serial_print_stuff() Function . 502 The Full Code.511 „ Chapter 12: The Battle-Bot .513 Robotic Combat Is Born .515 Battle-Bot Rules and Regulations. 515 No Price Limit! . 516 Parts List for the Battle-Bot .520 Fly Sky CT-6: The $32, 5-ch*, 2.4GHz Radio Alternative . 523 The Motor Controllers .525 To Buy or Build? . 526 Modifying the Wheels .info „ CONTENTS Building the Frame . 528 The Drive Train . 533 Chain Tensioning Nut.540 Protecting Your Brains.562 „ Chapter 13: Alternate Control .563 Using Processing to Decode the Signals .563 Parts List for Alternate Control .564 Selecting the Input.566 Examining the Processing Sketch . 572 Examining the Arduino Sketch.info About the Authors J-D is an electronics hobbyist, builder, and relentless tinkerer. As a child, he took apart everything he owned to figure out how it worked. Since then he has built many different projects ranging from an electric fishing pole to a remote-controlled lawn mower, which was featured on the cover of MAKE magazine in April 2010. Having worked as a builder doing carpentry, plumbing, and electrical work for eight years, his knowledge is founded on real-world experience rather than text-book recitation. In addition to building robots and remote-controlled toys, he enjoys automating everyday tasks, blinking LEDs, designing and etching PCBs, and lots of random things in between. Much of his time has been spent researching, building, and testing various motor-controllers to make his bots move. As a self-proclaimed “poor man’s roboticist,” he will always try to find the cheapest way to do something—usually by building it himself. J-D graduated from the University of Alabama at Birmingham with a degree in business management. He currently lives in Birmingham, Alabama with his beautiful wife, Melissa, and their growing flock of animals. Josh Adams is a software developer with over ten years of professional experience building production-quality software and managing projects. He built a Tesla coil for a high-school science project that shot >27" bolts of lightning. Josh is Isotope Eleven’s lead architect, and is responsible for overseeing architectural decisions and translating customer requirements into working software. Josh graduated from the University of Alabama at Birmingham (UAB) with Bachelor of Science degrees in both mathematics and philosophy. When he’s not working, Josh enjoys spending time with his family.info ABOUT THE AUTHORS Harald Molle has been a computer engineer since 1984. He started his career by becoming a researcher at a university in the southwest of Germany before cofounding an embedded systems company. Harald is also an expert scuba diver, a passion he is trying to combine with his work by developing a GPS-controlled robot to survey lakes. He is happily married to Jacqueline, who knows that an interest in robotics requires substantial amounts of time. And he owns a cat.info About the Technical Reviewers Josh Adams is a software developer with over ten years of professional experience building production-quality software and managing projects. He built a Tesla coil for a high-school science project that shot >27" bolts of lightning. Josh is Isotope Eleven’s lead architect, and is responsible for overseeing architectural decisions and translating customer requirements into working software. Josh graduated from the University of Alabama at Birmingham (UAB) with Bachelor of Science degrees in both mathematics and philosophy. When he’s not working, Josh enjoys spending time with his family. Guilherme Martins was born in Lisbon in 1977. He has always been interested in many forms of art and started early to experiment with various mediums—photography, video, drawing, and painting.

Nội dung được bảo vệ bản quyền — Tải xuống đầy đủ