What You Will Learn
What You Will Learn
Have a look around you and try to identify devices that can sense something about their
environment. No-matter if you are at work, at your home, or next to a bookshelf, I am sure you
will identify many: Temperature sensors, Gas sensors, Thermostats, infrared sensors (used in
automatic doors), etc. How many of these devices can communicate with the Internet and
interact with Web-based applications? Probably none or just a few of them, but this is soon going
to change. The evolution of communication technologies is bringing Internet connection to
devices at lower cost, less power consumption and smaller sizes, making devices able to be parts
of the so called Internet of Things: a global network of smart devices that can sense and interact
with their environment using the Internet for their communication and interaction with users
and other systems.
The Arduino is a programmable device that can sense and interact with its environment. It is
a great open source microcontroller platform that allows hobbyists and electronic enthusiasts to
build quickly, easily and with low cost small automation and monitoring projects. It has been so
widely adopted that dozens of vendors build several variations of it and various extensions that
provide features like wired and wireless connectivity to the Internet. In addition, there is great
software support by the open source community: coding an embedded device has never been so
easy.
I consider Arduino the best way to be introduced into the Internet of Things (IoT) concept.
Building Internet of Things with the Arduino aims to give you exactly all the knowledge you
need to start with your own IoT projects.
What
You
Will
Learn
This book will provide you with all the information you need to design and create your own IoT
applications using the Arduino platform. More specifically, you will learn:
About the Internet of Things and Cloud Computing concepts
About open platforms that allow you to store your sensor data on the Cloud (like
Pachube and Nimbits)
The basic usage of Arduino environment for creating your own embedded projects at
low cost
How to connect your Arduino with your Android phone and send data over the Internet
How to connect your Arduino directly to the Internet and talk to the Cloud
How to reprogram your Arduino microcontroller remotely through the Cloud
Knowledge
Required
This book assumes that you are already familiar with the general principles of software
programming and also familiar with programming in C/C++ and Java. Especially for the latter, it
is also assumed that you are familiar with using and creating projects in Eclipse Java IDE.
If you are a total beginner in programming you can still use the book but first you are advised
to study any of the following introductory books in Arduino, Java and Android programming:
Java 7 for Absolute Beginners, by Jay Bryant
Beginning Android, by Mark Murphy
Chapters 6 and 8 also describe projects that include Android code. So you also need to be
familiar with Android programming and how to set up the Eclipse IDE for Android
development.
In addition, you need to be familiar with the basics of electronics and how you can use a
breadboard to connect various electronic components together.
Hardware
For all the projects covered in this book you need at least one Arduino board. You can get either
an official Arduino board (see Chapter 4 for more details) or an Arduino-compatible clone (like
in Figure 1). In order to program the board you will need a computer (Windows, Mac or Linux),
and a USB cable (type depends on the board you have).
Figure 1. On the left: An official Arduino Uno board (image courtesy of Sparkfun). On the right: The
Seeeduino v2.21 compatible with the Arduino Uno (image courtesy of Seeedstudio)
In addition, the various projects covered in this book require various electronic components
(such as resistors and capacitors), sensors (like temperature and humidity sensors) and actuators
(mostly a relay switch).
For the communication with an Android phone you will need either a capable board that
connects directly with your phone over USB or a Bluetooth enabled board (more details for both
ways on Chapter 6).
For communicating your Arduino directly with the Internet you can use an Ethernet-enabled
Arduino board or a WiFi shield (more details in Chapter 7).
All essential parts and the way to connect them together are listed in the project description
of each chapter. You are also advised to use a breadboard (see Figure 2) and jumper wires (male-
to-male) (see Figure 3) in order to easily connect the various components with each other and
with the Arduino.
Places where you can buy online all the components featured in the projects of this book are
the following:
Sparkfun electronics, http://www.sparkfun.com
Seeedstudio electronics, http://www.seeedstudio.com
Both electronic stores ship worldwide. Of course you are free to search online for alternative
stores that provide the materials you will need (EBay can also another good source).
Figure 3. A male-to-male jumper wire. It can be easily connected to the breadboard and the Arduino
pins (image courtesy of Sparkfun).
Software
In order to program your Arduino board you will need the Arduino development environment
(or IDE) that you can freely download from the Arduino web site
(http://arduino.cc/en/Main/Software) and use it on your Windows, Mac or Linux
computer. Detailed instructions on how to setup and use the IDE are provided in Chapter 4.
Some of the projects in the book also teach you how to create standalone Java applications
and Android-based applications that communicate with your Arduino. In those cases you will
need to have installed and be familiar with the Eclipse Java Development Environment
(http://www.eclipse.org).
The
Code
As of writing this book, Arduino has released the v1.0 that introduces some new features and
changes in the way code and especially libraries are written (compared to previous IDE version
like 022). The Arduino code (aka sketches) provided in the book can be run and compiled under
v1.0. Many of the sketches relay on external libraries that were built for previous Arduino
versions. All libraries have been ported to v1.0 and are included in the source code that can be
downloaded from the books online code repository found at:
http://www.buildinginternetofthings.com. The code repository will be frequently updated
reflecting any future changes in the Arduino IDE, the IoT platforms presented in the book and
potential improvements.
Contacting
the
Author
You can contact me for questions, comments, corrections and suggestions at
[email protected]
I hope you will enjoy reading this book as much as I did writing it. Much more I hope the
projects described will guide you in designing and building your own projects!
Charalampos Doukas
Athens, February 2012