0% found this document useful (0 votes)
5 views38 pages

ES Unit3 Lecture23 Chapter5 PDF

The document provides an overview of Arduino as a microcontroller platform, highlighting its evolution, advantages, and various types. It discusses the development process using Arduino, including the Integrated Development Environment (IDE), code structure, and debugging techniques. Additionally, it emphasizes Arduino's role in the Internet of Things and its open-source nature, which fosters community collaboration and innovation.

Uploaded by

vishp6270
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views38 pages

ES Unit3 Lecture23 Chapter5 PDF

The document provides an overview of Arduino as a microcontroller platform, highlighting its evolution, advantages, and various types. It discusses the development process using Arduino, including the Integrated Development Environment (IDE), code structure, and debugging techniques. Additionally, it emphasizes Arduino's role in the Internet of Things and its open-source nature, which fosters community collaboration and innovation.

Uploaded by

vishp6270
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

GOA COLLEGE OF ENGINEERING

Affiliated to Goa University


INFORMATION TECHNOLOGY DEPARTMENT
Vision
Impart high quality knowledge and skills to students in the field of Information Technology ,motivate research, encourage industry consultancy projects and
nurture human values and life skills.

UNIT 3
PROTOTYPING
EMBEDDED DEVICES
Embedded Systems Ms. Seeya Gude
Semester IV Asst. Professor
S.E.(I.T.) Information Technology Department
Academic Year 2020-21 Goa College of Engineering
IT 420 EMBEDDED SYSTEMS : CHAPTER5
18-06-2021 1
UNIT3 (By Ms. Seeya Gude)
AGENDA
UNIT 3
PROTOTYPING EMBEDDED DEVICES
1. ARDUINO
2. APPLICATIONS OF ARDUINO

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 2
UNIT3 (By Ms. Seeya Gude)
ARDUINO Software

Lets begin with how a


microcontroller evolved….
A micro controller began
with a single processing
chip, with inbuilt RAM,
ROM,I/O ports, timers,
clock and CPU.
But to make the
microcontroller to work
and run its application,
needed a separate
hardware and software.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 3
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Arduino comes with a
package of a Software
microcontroller chip along
with the motherboard,
other hardware and
software needed to
operate the controller.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 4
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Arduino put the foundation for IOT, Raspberry Pi took it forward over
a very large scale.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 5
UNIT3 (By Ms. Seeya Gude)
ARDUINO
The poster child for the Internet of Things, and physical computing in
general, is the Arduino. These days the Arduino project covers a
number of microcontroller boards, but its birth was in Ivrea in
Northern Italy in 2005.

An assortment of boards was around at that time, but they tended to


be expensive, hard to use, or both. So, the team put together a board
which was cheap to buy and included an onboard serial connection to
allow it to be easily programmed. Combined with an extension of the
Wiring software environment, it made a huge impact on the world of
physical computing.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 6
UNIT3 (By Ms. Seeya Gude)
ARDUINO
A decision early on to make the code and schematics open source
meant that the Arduino board could survive on generic platform
without its parent platform IDII and flourish. It also meant that people
could adapt and extend the platform to suit their own needs. As a
result, an entire ecosystem of boards, add-ons, and related kits has
flourished.
The Arduino team’s focus on simplicity rather than raw performance
for the code has made the Arduino the board of choice in almost
every beginner’s physical computing project, and the open source
ethos has encouraged the community to share circuit diagrams, parts
lists, and source code.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 7
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Advantages of Arduino over older microcontrollers:
• Open-source electronics platform
• Inexpensive
• Platform support
• Simple environment
• Extensible software and hardware

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 8
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Types of Arduino:

UNO NANO DIECIMILA

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 9
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Types of Arduino:

DUE MEGA

MICRO

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 10
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Types of Arduino:

ZERO LEONARDO REDBOARD

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 11
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Types of Arduino:

ESPLORA LILYPAD

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 12
UNIT3 (By Ms. Seeya Gude)
ARDUINO
Types of Arduino:

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 13
UNIT3 (By Ms. Seeya Gude)
APPLICATIONS OF ARDUINO

