Distributed Network Data
Alasdair Allan
Kipp Bradford
Published by Make
Beijing Cambridge Farnham Kln Sebastopol Tokyo
Special Upgrade Offer
If you purchased this ebook directly from oreilly.com, you have the following benefits:
DRM-free ebooksuse your ebooks across devices without restrictions or limitations
Multiple formatsuse on your laptop, tablet, or phone
Lifetime access, with free updates
Dropbox syncingyour files, anywhere
If you purchased this ebook from another retailer, you can upgrade your ebook to take advantage of all these benefits for just $4.99. to access your ebook upgrade.
Please note that upgrade offers are not available from sample content.
Preface
The gap between having an idea and being able to build a hardware solution is narrowing. The ability to prototype, build, and deploy simple sensor platforms is rapidly leading to an exponential growth in the amount of data available.
Over the next few years, day-to-day computing will become increasingly invisible, dissipating out into the environment. This is already starting to happen, without you noticing, as the physical interfaces to the new smart devices look almost identical to their dumb counterparts.
You will soon begin to move in a sea of data: your movements tracked and your environment measured and adjusted to your preferences, all without your intervention.
At the OReilly Strata Conference on data science in Fall 2012 in New York, we gave the attendees a taste of the super-connected world thats ahead of all of us. By instrumenting the conference environment with basic off-the-shelf sensors and mesh networking, we observed and reported, and gave the attendees a taste of their lives in a more measured and quantified world.
This book will allow you to do likewise.
Bill of Materials
Before we get started building our sensor mote well need to gather all the components well need together in one place. In the hardware business this is generally called the bill of materials. Initially well make use of the following components:
Later in the book well expand our sensor mote to communicate over XBee (802.15.4) networking and if you want to follow along youll need to add the following additional components:
XBee USB Explorer, $24.95
Arduino Wireless SD Shield, $19.95
XBee Series 1 Radio (2), $22.95
Who Should Read this Book?
This book provides an introduction to the topic of how to build and deploy a distributed sensor network. As part of that, well make extensive use of the Arduino open-source electronics prototyping platform. This is hardware hacking for data scientists. If youre a designer familiar with data visualization or a programmer with in interest in data, and want to learn about how to build simple sensor networks to gather data about your environment, then this book is for you.
What You Should Already Know?
This book is intended for data scientists who want to learn how to work with external hardware. It assumes some basic computing and programming knowledge, but no real expert knowledge is assumed.
Little or no familiarity with the Arduino platform is expected. However, if you are totally unfamiliar with the Arduino platform, you might want to take a look at Getting Started with Arduino by Massimo Banzi (OReilly).
What Will You Learn?
This book will guide you through building a distributed sensor network and gathering data, and will show you how to do some simple real-time analysis and visualization. It will walk you through your first hardware prototypes, show you how to improve them, and teach you how to build a network of sensors and begin taking data.
Whats In This Book?
This chapter is intended for programmers new to Arduino. It will introduce you to the platform and walk you through the hardware equivalent of Hello World: the blinking LED. Well also discuss how to use the serial connection between the Arduino and your development machine.
This chapter will walk you through wiring up a breadboard to prototype a circuit, and using the Arduino to read values from a sensor.
This chapter provides a hands-on tutorial to adding a second sensor to the breadboard designthis one an infared motion detector (PIR).
This chapter is a guide to adding yet another sensor to your mote a microphone. It also walks you through added diagnostic LEDs and modifying your Arduino sketch to output CSV through the serial console.
This chapter will explain how to use Fritzing, a program that lets us convert our circuit design into a direct graphical representation on the computer in preparation for building an actual circuit board. It also introduces theArduino prototyping shield and shows you how to turn your sketch into a professional circuit board.
After explaining the fundamental concepts of power and ground, this chapter takes a look at Arduino pins and how to use them for power, discussing the limitations of this approach as well as some particular use cases.
This chapter discusses eliminating the USB cable and replacing it with a wireless connection to the Internet using XBees.
This chapter provides a basic overview of how to handle multiple sensor platforms and request data using a single master multiple slave configuration, as well as a multi-master system, using zigbee protocols.
This chapter will show you how to take the data your sensor network has collected and begin to visualize it using Processing.
This chapter gives you some more data visualization options with an introduction to LabVIEW.
This chapter provides a collection of pointers to more advanced material on the topics we covered in the book, and material covering some of those topics that we didnt manage to talk about in this book.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Note
This icon signifies a tip, suggestion, or general note.
Warning
This icon signifies a warning or caution.
Using Code Examples
This book is here to help you get your job done. In general, if this book includes code examples, you may use the code in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.