Book Image

Internet of Things with Arduino Cookbook

By : Marco Schwartz
Book Image

Internet of Things with Arduino Cookbook

By: Marco Schwartz

Overview of this book

Arduino is a powerful and very versatile platform used by millions of people around the world to create DIY electronics projects. It can be connected to a wide variety of sensors and other components, making it the ideal platform to build amazing Internet of Things (IoT) projects on—the next wave in the era of computing. This book takes a recipe-based approach, giving you precise examples on how to build IoT projects of all types using the Arduino platform. You will come across projects from several fields, including the popular robotics and home automation domains. Along with being introduced to several forms of interactions within IoT, including projects that directly interact with well-known web services such as Twitter, Facebook, and Dropbox we will also focus on Machine-to-Machine (M2M) interactions, where Arduino projects interact without any human intervention. You will learn to build a few quick and easy-to-make fun projects that will really expand your horizons in the world of IoT and Arduino. Each chapter ends with a troubleshooting recipe that will help you overcome any problems faced while building these projects. By the end of this book, you will not only know how to build these projects, but also have the skills necessary to build your own IoT projects in the future.
Table of Contents (14 chapters)
Internet of Things with Arduino Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

Arduino is a small single-chip computer board that can be used for a wide variety of creative hardware projects. The hardware consists of a simple microcontroller board, and chipset. It comes with a Java-based IDE that allows creators to program the board. Arduino is the ideal open hardware platform for experimenting with the world of the Internet of Things. This credit card sized Arduino board can be used via the Internet to make useful and interactive Internet of things projects.

Internet of Things, known as IoT, is changing the way we live and represents one of the biggest challenges in the IT industry. Developers are creating low cost devices that collect huge amounts of data, interact with each other, and take advantage of cloud services and cloud-based storage. Makers all over the world are working on fascinating projects that transform everyday objects into smart devices with sensors and actuators.

This book takes a recipe-based approach, giving you precise examples on how to build IoT projects using the Arduino platform.By the end of this book, you will not only know how to build these projects, but also have the skills necessary to build your own IoT projects in the future.

What this book covers

Chapter 1, Connecting an Arduino to the Web, focuses on getting you started by connecting an Arduino board to the Web. It will lay foundation for the rest of the book.

Chapter 2, Cloud Data Monitoring, deals with one of the most important thing you can do with an Internet of Things project, that is, send data online so that it can be stored, retrieved later, and plotted inside a nice dashboard.

Chapter 3, Interacting with Web Services, tells us how to use existing web services to build amazing Internet of Things projects with our Arduino board.

Chapter 4, Machine-to-Machine Interactions, focuses on something different: making two (or more) Arduino boards talk to each other and interact with each other, without any human intervention. This is known as machine-to-machine communications, which is a very exciting field of the IoT. Let's dive in!

Chapter 5, Home Automation Projects, tells us how to apply what we learned so far in this book to the home automation field. We are going to use the Arduino board to build several home automation projects that will be accessible from anywhere in the world & able to communicate with cloud services.

Chapter 6, Fun Internet of Things Projects, deals with how to build a clock that gets the time from the cloud, but also an actual GPS tracker that will display the position of your Arduino project on Google Maps!

Chapter 7, Mobile Robot Applications, tells us how to create our own mobile robot based on Arduino. Finally, to end this book about the Internet of Things, we are going to learn how to control this robot from anywhere in the world.

What you need for this book

All the projects of this chapter and this book are using Arduino MKR1000 board. This is an Arduino board released in 2016 that has an on-board WiFi connection. You can make all the projects of the book with other Arduino boards, but you might have to change part of the code

Who this book is for

This book is primarily for tech enthusiasts and early IoT adopters who would like to make the most of IoT and address the challenges encountered while developing IoT-based applications with Arduino. This book is also good for developers with basic electronics knowledge who need help to build successful Arduino projects.

Sections

In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

if (millis() - lastConnectionTime > postingInterval) {

    // Measure light level
    int sensorData = analogRead(A0);

    // Send request
    httpRequest(sensorData);
  }

Any command-line input or output is written as follows:

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
     /etc/asterisk/cdr_mysql.conf

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "To do that, open the Arduino boards manager by going to Tools | Boards | Boards Manager."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Internet-of-Things-with-Arduino-Cookbook. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.