INTRODUCTION TO
ARDUINO
ELECTRONICS
Arduino is composed of two major parts:
1. Arduino board
which is the piece of hardware you work on
when you build your objects;
2. Arduino Integrated Development
Environment or IDE
the piece of software you run on your
computer. The sketch tells the board what
to do.
The Arduino Platform
Not too long ago, working on hardware
meant building circuits from scratch,
using hundreds of different
components with strange names like
resistor, capacitor, inductor, transistor,
and so on.
Every circuit was wired to do one
specific application, and making
changes required you to cut wires,
solder connections, and more (Banzi &
Shiloh, 2015).
The Arduino Platform
With the appearance of digital
technologies and
microprocessors, these functions,
which were once implemented
with wires, were replaced by
software.
The Arduino Platform
Arduino has a row of strips at the
top and the bottom with lots of
labels.
These strips are the connectors,
which are used to attach to
sensors and actuators.
The Arduino Platform
An actuator is the opposite of a
sensor: a sensor senses
something in the physical world
and converts it to a signal a
computer can understand,
while an actuator converts a
signal from a computer into an
act in the physical world
The Arduino Platform
The Arduino microcontroller
is like a little command
center that is awaiting your
orders.
The Arduino Platform
With a few lines of code, you can
make your Arduino turn a light on
or off, read a sensor value and
display it on your computer
screen, or even use it to build a
homemade circuit to repair a
broken kitchen appliance.
The Arduino Platform
Arduino came up with an easy-
to-learn programming language
(derived from C++) that
incorporates various complex
programming functions into simple
commands that are much easier
for a beginner to learn.
The Arduino Platform
Now, let us go back to Arduino Uno board.
At first, all those connectors
might be a little confusing.
The Arduino Platform
Now, let us go back to Arduino Uno board.
14 Digital I/O pins (pins 0–13)
These pins can be either inputs or
outputs. Inputs are used to read
information from sensors, while
outputs are used to control actuators.
You will specify the direction (in or
out) in the sketch you create in the
IDE. Digital inputs can only read one
of two values, and digital outputs can
only output one of two values (HIGH
and LOW). a little confusing.
The Arduino Platform
Now, let us go back to Arduino Uno board.
6 Analogue In pins (pins 0–5)
The analogue input pins are used for
reading voltage measurements from
analogue sensors. In contrast to
digital inputs, which can distinguish
between only two different levels
(HIGH and LOW), analogue inputs can
measure 1,024 different levels of
voltage.
The Arduino Platform
Now, let us go back to Arduino Uno board.
6 Analogue Out pins (pins 3, 5, 6, 9,
10, and 11)
These are actually six of the digital
pins that can perform a third
function: they can provide analogue
output. As with the digital I/O pins,
you specify what the pin should do
in your sketch.
The Arduino Platform
Now, let us go back to Arduino Uno board.
The board can be powered from your
computer’s USB port, most USB
chargers, or an AC adapter (9 volts
recommended, 2.1 mm barrel tip,
center positive). Whenever power is
provided at the power socket, Arduino
will use that, and if there is no power
at the power socket, Arduino will use
power from the USB socket. It is safe to
have power at both the power socket
and the USB socket (Banzi & Shiloh,
2015).
The Anatomy of
an Interactive
Device
The Anatomy of the Interactive
Device
All the objects were built using
Arduino follow a very simple pattern
that we call the interactive device.
The Anatomy of the Interactive
Device
The interactive device is an electronic
circuit that is able to sense the
environment by using sensors
(electronic components that convert
real-world measurements into electrical
signals).
The Anatomy of the Interactive
Device
The device processes the information it
gets from the sensors with behavior
that is described in the software. The
device will then be able to interact
with the world by using actuators,
electronic components that can
convert an electric signal into a
physical action (Banzi & Shiloh,
2015).
Sensors and Actuators
Sensors and actuators are
electronic components that allow
a piece of electronics to interact
with the world.
Sensors and Actuators
As the microcontroller is a very
simple computer, it can process only
electric signals (a bit like the electric
pulses that are sent between neurons
in our brains).
For it to sense light, temperature, or
other physical quantities, it needs
something that can convert them
into electricity.
Sensors and Actuators
In our body, for example, the eye
converts light into signals that get
sent to the brain using nerves.
In electronics, we can use a simple
device called a light dependent
resistor (LDR), also known as a
photoresistor, that can measure the
amount of light that hits it and report
it as a signal that can be understood
by the microcontroller (Banzi &
Shiloh, 2015).
Sensors and Actuators
Once the sensors have been read,
the device has the information
needed to decide how to react.
The decision-making process is
handled by the
microcontroller, and the
reaction is performed by
actuators.
Sensors and Actuators
In our bodies, for example,
muscles receive electric signals
from the brain and convert them
into a movement.
In the electronic world, these
functions could be performed by
a light or an electric motor (Banzi
& Shiloh, 2015).
Arduino
Electricity
Arduino Electricity
To gain a better understanding of
what goes on inside an Arduino, we
should first go through some basic
electrical concepts (i.e., electronics
and circuits).
Although the levels contained in your
Arduino (+5 DCV) are relatively
secure, you will not know when it
becomes dangerous if you do not
understand how electricity works.
Arduino Electricity
Let us spend a bit of time discussing
electricity, since you will soon be
building electronic circuits with your
Arduino tasks.
In simple terms, electricity is a form
of energy that we can harness and
convert into heat, light, movement,
and power. Electricity has three main
properties that will be important to us
as we build projects: current,
voltage, and power (Boxall, 2013).
Current
The flow of electrical energy through a
circuit is called the current.
Electrical current flows through a
circuit from the positive side of a power
source, such as a battery, to the
negative side of the power source. This
is known as direct current (DC).
Current
In some circuits, the negative side is
called ground (GND). Current is
measured in amperes or “amps” (A).
Small amounts of current are
measured in milliamps (mA), where
1,000 milliamps equal 1 amp (Boxall,
2013).
Voltage
Voltage is a measure of the
difference in potential energy
between a circuit’s positive and
negative ends. This is measured
in volts (V). The greater the
voltage, the faster the current
moves through a circuit (Boxall,
2013).
Voltage
Voltage is a measure of the
difference in potential energy
between a circuit’s positive and
negative ends. This is measured
in volts (V). The greater the
voltage, the faster the current
moves through a circuit (Boxall,
2013).
Power
Power is a measurement of the
rate at which an electrical device
converts energy from one form to
another. Power is measured in
watts (W).
For example, a 100 W light bulb
is much brighter than a 60 W
bulb because the higher-wattage
bulb converts more electrical
energy into light (Boxall, 2013).
Power
Power is all about energy and
time. So, in a way, it is a bit like
current. But, instead of being the
amount of charge passing a
point, it is the amount of energy
transformed into heat per second
when a current pass through
something that resists the flow
(like a resistor), (Monk, 2017).
Power
A simple mathematical
relationship exists among
voltage, current, and power:
Power (W) = Voltage (V) × Current (A)
Electrical
Analogy
Electrical Analogy
Electricity is not usually seen
(except maybe in a lightning storm), so
it is difficult to understand what is
happening inside of a wire when you
turn on a lamp or kitchen appliance.
For ease of consider an electrical
system to be a tank of water with an
outlet pipe at the bottom (Warren,
Adams & Molle, 2011).
Electrical Analogy
Electrical Analogy
The four images illustrate how
resistance and pressure affect the
water output from the tank. A higher
resistance yields less water output,
whereas a higher pressure yields
more water output.
You can also see that as the
resistance is lowered, much more
water is allowed to exit the tank,
even with a lower pressure (Warren,
Adams & Molle, 2011).
Electrical Analogy
The more water that is in the tank,
the faster (higher pressure) it
pushes the water through the outlet
pipe. If there were no outlet pipe, the
tank of water would simply be a
reservoir.
The fact that there is an outlet pipe at
the bottom of the tank enables water
to exit, but only at a rate determined
by the size of the pipe.
Electrical Analogy
The size of the outlet pipe determines
the resistance to the water leaving
the tank—so increasing or decreasing
the size of the outlet pipe inversely
increases or decreases the resistance
to the water leaving the tank
(i.e., smaller pipe = more resistance =
less water exiting the tank) (Warren,
Adams & Molle, 2011).
Electrical Analogy
Both the level (or pressure) of the
water and the resistance (or size of the
outlet pipe) can be measured, and
using these measurements, you can
calculate the amount of water exiting
the tank at a given point in time. The
difference in the water analogy and
electricity flow is that the electricity
must complete its path back to the
source before it can be used (Warren,
Adams & Molle, 2011).
Electrical Basics
Notice that a higher water pressure
yields a higher water output (keeping
resistance the same). The same is
true with the electrical equivalent of
pressure, called “voltage” (V), which
represents the potential energy that
can be found in an electrical system. A
higher system voltage has more energy
to drive the components in the
system.
Electrical Basics
The amount of “resistance“ (R) found in
a system impedes (slow) the flow of
electricity, just as the resistance
caused by the outlet pipe slows the
flow of water from the tank. This
means that as the resistance
increases, the voltage (pressure)
must also increase to maintain the
same amount of output power.
Electrical Basics
The amount of electrical charge (in
coulombs) that is passed through an
electrical system each second is called
the “amperage” (I) or “current,” and
can be calculated using the voltage,
resistance, and Ohm’s law. A “watt”
(P) is a measure of electrical power
that is calculated by multiplying the
voltage times the amperage.
Electrical Basics
According to Wikipedia.com,
Ohm’s law states that the current
through a conductor between two
points is directly proportional to
the potential difference or voltage
across the two points, and
inversely proportional to the
resistance between them.
Electrical Basics
There is a simple relationship among
voltage, resistance, and amperage
(current) that can be calculated
mathematically. Given any two of the
variables and Ohm’s law, you can
calculate the third. A watt is a
measure of electrical power—it is
related to Ohm’s law because it can
also be calculated using the same
variables.
Electrical Basics
See the formulas,
Where:
V = voltage,
R = resistance,
I = amperage, and
P = watts (Warren, Adams & Molle,
2011).
The Ohm’s Law Triangle Ohm’s Law
states that the relationship between
current, resistance, and voltage is as
follows:
voltage (V) = current (I) × resistance (R)
Electrical Basics
If you know two of the quantities, then
you can calculate the third. A popular
way to remember Ohm’s Law is with a
triangle,
Where:
V=I×R
I=V÷R
R=V÷I
The Ohm’s Law triangle
Source: http://cdselectronics.com/Help/ohm.htm
Electrical Basics
Let’s have some exercises…
Circuits
The starting point of the electricity in
a system is called the “source” and
usually refers to the positive battery
lead or power supply. The electricity
flows from the source, through the
system, and to the sink, which is
usually the negative battery terminal
or ground wire (GND).
Circuits
For electricity to flow, the circuit
must be “closed,” which means
that the electrical current can get
back to its starting point. The
term “ground” comes from the
practice of connecting the return
path of an AC circuit, directly
into the ground outside using a
copper rod.
Circuits
You might notice that most electrical
meters also have a ground rod nearby
that is clamped to a wire leading into
the fuse-box. This ground wire gives
the returning electrical current a path
to exit the system. Even though the
DC equivalent of GND is the
negative battery terminal, we still
call it GND (Warren, Adams & Molle,
2011).
Circuits
An electrical system is called a
“circuit,” and can be simple like a
string of Christmas lights plugged into
a power outlet or very intricate like the
motherboard in your PC. Now consider
that in a circuit, the electricity flows
only if something is there to complete
the circuit, called a “load”
Circuits
In general, the load in a circuit is the
device you intend to provide with
electricity. This can be a lightbulb,
electric motor, heater coil, loud
speaker, computer CPU, or any other
device that the circuit is intended to
power(Warren, Adams & Molle, 2011).
Circuits
There are three general types of
circuits: open-circuit, closed-circuit,
and short-circuit. Basically, an open-
circuit is one that is turned off, a
closed-circuit is one that is turned
on, and a short-circuit is one that
needs repair (unless you used a fuse).
Circuits
This is because a short-circuit implies
that the electricity has found a path
that bypasses the load and connects
the positive battery terminal to the
negative battery terminal. This is
always bad and usually results in
sparks and a cloud of smoke, with
the occasional loud popping sound
(Warren, Adams & Molle, 2011).
Circuits
Open and closed-circuits
Measuring Electricity
Without a way to measure electrical
signals, we would be flying blind—
luckily, there is a device called a
“multi-meter” that is inexpensive and
can easily measure voltage, resistance,
and small levels of current.
Multimeter
Measuring Resistance
Resistance is measured in ohms and
tells us how well a conductor transfers
electricity. Current flow and resistance
are inversely related. As resistance
increases, current flow decreases.
Thus, a conductor with lower
resistance transfers more
electricity than one with higher
resistance.
Measuring Resistance
Every conductor has some resistance
—some materials have such a high
resistance to current flow, they are
called “insulators” meaning that they
will not transfer electricity. When
electricity is resisted while
passing through a conductor, it
turns into heat; for this reason,
we use conductors with the
lowest resistance possible to
avoid generating heat (Warren,
Adams & Molle, 2011).
Measuring Resistance
Resistors come in different sizes
to be able to cope with different
amounts of power. High-power
resistors are physically big to
cope with the heat they produce.
Measuring Resistance
Since “parts getting hot” is
generally a bad thing in
electronics, we will mostly avoid
that. Nearly all of the time we can
use 0.25-watt resistors, which
are perfect for general use (Monk,
2017).
Measuring Resistance
As the word suggests, resistance
is actually resistance to the flow
of current. So a high-resistance
resistor will not allow much
current to flow, while a low-
value resistor will allow lots of
current to flow (Monk, 2017).
Measuring Resistance
A resistor is an electrical device
that has a known resistance
value in ohms and is used to
limit the amount of current that
can flow through it.
Resistor
Measuring Resistance
Resistors have little stripes on
them that tell you their value.
Measuring Resistance
Measuring Resistance
Figure above shows the arrangement of the
colored bands. The resistor value uses just
the three bands. The first band is the first
digit, the second the second digit, and the
third “multiplier” band is how many zeros to
put after the first two digits.
Measuring Resistance
So, a 270Ω (ohm) resistor will have first digit
2 (red), second digit 7 (violet), and a
multiplier of 1 (brown). Similarly, a 10kΩ
resistor will have bands of brown, black, and
orange (1, 0, 000).
Measuring Resistance
Measuring Resistance
Measuring Resistance
The colour code used to denote the tolerance
rating of a resistor is given as:
Brown = 1%
Red = 2 %
Gold = 5 %
Silver = 10 %
If resistor has no fourth tolerance band then the
default tolerance would be at 20%.
Exercises #1:
Calculate the value of a resistor given the color
bands:
Yellow Violet Red
Then, determine the percentage of the
tolerance value of the resistor.
Exercises #2:
Calculate the value of a resistor given the color
bands:
Red Red Black
With a silver tolerance band.
The Anatomy of
an Interactive
Device