Learn Arduino Prototyping in 10 days
()
About this ebook
- A carefully designed 10-day crash course, covering major project/device types, with 20+ unique hands-on examples
- Get easy-to-understand explanations of basic electronics fundamentals and commonly used C sketch functions
- This step-by-step guide with 90+ diagrams and 50+ important tips will help you become completely self-reliant and confident
This book is a beginner’s crash course for professionals, hobbyists, and students who are tech savvy, have a basic level of C programming knowledge, and basic familiarity with electronics, be it for embedded systems or the Internet of Things.
Related to Learn Arduino Prototyping in 10 days
Related ebooks
Building Wireless Sensor Networks Using Arduino Rating: 4 out of 5 stars4/5Learning C for Arduino Rating: 0 out of 5 stars0 ratingsArduino Robotic Projects Rating: 4 out of 5 stars4/5Arduino Networking Rating: 4 out of 5 stars4/5Arduino Electronics Blueprints Rating: 4 out of 5 stars4/5Arduino by Example Rating: 4 out of 5 stars4/5Arduino Home Automation Projects Rating: 3 out of 5 stars3/5Arduino for Secret Agents Rating: 4 out of 5 stars4/5Arduino Essentials Rating: 5 out of 5 stars5/5Arduino Android Blueprints Rating: 0 out of 5 stars0 ratingsProgramming Arduino with LabVIEW Rating: 3 out of 5 stars3/5Internet of Things with Arduino Blueprints Rating: 0 out of 5 stars0 ratingsArduino Solutions Handbook: Design interesting DIY projects using Arduino Uno, C and C++ (English Edition) Rating: 0 out of 5 stars0 ratingsRaspberry Pi Home Automation with Arduino - Second Edition Rating: 0 out of 5 stars0 ratingsDigital Electronics with Arduino: Learn How To Work With Digital Electronics And MicroControllers Rating: 5 out of 5 stars5/5Arduino Programming Projects: Learn how to build cool, fun, and easy Arduino Projects (English Edition) Rating: 0 out of 5 stars0 ratingsRaspberry Pi LED Blueprints Rating: 0 out of 5 stars0 ratingsBuilding Smart Homes with Raspberry Pi Zero Rating: 0 out of 5 stars0 ratingsArduino: A Beginner's Guide to Arduino Programming Rating: 3 out of 5 stars3/5Raspberry Pi Server Essentials Rating: 0 out of 5 stars0 ratingsRaspberry Pi Super Cluster Rating: 0 out of 5 stars0 ratingsSmart Internet of Things Projects Rating: 4 out of 5 stars4/5Learning Raspberry Pi Rating: 0 out of 5 stars0 ratingsArduino BLINK Blueprints Rating: 0 out of 5 stars0 ratingsRaspberry Pi Robotics Essentials Rating: 0 out of 5 stars0 ratingsARDUINO PROGRAMMING FOR BEGINNERS: Tips and Tricks for the Efficient Use of Arduino Programming Rating: 0 out of 5 stars0 ratingsInternet of Things with Intel Galileo Rating: 0 out of 5 stars0 ratingsMastering BeagleBone Robotics Rating: 5 out of 5 stars5/5Building a Home Security System with Raspberry Pi Rating: 0 out of 5 stars0 ratings
Hardware For You
Electrical Engineering | Step by Step Rating: 0 out of 5 stars0 ratingsCreative Selection: Inside Apple's Design Process During the Golden Age of Steve Jobs Rating: 5 out of 5 stars5/5Programming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5Chip War: The Fight for the World's Most Critical Technology Rating: 4 out of 5 stars4/5Linux All-In-One For Dummies Rating: 2 out of 5 stars2/5Dancing with Qubits: How quantum computing works and how it can change the world Rating: 5 out of 5 stars5/5CompTIA A+ Complete Review Guide: Exam Core 1 220-1001 and Exam Core 2 220-1002 Rating: 5 out of 5 stars5/5Raspberry Pi Electronics Projects for the Evil Genius Rating: 3 out of 5 stars3/5iPhone 12, iPhone Pro, and iPhone Pro Max For Senirs: A Ridiculously Simple Guide to the Next Generation of iPhone and iOS 14 Rating: 0 out of 5 stars0 ratingsCompTIA A+ Complete Review Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 5 out of 5 stars5/5iPhone X Hacks, Tips and Tricks: Discover 101 Awesome Tips and Tricks for iPhone XS, XS Max and iPhone X Rating: 3 out of 5 stars3/5iPhone For Dummies Rating: 0 out of 5 stars0 ratingsmacOS Sonoma For Dummies Rating: 0 out of 5 stars0 ratingsGoing iPad (Third Edition): Making the iPad Your Only Computer Rating: 5 out of 5 stars5/5Apple Watch For Dummies Rating: 0 out of 5 stars0 ratingsBuild Your Own PC Do-It-Yourself For Dummies Rating: 4 out of 5 stars4/5Troubleshooting and Maintaining Your PC All-in-One For Dummies Rating: 5 out of 5 stars5/5Upgrading and Fixing Computers Do-it-Yourself For Dummies Rating: 4 out of 5 stars4/5Chromebook For Dummies Rating: 5 out of 5 stars5/5Raspberry Pi for Secret Agents - Second Edition Rating: 3 out of 5 stars3/5Arduino for Secret Agents Rating: 4 out of 5 stars4/5MacBook For Dummies Rating: 4 out of 5 stars4/5Exploring Arduino: Tools and Techniques for Engineering Wizardry Rating: 4 out of 5 stars4/5ESP8266 Internet of Things Cookbook Rating: 5 out of 5 stars5/5Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems Rating: 4 out of 5 stars4/5Raspberry Pi Cookbook for Python Programmers Rating: 0 out of 5 stars0 ratings
Reviews for Learn Arduino Prototyping in 10 days
0 ratings0 reviews
Book preview
Learn Arduino Prototyping in 10 days - Kallol Bosu Roy Choudhuri
Learn Arduino Prototyping in 10 days
Your crash course to build innovative devices
Kallol Bosu Roy Choudhuri
BIRMINGHAM - MUMBAI
< html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
http://www.w3.org/TR/REC-html40/loose.dtd
>
Learn Arduino Prototyping in 10 days
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: June 2017
Production reference: 1270617
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78829-068-5
www.packtpub.com
Credits
About the Author
Kallol Bosu Roy Choudhuri is a passionate Arduino prototype creator. He is a professional computer science engineer, an IT enterprise architect, and thought leader with several years of industry experience. He provides expert consultancy on matters of software architecture and works on many exciting and innovative IoT devices and solutions.
The author comes with more than 14 years of industry experience and works passionately with an entrepreneurial spirit. He practices as a senior architect in the Enterprise Architecture Group at Atos India, and works on many exciting and innovative engagements.
He specializes in architecture and design, performance engineering, legacy modernization, IT transformations, assessments, strategy, presales, and consulting. Prior to Atos, he has worked for other multinational software companies such as Tata Consultancy Services and Cognizant Technology Solutions and has served many Fortune 500 customers at their site offices in Europe and North America.
I would like to thank my wife, daughter, family, and close friends who have helped me in completing this book.
About the Reviewers
Aaron Srivastava is a software engineer for Fujifilm Medical Systems. He has years of experience building Arduino projects and actively looks for new projects to implement.
Fangzhou Xia is currently a PhD student in the Mechanical Engineering (MEng) department at Massachusetts Institute of Technology (MIT). He received his ME bachelor's degree at University of Michigan (UM) and Electrical and Computer Engineering (ECE) bachelor's degree at Shanghai Jiao Tong University (SJTU). His areas of interest in mechanical engineering include system control, robotics, product design, and manufacturing automation. His areas of interest in electrical engineering and computer science include web application development, embedded system implementation, data acquisition system setup, and machine learning applications.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1788290682 .
If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Boot Camp
Organization of the chapters
How to use the book
Things you will need to get started
Things you will learn in this book
Summary
The Arduino Platform
Introduction to the Arduino platform
Overview of Arduino prototyping
Setting up the Arduino board
Arduino program structure and execution
Understanding the first Arduino sketch
Compiling, loading and running a sketch
Commonly used in-built C sketch functions
Digital input and output
Analog input and output
Try the following
Things to remember
Summary
Day 1 - Building a Simple Prototype
The three LED project
Rationale for using a resistor
The Piezo Buzzer project
Using transistors
Using diodes
LED with a push button
Try the following
Things to remember
Summary
Day 2 - Interfacing with Sensors
Types of sensor components
Basic sensor components
Using a basic sensor - photodiode
Using a basic sensor - photo resistor (LDR)
Using integrated sensor modules
Using a temperature sensor module (with an Arduino library)
Understanding sensor module datasheets
Installing the sensor-specific Arduino library
Sensor interfacing sketch
Viewing the program output
Using a soil moisture sensor module (without an Arduino library)
Soil moisture sensor circuit
Soil moisture sensor sketch
Future inspiration
Try the following
Things to remember
Summary
Day 3 - Building a Compound Device
Compound devices
Building a smoke detector
Smoke detector - Digital I/O method
Smoke detector sketch - Digital I/O method
Smoke detector (analog I/O method)
Smoke detector sketch (analog I/O method)
Local storage with SD card modules
Try the following
Things to remember
Summary
Day 4 - Building a Standalone Device
Standalone devices
External power supply options
Determining power source capacity
Building a distance measurement device
Distance measurement device circuit
Distance measurement device sketch
Operating the distance measurement device
Finishing touches
Try the following
Things to remember
Summary
Day 5 - Using Actuators
About actuators
Special considerations while using DC motors
A basic DC motor prototype
Basic DC motor sketch
DC motor speed control - PWM method
DC motor speed control sketch
Using Arduino interrupts
Interfacing with a servo motor
Servo motor control circuit
Servo motor control sketch
Future inspiration
Try the following
Things to remember
Summary
Day 6 - Using AC Powered Components
Using relays with AC powered devices
Part 1 - Simulation of sound activated light bulb controller
The sound-activated device sketch
Part 2 - Actual prototype for sound activated light bulb controller
Future inspiration - Automatic room lights
Try the following
Things to remember
Summary
Day 7 - The World of Transmitters, Receivers, and Transceivers
Understanding Infrared communications
Infrared communication frequency
Infrared communication protocol
Hacking into an existing remote control
Building an Infrared receiver device
The Arduino Infrared library
Using IR receiver TSOP series IR receivers
Using IR receiver SM0038
Building an Infrared transmitter device
Using an IR transmitter LED
Controlling Arduino projects
Transceivers
Try the following
Things to remember
Summary
Day 8 - Short Range Wireless Communications
Building a radio frequency device
Using the nRF24L01 transceiver module
Wiring nRF24L01 with Arduino
Downloading the open source RF library for Arduino
Transmitting radio frequency waves
Receiving radio frequency signals
Testing the RF transmitter-receiver pair
Bluetooth communications
Using the HC-05 Bluetooth module
Connecting HC-05 to Arduino Uno
HC-05 sketch
Communicating with the HC-05 prototype
Try the following
Things to remember
Summary
Day 9 - Long-Range Wireless Communications
The GSM module
AT commands
GSM module interfacing with Arduino Uno
GSM module sketch
Forest fire early warning system - Inspiration
Try the following
Things to remember
Summary
Day 10 - The Internet of Things
Introduction to IOT
IoT edge devices
IoT Cloud platforms
IoT cloud configuration
Step 1 - IoT cloud registration
Step 2 - Configuring an edge device channel
Edge device setup
Building the edge device
Edge device sketch
Smart retail project inspiration
IOT project considerations
Try the following
Things to remember
Summary
Preface
This book has been crafted to serve as a quick crash course for becoming well acquainted with the Arduino platform in just 10 days. The primary focus of the book is to empower the reader to use the Arduino platform by applying basic fundamental principles and be able to apply those fundamental principles for building almost any type of physical device.
The uniqueness of the book lies in its practical approach and pedagogy. This book does not try to explain all the possible projects that can be achieved with the Arduino platform, but instead establishes the fundamental types of projects and techniques using which readers will be able to build any device prototype on their own.
The book is intended to serve as a beginner's crash course for professionals, hobbyists, and students who are tech savvy, have a basic level of C programming knowledge and basic familiarity with electronics, be it for embedded systems or for the Internet of Things. The book introduces some basic electronics concepts and useful programming functions that are essential for use with the Arduino platform. It will save the reader hours of research work, by presenting all the required knowledge in a crisp and concise package--almost everything to get started with in one single place!
While writing this book, great care has been taken to present the fundamental principles in a pragmatic and scientific manner and guide the audience through a graded series of chapters, based on the application of fundamental principles and increasing level of complexity. So by the end of the book, the readers will feel confident about taking on new device prototyping challenges, completely on their own.
What this book covers
The 10-day journey includes various practical aspects of the Arduino platform, presented in a clear and concise manner. Each chapter in this book is intended to correspond to a day's worth of study. Each chapter introduces and demonstrates unique practical fundamentals through hands-on examples; that must be assimilated to become self-reliant on the topic of Arduino prototyping.
Chapter 1, Boot Camp, welcomes you with this Boot Camp chapter and proceeds to guide you on how to use the book. It lists the hardware components and devices that must be procured in order to follow through the learning path outlined in the chapters.
Chapter 2, The Arduino Platform, introduces you to the Arduino platform. First, we will see what the Arduino platform is all about. Then, there will be quick introductory topics regarding fundamentals for getting started. This will be followed by a quick but in-depth look at the first Arduino code.
Chapter 3, Day 1 - Building a Simple Prototype, starts your journey by learning to build a simple device prototype. This will be your first hardware-software integrated prototype. Two easy-to-work prototypes with examples have been chosen for this chapter. The first example will be to emit light patterns. While the second example will be to emit basic sounds and play a musical tone.
Chapter 4, Day 2 - Interfacing with Sensors, describes how to work with sensors in general. You might have seen automatic doors that slide open once somebody goes near the door. These automatic systems are usually based on sensors, microcontrollers and embedded software. In this chapter, we will learn the fundamental technique of interfacing with sensors in general.
Chapter 5, Day 3 - Building a Compound Device, takes a step ahead by explaining how to build compound device prototypes using the Arduino platform. Compound devices are a very important topic as real-world devices are usually composed of multiple devices integrated with a central microcontroller. This chapter will provide a hands-on example to building a compound device.
Chapter 6, Day 4 - Building a Standalone Device, facilitates building real-world device prototypes. Independent power sources, not from a computer’s USB port, will be used so that the device prototype can work without being connected to a computer. In this chapter, we will learn how to make standalone devices that have their independent power sources, a power switch, and a container.
Chapter 7, Day 5 - Using Actuators, proceeds to work on our first project that uses diodes and transistors with a DC motor (an example of an actuator) powered from an independent battery-based power source. This is an advanced level chapter and is designed with a lot of concepts and components, which builds upon the knowledge gathered so far from the previous chapters.
Chapter 8, Day 6 - Using AC Powered Components, presents a unique presentation for introduction to the fundamentals of interfacing and controlling AC-powered electrical devices with the Arduino platform. This topic was specifically chosen for a wholesome completeness of the 10-day crash course.
Chapter 9, Day 7 - The World of Transmitters, Receivers, and Transceivers, reveals an exciting chapter on infrared transmitters and receivers. As you read through, this chapter will unravel and demystify some embedded world techniques used for transmitting and receiving data from one device to another using wireless signals.
Chapter 10, Day 8 - Short Range Wireless Communications, introduces us to hands-on techniques used for transmitting and receiving data from one device to another using wireless radio signals (RF and Bluetooth). We will start learning wireless communications using Radio Frequency (RF).
Chapter 11, Day 9 - Long Range Wireless Communications, provides a fascinating introduction to the exciting world of telephony. In this chapter, we will learn how to use a GSM module with the Arduino platform.
Chapter 12, Day 10 - The Internet of Things, explains how to use the Arduino platform in the fast emerging Internet of Things world. All of us have heard about the buzzword IoT (Internet of Things). The Internet of Things is a growing network of physical devices that can connect to the existing Internet and exchange data with other devices.
All the chapters have working Arduino code and circuit building specifications and instructions.
What you need for this book
All the examples in this book use the Arduino Uno R3 platform. This version of the Arduino board was chosen because it is the most often recommended microcontroller board for learning hardware/software prototyping. Once the techniques have been mastered, the reader will be able to adapt the examples to other development boards and devices as well.
It is expected that the reader possesses the following basic skills that will be required for engaging in this 10-day Arduino prototyping crash course:
Basic knowledge of C programming (simple variables, functions, if statements, for loops and functions will suffice, nothing fancy is needed) is required to follow through the chapters in this book.
Familiarity with basic electronic components (resistors, diodes, transistors, breadboards, circuits, and so on). You do not need to know the fundamentals of how these components work; the book will explain everything ground up starting from fundamental concepts.
Each chapter in this book uses many hardware components and has a list of hardware parts required to build the example prototypes in the chapter. In order to provide you with a comprehensive experience; a concise list of the hardware components that you will need, has been provided in Chapter 1, Boot Camp.
Who this book is for
Arduino prototyping typically demands two general skills. The first skill is familiarity with basic C programming, while the second aspect is familiarity with electronic components. Familiarity with C language is required because the Arduino programs (known as Sketches) are written using C. While building the Arduino device prototypes will require some familiarity with basic electronics components.
This book has been written in a balanced manner. The book is for readers who know basic C programming (variables, functions, if statements, and for loops will suffice), and want to quickly jump start building device prototypes on the Arduino platform, without having to read through time-consuming documentation, tutorials, and tireless research. Additionally, the book assumes that the reader has very little familiarity with electronics and explains everything from scratch. All you need is your ''will'' to learn and the rest will be taken care by this book!
This book has been designed for the following audience:
For an enthusiastic DIY (Do-It-Yourself) hobbyist (from schools to colleges to professionals from any walk of life)--basically anyone who wants to learn how to make microcontroller-based electronics devices.
It can be used by technologists and engineers who want to upskill themselves in a very rapid manner and start working in the field of IoT (Internet of Things) or get introduced to Embedded Systems device prototyping.
It can be used by university and college students as well as teachers and lecturers as part of their practical lab courseware for microcontroller-based subjects.
It is also suitable for higher education/library material for embedded systems and/or practical engineering (computer science, electronics, electrical, instrumentation, telecommunication, and allied disciplines) lab courses.
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: The setup() function runs only once every time the board is either reset or powered up.
A block of code is set as follows: