ArduinoAndKinectProjects.pdf

上传人:精*** 文档编号:1076514 上传时间:2024-04-11 格式:PDF 页数:411 大小:10.94MB
下载 相关 举报
ArduinoAndKinectProjects.pdf_第1页
第1页 / 共411页
ArduinoAndKinectProjects.pdf_第2页
第2页 / 共411页
ArduinoAndKinectProjects.pdf_第3页
第3页 / 共411页
ArduinoAndKinectProjects.pdf_第4页
第4页 / 共411页
ArduinoAndKinectProjects.pdf_第5页
第5页 / 共411页
点击查看更多>>
资源描述

1、For your convenience Apress has placed some of the front matter material after the index.Please use the Bookmarks and Contents at a Glance links to access them.v Contents at a Glance Contents.vii About the Authors.xvii About the Technical Reviewer.xviii Acknowledgments.xix Introduction.xx?Chapter 1:

2、Arduino Basics.1?Chapter 2:Kinect Basics.23?Chapter 3:Processing.35?Chapter 4:Arduino and Kinect:“Hello World”.61?Chapter 5:Kinect Remote Control.77?Chapter 6:Kinect Networked Puppet.99?Chapter 7:Mood Lamps.133?Chapter 8:Kinect-Driven Drawing Robot.167?Chapter 9:Kinect Remote-Controlled Vehicles.207

3、?Chapter 10:Biometric Station.243?Chapter 11:3D Modeling Interface.279?Chapter 12:Turntable Scanner.309?Chapter 13:Kinect-Controlled Delta Robot.343 Index.385?INTRODUCTION xx Introduction If youve done some Arduino tinkering and wondered how you could incorporate the Kinect in your projects or the o

4、ther way around this book is for you.If you havent actually done any tinkering but you are looking for a good way to get started,this book might also be for you.Even though this is not intended as an introductory book,we have tried to assume as little knowledge from the reader as possible,starting f

5、rom the installation of every tool you will be using and thoroughly explaining every new concept appearing in the book.The Structure of This Book This is a practical book.As such,you are going to be driven through a series of projects evolving from simple to complex,learning all you need to know alo

6、ng the way.The book starts with three introductory chapters oriented to getting you acquainted with Arduino,Kinect,and Processing in the least amount of time possible so you can go straight into building cool projects.From Chapter 4,you will be led through a series of 10 fun projects increasing in c

7、omplexity,starting with the Arduino and Kinect equivalent of Hello World and finishing with the construction and programming of a Kinect-driven delta robot.The Content of the Chapters Each chapter will lead you step-by-step through the construction of the physical project,the building of the necessa

8、ry circuits,the programming of the Arduino board,and the implementation of the Processing programs that connect the Kinect data to your Arduino board.Most projects will involve the implementation of two separate programs,the Arduino program and the Processing program.Arduino code will be displayed i

9、n bold monospace typeface,like this:digitalRead(A0);/This is Arduino Code Processing programs will be written in normal monospace font style,like this:fill(255,0,0);/This is Processing Code In each chapter,you will be introduced to the specific concepts and techniques that you will need to build tha

10、t particular projectand probably some of the following ones.If you are an experienced programmer,you might want to read this book non-sequentially,starting by the project that interests you the most.If you are a programming beginner,you will find it easier to start with the first project and build u

11、p your knowledge as you progress through the book.This is a list of topics that will be introduced in each chapter,so if you are interested in a specific concept you can jump straight to the right project.Chapter 1:You will learn everything you need to know about the Arduino platform,you will instal

12、l the necessary drivers and software,and you will write your first Arduino program.Chapter 2:This chapter will help you discover whats inside that amazing new device that has changed human-computer interfaces:the Kinect.?INTRODUCTION xxi Chapter 3:You will discover the Processing programming languag

13、e and IDE.You will install Processing,build your first Processing programs,and learn a great deal about working in 3D.Chapter 4:You will learn about communicating with Arduino and Kinect through serial,you will develop your own communication protocol,and you will use hand tracking for the first time

14、.You will also learn how to use pulse width modulation and how to work with LEDs and light sensors.Chapter 5:This chapter will teach you to hack a remote control and use body gestures to control your TV set.You will learn how to use relays and how to build a circuit on a prototyping shield.You will

15、even develop your own gesture recognition routine.Chapter 6:You will learn to work with servos and how to communicate through networks and over the Internet.You will also use Kinects skeleton tracking capabilities to drive a puppet with your body gestures.Chapter 7:The Arduino Nano and the XBee wire

16、less module will be introduced in this chapter.You will also learn all about resistors and color LEDs.You will take the skeleton tracking to three dimensions and use it to control a series of lamps responding to your presence.Chapter 8:Przemek Jaworski has contributed this amazing drawing arm projec