Lets see some interesting applications of Arduino…….

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 14
UNIT3 (By Ms. Seeya Gude)
THANK YOU

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 15
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Using a single USB cable, you can not only power the board but
also push your code onto it, and (if needed) communicate with
it—for example, for debugging or to use the computer to store
data retrieved by the sensors connected to the Arduino.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 16
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Integrated Development Environment
You usually develop against the Arduino using the integrated
development environment (IDE) that the team supply at
http://arduino.cc. Although this is a fully functional IDE, based on
the one used for the Processing language (http://processing.org/),
it is very simple to use. Most Arduino projects consist of a single
file of code, so you can think of the IDE mostly as a simple file
editor. The controls that you use the most are those to check the
code (by compiling it) or to push code to the board

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 17
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Pushing Code
• Connecting to the board should be relatively straightforward
via a USB cable. Sometimes you might have issues with the
drivers (especially on some versions of Windows) or with
permissions on the USB port (some Linux packages for drivers
don’t add you to the dialout group), but they are usually swiftly
resolved once and for good.
• After this, you need to choose the correct serial port (which
you can discover from system logs or select by trial and error)
and the board type (from the appropriate menus, you may
need to look carefully at the labelling on your board and its
CPU to determine which option to select).

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 18
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Pushing Code
• When your setup is correct, the process of pushing code is
generally simple: first, the code is checked and compiled, with
any compilation errors reported to you. If the code compiles
successfully, it gets transferred to the Arduino and stored in its
flash memory. At this point, the Arduino reboots and starts
running the new code.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 19
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Operating System
The Arduino doesn’t, by default, run an OS as such, only the
bootloader, which simplifies the code-pushing process described
previously. When you switch on the board, it simply runs the code
that you have compiled until the board is switched off again (or
the code crashes).
It is, however, possible to upload an OS to the Arduino, usually a
lightweight real-time operating system (RTOS) such as
FreeRTOS/DuinOS.
The main advantage of one of these operating systems is their
built-in support for multitasking. However, for many purposes,
you can achieve reasonable results with a simpler task-dispatching
library.
IT 420 EMBEDDED SYSTEMS : CHAPTER5
18-06-2021 20
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Operating System
The avr-gcc toolset (www.nongnu.org/avr-libc/) is the collection
of programs that let you compile code to run on the AVR chips
used by the rest of the Arduino boards and flash the resultant
executable to the chip. It is used by the Arduino IDE behind the
scenes but can be used directly, as well.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 21
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Language
The language usually used for Arduino is a slightly modified
dialect of C++ derived from the Wiring platform. It includes some
libraries used to read and write data from the I/O pins provided
on the Arduino and to do some basic handling for “interrupts” (a
way of doing multitasking, at a very low level). This variant of C++
tries to be forgiving about the ordering of code; for example, it
allows you to call functions before they are defined. This
alteration is just a nicety, but it is useful to be able to order things
in a way that the code is easy to read and maintain, given that it
tends to be written in a single file.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 22
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Language
The code needs to provide only two routines:
◾ setup(): This routine is run once when the board first boots. You
could use it to set the modes of I/O pins to input or output or to
prepare a data structure which will be used throughout the
program.
◾ loop(): This routine is run repeatedly in a tight loop while the
Arduino is switched on. Typically, you might check some input, do
some calculation on it, and perhaps do some output in response.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 23
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Language

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 24
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Language
To avoid getting into the details of programming languages in this
chapter, we just compare a simple example across all the boards—
blinking a single LED:
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup()
{
// initialize the digital pin as an output.
pinMode(led, OUTPUT); } // the loop routine runs over and over
again forever: void loop() { digitalWrite(led, HIGH); // turn the LED
on delay(1000); // wait ITfor
18-06-2021 a second digitalWrite(led,
420 EMBEDDED SYSTEMS : CHAPTER5
UNIT3 (By Ms. Seeya Gude) LOW); // 25
DEVELOPING ON THE
ARDUINO
Language
Reading through this code, you’ll see that the setup() function
does very little; it just sets up that pin number 13 is the one we’re
going to control (because it is wired up to an LED). Then, in loop(),
the LED is turned on and then off, with a delay of a second
between each flick of the (electronic) switch. With the way that
the Arduino environment works, whenever it reaches the end of
one cycle—on; wait a second; off; wait a second—and drops out
of the loop() function, it simply calls loop() again to repeat the
process.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 26
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Debugging
Because C++ is a compiled language, a fair number of errors, such
as bad syntax or failure to declare variables, are caught at
compilation time. Because this happens on your computer, you
have ample opportunity to get detailed and possibly helpful
information from the compiler about what the problem is.
Although you need some debugging experience to be able to
identify certain compiler errors, others, like this one, are relatively
easy to understand: Blink.cpp: In function ‘void loop()’:Blink:21:
error:’digitalWritee’ was not declared in this scope

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 27
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Debugging
On line 21, in the function loop(), we deliberately misspelled the
call to digitalWrite. When the code is pushed to the Arduino, the
rules of the game change, however. Because the Arduino isn’t
generally connected to a screen, it is hard for it to tell you when
something goes wrong. Even if the code compiled successfully,
certain errors still happen. An error could be raised that can’t be
handled, such as a division by zero, or trying to access the tenth
element of a 9-element list. Or perhaps your program leaks
memory and eventually just stops working. Or (and worse) a
programming error might make the code continue to work
dutifully but give entirely the wrong results.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 28
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Debugging
If Bubblino stops blowing bubbles, how can we distinguish
between the following cases?
◾ Nobody has mentioned us on Twitter.
◾ The Twitter search API has stopped working.
◾ Bubblino can’t connect to the Internet.
◾ Bubblino has crashed due to a programming error.
◾ Bubblino is working, but the motor of the bubble machine has
failed.
◾ Bubblino is powered off.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 29
UNIT3 (By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Debugging
Adrian likes to joke that he can debug many problems by looking
at the flashing lights at Bubblino’s Ethernet port, which flashes
while Bubblino connects to DNS and again when it connects to
Twitter’s search API, and so on. (He also jokes that we can
discount the “programming error” option and that the main
reason the motor would fail is that Hakim has poured bubble mix
into the wrong hole. Again.) But while this approach might help
distinguish two of the preceding cases, it doesn’t help with the
others and isn’t useful if you are releasing the product into a mass
market! The first commercially available version of the WhereDial
has a bank of half a dozen LEDs specifically for consumer-level
debugging. In the case of an error, the pattern of lights showing
may help customers fix ITtheir
18-06-2021
UNIT3problem or help flesh out details for30
420 EMBEDDED SYSTEMS : CHAPTER5
(By Ms. Seeya Gude)
DEVELOPING ON THE
ARDUINO
Debugging
But code isn’t, in general, created perfect: in the meantime you
need ways to identify where the errors are occurring so that you
can bullet-proof them for next time. In the absence of a screen,
the Arduino allows you to write information over the USB cable
using Serial.write(). Although you can use the facility to
communicate all kinds of data, debugging information can be
particularly useful. The Arduino IDE provides a serial monitor
which echoes the data that the Arduino has sent over the USB
cable. This could include any textual information, such as logging
information, comments, and details about the data that the
Arduino is receiving and processing (to double-check that your
calculations are doing the right thing).
IT 420 EMBEDDED SYSTEMS : CHAPTER5
18-06-2021 31
UNIT3 (By Ms. Seeya Gude)
NOTES ON THE HARDWARE
The Arduino exposes a number of GPIO pins and is usually
supplied with “headers” (plastic strips that sit on the pin holes,
that provide a convenient solderless connection for wires,
especially with a “jumper” connection). The headers are
optimised for prototyping and for being able to change the
purpose of the Arduino easily. Each pin is clearly labelled on the
controller board. The details of pins vary from the smaller boards
such as the Nano, the classic form factor of the Uno, and the
larger boards such as the Mega or the Due. In general, you have
power outputs such as 5 volts or 3.3 volts (usually labelled 5V and
3V3, or perhaps just 3V), one or more electric ground connections
(GND), numbered digital pins, and numbered analogue pins
prefixed with an A.
IT 420 EMBEDDED SYSTEMS : CHAPTER5
18-06-2021 32
UNIT3 (By Ms. Seeya Gude)
NOTES ON THE HARDWARE
You can power the Arduino using a USB connection from your
computer. This capability is usually quite convenient during
prototyping because you need the serial connection in any case to
program the board. The Arduino also has a socket for an external
power supply, which you might be more likely to use if you
distribute the project. Either way should be capable of powering
the microcontroller and the usual electronics that you might
attach to it. (In the case of larger items, such as motors, you may
have to attach external power and make that available selectively
to the component using transistors.)

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 33
UNIT3 (By Ms. Seeya Gude)
NOTES ON THE HARDWARE
Outside of the standard boards, a number of them are focused on
a particular niche application—for example, the Arduino Ethernet
has an on-board Ethernet chip and trades the USB socket for an
Ethernet one, making it easier to hook up to the Internet. This is
obviously a strong contender for a useful board for Internet of
Things projects. The LilyPad has an entirely different specialism, as
it has a flattened form (shaped, as the name suggests, like a
flower with the I/O capabilities exposed on its “petals”) and is
designed to make it easy to wire up with conductive thread, and
so a boon for wearable technology projects. Choosing one of the
specialist boards isn’t the only way to extend the capabilities of
your Arduino. Most of the boards share the same layout of the
assorted GPIO, ADC, and power pins, and you are able to
piggyback
18-06-2021 an additionalIT circuit board
UNIT3 (By Ms. Seeya on
Gude)top of the Arduino which
420 EMBEDDED SYSTEMS : CHAPTER5
34
NOTES ON THE HARDWARE
In the Arduino world, these add-on boards are called shields,
perhaps because they cover the actual board as if protecting it.
Some shields provide networking capabilities—Ethernet, WiFi, or
Zigbee wireless, for example. Motor shields make it simple to
connect motors and servos; there are shields to hook up mobile
phone LCD screens; others to provide capacitive sensing; others to
play MP3 files or WAV files from an SD card; and all manner of
other possibilities—so much so that an entire website,
http://shieldlist.org/, is dedicated to comparing and documenting
them. In terms of functionality, a standard Arduino with an
Ethernet shield is equivalent to an Arduino Ethernet. However,
the latter is thinner (because it has all the components laid out on
a single board) but loses the convenient USB connection. (You can
still connect to it to push
18-06-2021 code orMs.communicate
IT 420 EMBEDDED SYSTEMS : CHAPTER5
UNIT3 (By Seeya Gude) over the serial 35
NOTES ON THE HARDWARE
OPENNESS
The Arduino project is completely open hardware and an open
hardware success story. The only part of the project protected is
the Arduino trademark, so they can control the quality of any
boards calling themselves an Arduino. In addition to the code
being available to download freely, the circuit board schematics
and even the EAGLE PCB design files are easily found on the
Arduino website. This culture of sharing has borne fruit in many
derivative boards being produced by all manner of people. Some
are merely minor variations on the main Arduino Uno, but many
others introduce new features or form factors that the core
Arduino team have overlooked. In some cases, such as with the
wireless-focused Arduino Fio board, what starts as a third-party
board
18-06-2021 (it was originally the Funnel IO) is later adopted as an
IT 420 EMBEDDED SYSTEMS : CHAPTER5
UNIT3 (By Ms. Seeya Gude)
36
CHOOSING YOUR
PLATFORM
How to choose the right platform for your Internet of Things device is as easy a
question to answer as working out the meaning of life. This isn’t to say that it’s an
impossible question—more that there are almost as many answers as there are
possible devices. The platform you choose depends on the particular blend of price,
performance, and capabilities that suit what you’re trying to achieve.

Start by choosing a platform to prototype in. The following sections discuss some of
the factors that you need to weigh—and possibly play off against each other—when
deciding how to build your device.
• Processor speed
• RAM
• Networking
• USB
• Power Consumption
• Interfacing with sensors and other circuitry.
• Physical Size and Form Factor
IT 420 EMBEDDED SYSTEMS : CHAPTER5
18-06-2021 37
UNIT3 (By Ms. Seeya Gude)
CHOOSING YOUR
PLATFORM
Factors to be checked while choosing your platform:
1. Processor speed
The processor speed, or clock speed, of your processor tells you how fast it can
process the individual instructions in the machine code for the program it’s running.
Naturally, a faster processor speed means that it can execute instructions more
quickly. The clock speed is still the simplest proxy for raw computing power, but it
isn’t the only one. You might also make a comparison based on millions of
instructions per second (MIPS), depending on what numbers are being reported in
the datasheet or specification for the platforms you are comparing. Some
processors may lack hardware support for floating-point calculations, so if the code
involves a lot of complicated mathematics, a by-the-numbers slower processor with
hardware floating-point support could be faster than a slightly higher performance
processor without it.

IT 420 EMBEDDED SYSTEMS : CHAPTER5


18-06-2021 38
UNIT3 (By Ms. Seeya Gude)

You might also like