Book Image

Arduino Essentials

Book Image

Arduino Essentials

Overview of this book

Table of Contents (17 chapters)
Arduino Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

The Arduino platform has become a de facto standard when talking about microcontrollers. With a wide range of different board models, it can cover a wide spectrum of projects, and its ease of use has made it the preferred platform for those starting out in the microcontroller world.

If you are a hobbyist wanting to develop projects based on Arduino as its main microcontroller platform or an engineer interested in knowing what the Arduino platform offers, then this book is ideal for you.

If you have little or no previous experience in these kinds of tools, this book will help you get a complete view of the platform and the wide peripherals it has to offer by following a carefully designed set of project examples that cover the most important platform features.

Whether you have never written a line of code or you already know how to program in C, you will learn how to work with Arduino from the point of view of both hardware and software thanks to the easily understandable code that accompanies every project that has been developed exclusively with that premise in mind. This will be easy for those who don't have previous experience in programming.

This book was written with the aim to present the Arduino platform to all those wanting to work with Arduino but without any great knowledge of the microcontrollers scene. It will gradually develop a wide set of projects that have been designed to cover the most important aspects of the Arduino platform, from the use of digital and analog inputs and outputs to harnessing the power of interrupts.

What this book covers

Chapter 1, Meeting the Arduino Family, introduces you to the Arduino platform, and the different board models that integrate the Arduino family are presented, noting their common aspects.

Chapter 2, The Arduino Development Environment, shows you how to download, install, and set up a working Arduino integrated development environment and gives a complete explanation of its use and commands.

Chapter 3, Interacting with the Environment the Digital Way, covers the connection and use of digital outputs by dealing with simple devices that can be digitally operated, such as LEDs.

Chapter 4, Controlling Outputs Softly with Analog Outputs, shows you how to manage analog outputs and the use of transistor drivers to deal with high-current devices, such as motors.

Chapter 5, Sensing the Real World through Digital Inputs, explains the use of digital inputs by giving examples of typical applications, such as buttons and switches, and proposes an optical coin detection device that uses an optocoupler.

Chapter 6, Analog Inputs to Feel between All and Nothing, presents analog inputs and their use and offers two new projects: an ambient light meter with a photocell and a motor speed controller by using a potentiometer as an input device.

Chapter 7, Managing the Time Domain, introduces you to the different tools the Arduino library offers to deal precisely with time by building two more projects: a simple timer and a visual and acoustic metronome.

Chapter 8, Communicating with Others, shows you how to connect your Arduino projects to other platforms via serial communication and how to use the Serial Monitor to read from and send data to Arduino. A computer-controlled motor speed driver and a dial thermometer will be built.

Chapter 9, Dealing with Interrupts, shows you how to use interrupts to deal with unexpected events and to understand the difference between having to wait for something to occur and be called when it occurs. We will use a tachograph as a good example to show you all these concepts.

Chapter 10, Arduino in a Real Case – Greenhouse Control, gives you a complete real example of a project that summarizes all the concepts learned throughout the book.

What you need for this book

To work on all the projects shown throughout the book, you will need an Arduino board with its USB cable and a computer running Windows, Mac OS X, or Linux to program your board.

For the electronics circuits that will be built, a breadboard, some jumpers, and an assortment of the most common electronic components will be required.

The complete list of components used all along the different projects is as follows:

  • A bunch of resistors

  • Some LEDs

  • Diodes and small transistors

  • Switches and push buttons

  • An optocoupler or optical switch

  • A photocell

  • A buzzer or small speaker

  • Some potentiometers

  • A thermistor

  • A servomotor

Regarding previous knowledge, there is no need to know how to program because projects come with the entire code ready to run, and I will try throughout the book to introduce and clarify every programming aspect in the code.

Who this book is for

This book can be useful to a wide range of readers. It can be really illustrative to those wanting to be introduced to the development of projects based on microcontrollers and using Arduino in particular for the first time.

It can also be interesting to all those who already know or have worked with microcontrollers previously but haven't tried Arduino and still want to know the basics about this powerful platform by way of a number of projects that will present all important aspects of the platform.

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: "Under Mac OS X, the installation of the application consists only of dragging the application icon to the Applications folder of your computer."

A block of code is set as follows:

void setup() {
  pinMode(transistorBase, OUTPUT);
  // Init serial communication
  Serial.begin(9600);
}

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: "You'll have to go to Control Panel and locate Device 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 from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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.

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.

Disclaimer

Arduino brand, Arduino logo, design of the website, design of the boards, and all the board pictures used in the book are copyright of Arduino SA and cannot be used without formal permission. For information about the right way to use them, please write to .

All references in the book to Arduino should be considered as Arduino™.