17、t.In this chapter,you will work with Firmata,a library that allows you to control the Arduino from Processing without the need to write any Arduino code.You will also learn how to build a tangible table to control your robotic arm.Chapter 9:You will be introduced to DC motors and how to control them

18、 using H-bridges.You will also learn how to use proximity sensors.You will use all these techniques to control a RC car with hand gestures.Chapter 10:This project will teach you how to hack a bathroom scale to provide user weight data wirelessly.You will learn how to acquire data from a seven-segmen

19、t LCD display,and you will then combine the data with the Kinect skeleton tracking to implement user recognition and body mass index calculation.Chapter 11:You will build a wireless,wearable circuit on a glove using the Arduino LilyPad,flex sensors,and an XBee module.You will then implement your own

20、 simple computer-assisted design(CAD)software,and you will use your wireless interface to draw 3D geometries by moving your hand in space.Chapter 12:This chapter will teach you to parse,transform,and recompose raw point clouds in order to perform 360-degreee scans of objects using just one Kinect an

21、d a turntable that you will build.Then you will learn how to write your own.ply file export routine and how to import the point data into Meshlab to prepare it to be 3D printed or rendered.Chapter 13:This final project will teach you the basics of inverse kinematics and how to use all the techniques

22、 from throughout the book to build a Kinect-controlled delta robot.This book has been intentionally built upon multi-platform,open source initiatives.All the tools utilized in the book are free and available for Mac OSX,Windows,and Linux on commercial licenses.Because of the three-dimensional nature

23、 of the data that you can acquire with the Kinect,some of the more advanced projects rely on the use of trigonometry and vector math.We have tried to cover the necessary principles and definitions,but if your mathematical skills are somewhat rusty,you might want?INTRODUCTION xxii to consider having

24、a reference book at hand.John Vinces Mathematics for Computer Graphics(Springer,2006)is an amazing resource.Web sites like Wolfram Alpha()or mathWorld(http:/)can be helpful as well.Every chapter will include the necessary code to make the project work.You can copy this code from the book or you can

25、download the necessary files from Apress()or the books web site().If you need to contact the authors,you can find us via the following addresses:Enrique Ramos Melgar:enriqueesc- Ciriaco Castro Dez:ciriacoesc- Przemek Jaworski: C H A P T E R 1?1 Arduino Basics by Enrique Ramos This first chapter is d

26、edicated to Arduino,one of the two cornerstones of this book.The following pages cover the basics of the Arduino hardware and software.By the end of the chapter,you will have installed the platform on your computer and you will have programmed two examples using the Arduino integrated development en

27、vironment(IDE).The structure of an Arduino sketch will be analyzed and each function explained.You will learn about the Arduino input and output pins.You will also learn the basic concepts of electricity,circuits,and prototyping techniques that you will be using throughout the book.It is highly like

28、ly that this is not the first book on Arduino that you have held in your hands.If you are an experienced Arduino user,you should consider reading these pages as a refresher.If you are a complete beginner,read carefully!Figure 1-1.Arduino Uno CHAPTER 1?ARDUINO BASICS 2 What is Arduino?Arduino is an o

29、pen source electronics prototyping platform composed of a microcontroller,a programming language,and an IDE.Arduino is a tool for making interactive applications,designed to simplify this task for beginners but still flexible enough for experts to develop complex projects.Since its inception in 2005

30、,more than 200,000 Arduino boards(see Figure 1-1)have been sold,and there is a rapidly increasing number of projects using Arduino as their computing core.The Arduino community is vast,and so is the number of tutorials,reference books,and libraries available.Being open source means that there are Ar

31、duino clones that you can choose for your projects.Advanced Arduino users are constantly developing shields for the available Arduinos as well as completely new Arduino-compatible boards specializing in different tasks.The intentional simplicity of approach to the Arduino platform has permitted an a

32、ccess to physical computing for people who would have never thought of using or programming a microcontroller before the Arduino/Wiring era.A Brief History of Arduino Arduino was born in 2005 at the Interaction Design Institute Ivrea,Italy,as a fork of the open source Wiring Platform.The founders of

33、 the project,Massimo Banzi and David Cuartielles,named the project after Arduin of Ivrea,the main historical character of the town.Hernando Barragn,a student at the same Institute,along with Diego Gonzalez Joven,had developed Wiring in 2003 as his masters thesis,which was supervised by Massimo Banzi

