Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learn Arduino Prototyping in 10 days
Learn Arduino Prototyping in 10 days

Learn Arduino Prototyping in 10 days: Build it, test it, learn, try again!

Arrow left icon
Profile Icon Bosu Roy Choudhuri
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (13 Ratings)
Paperback Jun 2017 288 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Bosu Roy Choudhuri
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (13 Ratings)
Paperback Jun 2017 288 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Learn Arduino Prototyping in 10 days

The Arduino Platform

"Start from wherever you are and with whatever you have got."
- Jim Rohn

The second chapter of this book is dedicated to laying down a strong technical foundation for the years to come in your Arduino based device development. To start off, 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 program (known as a Sketch in the Arduino world).

Things you will learn in this chapter :

  • Explanation of the Arduino platform
  • Basic parts of an Arduino board
  • Procedure to setup an Arduino board
  • Writing a basic C sketch (program) for Arduino
  • Blinking the onboard LED (via pin 13)
  • Setting pin modes for peripheral devices
  • Logical HIGH/LOW voltage values
  • Arduino current supply limits
  • Flash Memory (EEPROM...

Introduction to the Arduino platform

The Arduino platform is a hardware board that offers a hardware-software integrated creative device development platform. The Arduino boards can be interfaced with openly available peripheral devices and custom programs can be written and loaded (embedded) into the Arduino development board:

Figure 1: A typical Arduino Uno development board

These programs in turn control and interact with various peripheral components attached with the Arduino board. Thus by using the Arduino development boards; device designers and engineers can quickly create a running prototype of their imaginations. The best part is that the Arduino hardware and software eco-system is open source.

There are many different types of Arduino boards available in the market. Depending upon the processor speed, number of general purpose input/output pins and different power...

Overview of Arduino prototyping

Developing and prototyping with the Arduino platform is similar to working on any other embedded system. A general overview of the prototyping process is depicted in the following diagram:

Figure 2: Overview of Device Prototyping with Arduino

The first step in the prototyping process is to write the embedded program that we will load into the micro-controller board. The term "embedded" is derived from something being hidden. Since the program is loaded into a micro-controller board which cannot be easily seen or deciphered, therefore the program is referred to as an embedded program. Once the program has been written and compiled successfully, it is loaded into the Arduino Uno board.

Once the program is compiled and loaded into the Arduino Uno development board, the next step is to setup the device prototype. A device prototype is the...

Setting up the Arduino board

In this section we will briefly look at how to setup an Arduino Uno development board and its corresponding Integrated Development Environment (IDE).The process of the first time setup will depend upon the operating system of the computer and is available at the following Arduino Foundation website addresses. It is expected that the reader will perform the setup prior to proceeding further.

Depending upon the Operating System, the Arduino IDE can be downloaded from the following locations on the official Arduino Foundation website:
Windows: https://www.arduino.cc/en/Guide/Windows
Macintosh: https://www.arduino.cc/en/Guide/MacOSX
Linux: https://www.arduino.cc/en/Guide/Linux

As the majority of computer users worldwide use the Windows operating system, this book will provide some practical observations while setting up the Arduino Uno board on...

Arduino program structure and execution

In this section we will study the general structure of an Arduino sketch. After going through this section you will be able to understand the important parts of an Arduino sketch. This section will also explain how each part of an Arduino sketch gets executed in the Arduino development board.

Arduino C programs are called sketches. A basic sketch structure needs at least two functions in the program body. These functions are listed as follows:

  • setup()
  • loop()

These functions should always have a same name that is, setup() and loop(). The Arduino development board is pre-programed to execute a loaded sketch by looking for these two function names in the body of a sketch. So if these two function names are not present in the C sketch, then the Arduino IDE will not even compile the sketch successfully. Instead the following errors will be...

Understanding the first Arduino sketch

Now let us jump into some hands-on activity. In this section we will study an existing Arduino sketch that shipped with the Arduino IDE. The sketch we are going to study is the world famous "blink" program, which is like the Hello World of the embedded programming world. The Arduino IDE installation comes preloaded with a lot of example sketches. All the example sketches are available for use from the File > Examples menu.

Once you attain a minimum level of understanding, you will be able to start exploring more of these examples on your own. Let us inspect and understand the blink program. Fire up the Arduino IDE on your computer and navigate to the File > Examples > 01.Basic > Blink menu. The Blink program will open in a new Arduino IDE window.

The first point to note in the program is the one time configuration that...

Compiling, loading and running a sketch

The first step in the process is to connect the Arduino Uno development board to the Computer using the USB-A to USB-B cable. The USB-A end of the cable will go into the computer's USB-A port. While the USB-B end of the cable will get plugged into the USB-B port on the Arduino board.

Figure 6: USB A to USB B Connector

After the Arduino board has been firmly connected to the computer, launch (or re-launch if already open) the Arduino IDE so that the Arduino board get auto detected by the IDE.

Navigate to the menu, Tools | Port, there should be an auto detected port, COM6 (in the picture shown next). If the port is not selected by default, then go ahead and select it manually.

Sometimes it may take a few extra seconds for the board to get auto detected. If the board fails to get detected try to close the IDE and re-launch the IDE again...

Commonly used in-built C sketch functions

In this section we will quickly look at the commonly used in-built function in the Arduino C sketches. These functions will help us in performing basic tasks while interfacing with various devices. Unless you are attempting advanced sketches, the following functions will be very helpful in building most of the Arduino sketches. Apart from the below in-built functions, device specific header files and functions are also used - we will understand this aspect in the chapter for Day 2 while understanding how to use a header library for a sensor.

C Sketch function Purpose
pinMode(PIN-NUMBER, I/O-MODE) This function is used to specify whether a particular Arduino pin will be used in Input or Output mode.
digitalRead(PIN-NUMBER) This function is used to read digital input from a digital pin. The input value is either LOW or HIGH and...

Digital input and output

In this section, let us look at the commonly used in-built C functions that are used for digital I/O. The following two functions are used for sending a digital signal out via a digital pin. First the digital pin has to be configured in output mode (for sending) in the setup() function:

pinMode(PIN-NUMBER, I/O-MODE) 

Let us say we want to send a digital signal via digital Pin 7, then the following line of code will be used:

pinMode(7, OUTPUT) 

This is how we configure the digital pin in output mode so that it can send digital signals. The next step is to understand how to actually send a digital signal. For sending a digital HIGH signal the following line of code must be used:

digitalWrite(7, HIGH) 

Similarly, for sending a digital LOW signal the following line of code must be used:

digitalWrite(7, LOW) 

Note that some peripheral components might need...

Analog input and output

In this section, let us take a look at the commonly used in-built C functions that are used for analog I/O. To begin with we will learn how analog input is measured by the Arduino sketch. An Arduino sketch uses the following function to obtain an analog reading from its analog pins:

analogRead(<pin-number>) 

For example, if we want to read the analog signal value from analog pin A5, we must use the following function call:

int value;                // declare integer variable 
value = analogRead(A5); // read analog value

The above function will return an integer value between 0 and 1023, depending upon the voltage value on the pin. The number 0 to 1023 will be proportional to the voltage range of the Arduino Uno board i.e. 0 to 5 volts.

Next we will look at techniques to write analog signals on both analog as well as digital pins. Digital pins...

Try the following

Now that we have reached the end of this chapter, let us try to perform some interesting self-learning exercises. These exercises have been devised to simulate your thoughts and enable to utilize what you have learnt so far.

  • Increase the delay between the blinking of the on-board LED to 2 seconds by using the statement delay(2000) in the loop() function.
  • Decrease the delay between the blinking of the LED to 0.5 seconds. Remember 1 second = 1000 milliseconds.
  • Wrap the LED blinking portion of the code in a for loop, to run 10 times.

Things to remember

A list of important concepts that you should remember has been provided so that you can easily recall the main points learnt in this chapter.

  • In the Arduino parlance, a "program" is called a "sketch".
  • Only one sketch can be loaded at a time into the Arduino board.
  • The setup() function runs only once every time the board is either reset or powered up.
  • The loop() function keeps running infinitely.
  • Peripheral devices are connected using the digital and analog I/O pins.
  • Peripheral devices may be powered by using the 5 volt and 3.3 volt power supply pins.
  • The Arduino Uno board has 32 KB of memory. It must be used efficiently for managing complex scenarios.
  • Arduino power supply pins should NOT be used for high powered devices such as motors.
  • As the number of peripheral devices increase, the Arduino board's power supply pins may not be able...

Summary

In this chapter we concentrated on understanding the basics of writing a sketch; loading and executing the sketch in the Arduino board. We also learnt the most commonly used in-built C functions, followed by a detailed understanding to sending and receiving digital and analog signals. So far our journey was focused on the basics and the sketch that we studied was contained within the Arduino Uno board.

In the next chapter we are going to get introduced to building breadboard circuits with external hardware components and then learn how to interface them with the Arduino board. We will also take an in-depth look at various common electronic components used for Arduino prototyping. It is important to grasp the basic concepts as these will go a long way and make you fully self-reliant in your future endeavors.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • ? 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

Description

This book is a quick, 10-day crash course that will help you become well acquainted with the Arduino platform. The primary focus is to empower you to use the Arduino platform by applying basic fundamental principles. You will be able to apply these principles to build almost any type of physical device. The projects you will work through in this book are self-contained micro-controller projects, interfacing with single peripheral devices (such as sensors), building compound devices (multiple devices in a single setup), prototyping standalone devices (powered from independent power sources), working with actuators (such as DC motors), interfacing with an AC-powered device, wireless devices (with Infrared, Radio Frequency and GSM techniques), and finally implementing the Internet of Things (using the ESP8266 series Wi-Fi chip with an IoT cloud platform). The first half of the book focuses on fundamental techniques and building basic types of device, and the final few chapters will show you how to prototype wireless devices. By the end of this book, you will have become acquainted with the fundamental principles in a pragmatic and scientific manner. You will also be confident enough to take up new device prototyping challenges.

Who is this book for?

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.

What you will learn

  • ? Write Arduino sketches and understand the fundamentals of building prototype circuits using basic electronic components, such as resistors, transistors, and diodes
  • ? Build simple, compound, and standalone devices with auxiliary storage (SD card), a DC battery, and AC power supplies
  • ? Deal with basic sensors and interface sensor modules by using sensor datasheets
  • ? Discover the fundamental techniques of prototyping with actuators
  • ? Build remote-controlled devices with infrared (IR), radio frequency (RF),
  • and telephony with GSM
  • ? Learn IoT edge device prototyping (using ESP8266) and IoT cloud configuration

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 29, 2017
Length: 288 pages
Edition : 1st
Language : English
ISBN-13 : 9781788290685
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jun 29, 2017
Length: 288 pages
Edition : 1st
Language : English
ISBN-13 : 9781788290685
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 96.97
Internet of Things with Arduino Cookbook
€29.99
Learn Arduino Prototyping in 10 days
€29.99
Learning C for Arduino
€36.99
Total 96.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Boot Camp Chevron down icon Chevron up icon
The Arduino Platform Chevron down icon Chevron up icon
Day 1 - Building a Simple Prototype Chevron down icon Chevron up icon
Day 2 - Interfacing with Sensors Chevron down icon Chevron up icon
Day 3 - Building a Compound Device Chevron down icon Chevron up icon
Day 4 - Building a Standalone Device Chevron down icon Chevron up icon
Day 5 - Using Actuators Chevron down icon Chevron up icon
Day 6 - Using AC Powered Components Chevron down icon Chevron up icon
Day 7 - The World of Transmitters, Receivers, and Transceivers Chevron down icon Chevron up icon
Day 8 - Short Range Wireless Communications Chevron down icon Chevron up icon
Day 9 - Long-Range Wireless Communications Chevron down icon Chevron up icon
Day 10 - The Internet of Things Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(13 Ratings)
5 star 76.9%
4 star 23.1%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Joydeep Jun 14, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good book for beginners..
Amazon Verified review Amazon
Suman Bhushan Aug 03, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is possibly the best jump starter book I have laid my hands on.It’s a solid book…very good work to put all important things in one single book. It also teaches all the required things from scratch.
Amazon Verified review Amazon
Amazon Customer Aug 24, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I am really fortunate enough to buy this book after searching for last 3 months for an Arduino book for beginner. Very good book to start for Arduino.
Amazon Verified review Amazon
Narayan Hegde Mar 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very good book.
Amazon Verified review Amazon
AS Aug 30, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
What better way to teach the next generation how to learn Arduino.This is a must read for all technology enthusiastic, who want to learn how embedded system work in accordance with automation and IoT.This is a smart beginning to learn and implement (DIY) home automation which can be adopted from students to professionals.This book is very well written and structured with all necessary inputs in place to understand the core concept.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.