Uh-oh, it looks like your Internet Explorer is out of date.
For a better shopping experience, please upgrade now.

Beginning NFC: Near Field Communication with Arduino, Android, and PhoneGap
NOOK Book(eBook)
Overview
Jump into the world of Near Field Communications (NFC), the fast-growing technology that lets devices in close proximity exchange data, using radio signals. With lots of examples, sample code, exercises, and step-by-step projects, this hands-on guide shows you how to build NFC applications for Android, the Arduino microcontroller, and embedded Linux devices.
You’ll learn how to write apps using the NFC Data Exchange Format (NDEF) in PhoneGap, Arduino, and node.js that help devices read messages from passive NFC tags and exchange data with other NFC-enabled devices. If you know HTML and JavaScript, you’re ready to start with NFC.
- Dig into NFC’s architecture, and learn how it’s related to RFID
- Write sample apps for Android with PhoneGap and its NFC plugin
- Dive into NDEF: examine existing tag-writer apps and build your own
- Listen for and filter NDEF messages, using PhoneGap event listeners
- Build a full Android app to control lights and music in your home
- Create a hotel registration app with Arduino, from check-in to door lock
- Write peer-to-peer NFC messages between two Android devices
- Explore embedded Linux applications, using examples on Raspberry Pi and BeagleBone
Product Details
ISBN-13: | 9781449324117 |
---|---|
Publisher: | O'Reilly Media, Incorporated |
Publication date: | 01/14/2014 |
Sold by: | Barnes & Noble |
Format: | NOOK Book |
Pages: | 246 |
File size: | 4 MB |
About the Author
Tom Igoe teaches courses in physical computing and networking at the Interactive Telecommunications Program in the Tisch School of the Arts at New York University. In his teaching and research, he explores ways to allow digital technologies to sense and respond to a wider range of human physical expression. He is the author of Making Things Talk and Getting Started with RFID, and he co-authored Physical Computing: Sensing and Controlling the Physical World with Computers with Dan O’Sullivan. He is a contributor to MAKE magazine and a co-founder of the Arduino open source micro-controller project. He hopes someday to visit Svalbard and Antarctica.
Don Coleman is a lifelong engineer who has come full circle; from mechanical to software and now to hardware, bridging the gap between all disciplines. Along the way he has created systems varying from environmental monitoring mesh networks to wearable tech. Don is a seasoned PhoneGap developer embracing it since inception and has spoken across the country about the benefits and advantages of using PhoneGap. A true maker at heart - everything in this book, is running somewhere in his home. As the Director of Consulting for Chariot Solutions, a software consulting company near Philadelphia, PA, he works with teams and clients to reinvent their existing technology and lay the groundwork for the future.
Brian Jepson is a book editor with MAKE, a hacker, and co-organizer of Providence Geeks and the Rhode Island Mini Maker Faire. He’s also a geek-at-large for AS220, a nonprofit arts center in Providence, Rhode Island. AS220 gives Rhode Island artists uncensored and unjuried forums for their work and also provides galleries, performance space, fabrication facilities, and live/work space.
Table of Contents
1 Introduction 1
Who This Book Is For 2
Recommended Reading 2
What's Covered in This Book 3
What You'll Need 4
Hardware 4
Software 6
Other Useful NFC Apps 7
Conventions Used in This Book 8
Using Code Examples 8
Safari Books Online 9
How to Contact Us 9
Acknowledgments 10
2 NFC and RFID 11
What's RFID? 11
What's NFC? 12
How RFID Operates 13
RFID Standards 13
How NFC Operates 14
NFC Data Exchange Format (NDEF) 14
The Architecture of NFC 15
NFC Tag Types 17
Where to Get Tags 18
Device-to-Tag Type Matching 19
What You Can Do with NFC 20
Conclusion 21
3 Getting Started with PhoneGap and the PhoneGap-NFC Library 23
Why Android? 23
Hello, World! Your First PhoneGap App 24
Setting Up the Development Environment 24
Creating a PhoneGap Project 29
The Important Files 33
A Simple Locator App 34
PhoneGap Meets NFC: NFC Reader 40
Installing the NFC Plug-In 41
Writing the NFC Reader App 42
Troubleshooting 46
Conclusion 46
4 Introducing NDEF 49
NDEF Structure 49
Type Name Format 51
Payload Type 51
Payload Identifier 53
Payload 53
Record Layout 53
Record Header 54
How Big Can an NDEF Message Be? 55
Record Chunking 56
Additional Info 56
NDEF in Practice 56
A Tag Writer Application: Foursquare Check-In 61
Writing an NDEF Record to a Tag 62
Writing Different Record Types 66
PhoneGap-NFC NDEF Helper Functions, Summarized 72
Conclusion 73
5 Listening for NDEF Messages 75
PhoneGap-NFC's Event Listeners 75
An NDEF Reader Application 77
Listening for Multiple Events 78
Reading the NDEF Messages 81
Filtering Tags Using Record Types 84
Filtering Using MIME-Types 86
Android's Tag Dispatch System 89
Types of Intents 89
Android Application Records 93
Conclusion 93
6 An NFC Application in Practice 95
The User Interaction 97
Getting to Know Hue, Getting to Know All About Hue 98
The Hue Data Format 101
The Hue's REST API 104
The Android Shell 104
The PhoneGap Media API 105
The User Interface 106
The Application Code 109
Housekeeping Functions 110
Global Event Handlers 112
Hub Communication Functions 114
Lighting User Interface Event Handlers 118
Music User Interface Event Handlers 121
NFC Event Handlers 126
Enabling Background Dispatch 129
Conclusion 129
7 Introduction to Arduino and NFC 131
Digital Meets Physical: Arduino 131
The Hardware Heart of NFC 133
The Arduino Development Environment 133
Serial Communication 137
Installing Arduino Libraries 138
The Arduino NDEF Library 141
Reading NDEF in Arduino 142
Writing NDEF in Arduino 145
A Microcontroller NFC Application: Hotel Key Cards 146
The Interaction and Data Format 148
The Arduino NDEF Writer Device 150
The Arduino NDEF Reader and Door Lock Device 157
A Browser Interface for the Arduino NDEF Writer Device 165
Node.js Application Specification: package.json 165
The Client-Side Code 166
The Server-Side Code 167
Conclusion 172
8 Peer-to-Peer Exchange 173
Sending Peer-to-Peer Messages in PhoneGap 175
Receiving Peer-to-Peer Messages in PhoneGap 183
Handover 185
Static Handover 186
Sending Handover Messages in PhoneGap 186
Peer-to-Peer Using Arduino 192
Card Emulation 193
Conclusion 194
9 NFC on Embedded Systems 195
Introduction to Embedded Linux Devices and Package Managers 196
Network, USB, and NFC 196
NFC on Embedded Linux: The Overview 199
Housekeeping Details 200
Get Comfortable with Your Editing Workflow 200
Know Your Package Manager 200
Set the Date and Time 201
Make a Downloads Directory 202
BeagleBone Peculiarities 202
Raspberry Pi Peculiarities 202
Installing the Tools for NFC 203
Installing the Libusb Compatibility Library 204
Installing libnfc 204
Testing the Installation on Raspberry Pi or BeagleBone 205
Installing libfreefare 205
Libnfc and Libfreefare Command Line Tools 206
NDEF Reading and Writing in Node.js 208
Web Interface for Tag Writer 212
Tags Controlling Physical Output 214
BeagleBone Version 214
Raspberry Pi Version 217
Conclusion 221
A NFC Specification Codes 223
Index 227