34、 and Casey Reas(one of the initiators of Processing).The idea behind Wiring was to allow an easy introduction to programming and sketching with electronics for artists and designersin a similar mindset in which Casey Reas and Ben Fry had developed Processing some years earlier(you will learn more on

35、 the history of Processing in Chapter 3).Arduino was built around Wiring but developed independently from 2005.The two projects are still very much alive,so everything you will be doing in this book with Arduino could also be done with Wiring boards and IDE.Installing Arduino The first thing you nee

36、d to do if you want to work with Arduino is to buy an Arduino board and a standard USB cable(A-to-B plug if you are using an Arduino Uno).Well,of course you will need more than this if you want to build any reasonable useful application,but for the moment youll just work with the bare essentials.Ard

37、uino runs on Windows,Mac OS X,and Linux,so theres a version of Arduino for you whatever your OS.Go to the Arduino software web site at http:/arduino.cc/en/Main/Software and download the version of the software compatible with your system.If after reading the following sections you are still having t

38、rouble with the installation,you can have more detailed information at http:/arduino.cc/en/Guide/HomePage.Installation on Mac OS X After you have downloaded the.zip file,uncompress it.You can drag the Arduino application to your Applications folder,and then run from there.Pretty easy,right?CHAPTER 1

39、?ARDUINO BASICS 3 If you are using a board older than Arduino Uno(Duemilanove,Diecimila,or older),you need to install the drivers for the FTDI chip on the board.You can find the drivers and the instructions at http:/www.arduino.cc/en/Guide/MacOSX.Installation on Windows First,download the Windows.zi

40、p file and uncompress it.You will see a folder called arduino-1.0.This is your Arduino folder and you need to store it somewhere in the computer from where you can later run the program.The Program Files folder would seem like a reasonable place for the Arduino software,but feel free to choose an al

41、ternative location.You need to install the Arduino drivers before you can start working with your board.Assuming you are installing an Arduino Uno,follow these steps:Plug your board to your computer,and wait for Windows to start the driver installation process.After a while,it will fail.No problem.C

42、lick Start menu and open the Control Panel.Go to System and Security,then System and then Device Manager.Find the Arduino Uno port listed under Ports(COM&LPT).Right-click on it,and choose“Update Driver Software,”selecting“Browse my Computer for Driver Software.”Finally,navigate and select the Arduin

43、o Unos driver file named ArduinoUNO.inf located in the Drivers folder of the Arduino software folder you have just downloaded.Windows will successfully install the board now.Installation on Linux If you are working on Linux,the installation process is slightly different depending on your Linux distr

44、ibution,and unfortunately we dont have the space to detail all of them in this book.You can find all the information you need at http:/www.arduino.cc/playground/Learning/Linux.Testing the Arduino Once you have installed the Arduino software and drivers,you need to perform a little test to make sure

45、that everything is working properly.Arduino has a built-in LED connected to pin 13,so you can actually test the board without having to connect any extra hardware to it.Among the numerous Arduino examples included with the Arduino IDE,there is an example called Blink that makes this built-in LED to

46、blink every second.You will learn more about pins,LEDs,and Arduino code in the following sections,but for the moment,you are going to use this example as a way to find out if your Arduino is communicating properly with your computer and if the sketches can be uploaded to the board.Connect your Ardui

47、no board to your computer and run the Arduino software.On the Tools menu,select Board,and make sure that the right kind of board is selected.In our case,we want to check that the Arduino Uno board is ticked(see Figure 1-2).CHAPTER 1?ARDUINO BASICS 4 Figure 1-2.Board selection After this,select the s

48、erial device under the Serial Port option in your Tools menu.If you are working on Mac OS X,the port should be something with/dev/tty.usbmodem(for the Uno or Mega 2560)or/dev/tty.usbserial(for older boards)in it(see Figure 1-3).If you are using Windows,the port is likely to be COM 3 or higher.Figure

49、 1-3.Serial port CHAPTER 1?ARDUINO BASICS 5 Now everything should be ready for you to upload your first program to your Arduino board.You will be using one of the classic Arduino examples for this test.Click the Open button on your toolbar and navigate to 1.Basics?Blink,as shown in Figure 1-4.Then u

50、pload the sketch by clicking the Upload button(the one with the arrow pointing right on your toolbar).After some seconds,you will get a message saying“Done Uploading”on the status bar,and the LED marked with a capital“L”on your board will start blinking every second.If you succeeded in this,your Ard

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 外文资料合计

版权声明:以上文章中所选用的图片及文字来源于网络以及用户投稿,由于未联系到知识产权人或未发现有关知识产权的登记,如有知识产权人并不愿意我们使用,如有侵权请立即联系:2622162128@qq.com ,我们立即下架或删除。

Copyright© 2022-2024 www.wodocx.com ,All Rights Reserved |陕ICP备19002583号-1 

陕公网安备 61072602000132号     违法和不良信息举报:0916-4228922