0% found this document useful (0 votes)
50 views150 pages

Arduino 1

The document provides an introduction to Arduino, microcontrollers, and visual programming with XOD. It defines Arduino as an open-source electronics platform that can read sensor inputs and control outputs. It describes microcontrollers as integrated circuits that include a processor, memory, and I/O ports. The document outlines different types of microcontrollers like PIC, ARM, 8051, and AVR. It identifies the key parts of an Arduino board and how to install and use the visual programming software XOD with Arduino boards.

Uploaded by

natashathania06
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
50 views150 pages

Arduino 1

The document provides an introduction to Arduino, microcontrollers, and visual programming with XOD. It defines Arduino as an open-source electronics platform that can read sensor inputs and control outputs. It describes microcontrollers as integrated circuits that include a processor, memory, and I/O ports. The document outlines different types of microcontrollers like PIC, ARM, 8051, and AVR. It identifies the key parts of an Arduino board and how to install and use the visual programming software XOD with Arduino boards.

Uploaded by

natashathania06
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 150

STARTING

WITH
ARDUINO
Lesson 1: Introduction to
Arduino
Objectives:

• At the end of this lesson, you should be able to:

1. describe an Arduino;

2. understand the function of an Arduino;

3. understand the difference between a microprocessor and a microcontroller; and

4. identify the different types of microcontrollers.


What is Arduino?
• Arduino is an open-source
electronics platform that is
easy-to-use hardware and
software. This board can
read inputs with sensors like
light, sound, range, touch,
pressing a button, or typing a
command that turns into an
output like activating an LED,
motor, or displaying
characters on a screen.
What is a Microprocessor?
• A microprocessor is a small
electronic device that
contains the function of the
control and logic operations
of a digital computer or
known as the Central
Processing Unit.
What is a Microcontroller?
• A microcontroller is a
compact integrated circuit
that includes a processor,
memory, and input and
output peripherals.
Characteristics
Microprocessor Microcontroller
• Microprocessors work at very high speed. • Slow speed of operation.
• They are small. • It uses a micro-CPU using a lower frequency.
• Microprocessors are programmable. • Peripherals (timers, counters, etc.) are
• They are expensive due to integrated circuit embedded in the chip.
technology. • Suitable for bit-wise operations.
• Power usage is very low due to metal oxide • Less expensive.
semiconductor technology usage. • Boolean operations are supported.
• Reliable, failure rate is very low. • Use in real-time applications.
• Lower heat generation as semiconductor
devices emits very less heat.
Diagram
Several Types of Microcontrollers
in an Embedded System
• PIC Microcontroller, PIC (Peripheral Interface Controller), is a kind of
microcontroller that can be used in electronics, robotics, and other similar
devices. PIC unit has a built-in data memory, data bus, and dedicated
microprocessor for preparing all I/O devices.

• ARM Microcontroller, ARM (Advanced RISC Machine), is the most popular


Microcontrollers Programming in the digitally-embedded system world. Most
industries prefer to use only ARM microcontrollers since it has a significant
feature to implement products with an excellent appearance. It has a
cost-sensitive and high-performance device used in various applications such
as Industrial Instrument control systems, wireless networking, sensors,
automotive body systems, etc.
Several Types of Microcontrollers
in an Embedded System
• 8051 Microcontroller, 8051 microcontrollers were created by Intel in 1981. It
is an 8-bit microcontroller. It is made of 40 pins DIP (Dual inline package), 4kb
of ROM storage, 128 bytes of RAM storage, and two 16-bit timers. It consists of
four parallel 8-bit ports, which are programmable and addressable as per the
specification.

• AVR Microcontroller, AVR (Alf and Vegard's RISC Processor), was modified by
Harvard architecture machine where programs and data were stored in a
separate physical memory system that appears in different address spaces but
can browse information from program memory victimization in particular
directions.
Several Types of Microcontrollers
in an Embedded System
• MSP Microcontroller, MSP (Mixed Signal Processor), is from the family of
Texas Instruments. Built around a 16 -bit CPU, the MSP is designed for low-cost
and low-power dissipation embedded statements. The controller's appearance
is directly related to the 16-bit data bus, seven addressing modes, and the
decreased instructions set, which allows a shorter, denser programming code
for fast performance.
Several Types of Prototyping
Microcontrollers
• Raspberry Pi is a bank-card-sized single-board
computer that can be used in many applications.
It has the capability of a regular desktop. It can be
connected to a monitor, keyboard, and mouse.

• Arduino Uno is a microcontroller board based on


a microchip. It has 20 digital I/O pins. It is
designed to make electronics accessible to
everyone interested in electronics and
programming.
Several Types of Prototyping
Microcontrollers
• Arduino Nano is a compact micro board
powerful enough to hold 16 MHz of frequency,
which is the same as Arduino UNO; however, it
does not have a DC power jack.

• Makeblock mCore is a microcontroller that


powers the mBot, with built-in I/O
components like RGB LED, buzzer, light sensors,
motors, and other communicating devices.
Lesson 2: The Arduino Board

Objectives:

• At the end of this lesson, you should be able to:

1. identify the parts of an Arduino Board; and

2. describe the functions of an Arduino Board.


The Arduino Board
• Arduino UNO is a microcontroller board
based on the ATmega328P. It has 14
digital input/output pins (six pins can be
used as PWM outputs), six analog
inputs, a 16 MHz ceramic resonator, a
USB connection, a power jack, an ICSP
header, and a reset button
The Arduino Board
• DFRduino Uno V3.0 is a small
computing board used for academics or
development projects. It is a simple
microcontroller board that is fully
compatible with the Arduino Uno
R3 and Arduino IDE open-source
development environment.
The Arduino Board
• DFRduino microcontroller headers
have different colors to feature I/O
ports of different types:
• Red for Power Section.
• Blue for Analog I/O.
• Green for Digital I/O.
Specifications
• Microcontroller: ATmega328 (DIP Package)
• Operating Voltage: 5V
• Input Voltage (recommended): 7 ~ 12V
• Input Voltage (limits): 6 ~ 20V
• Digital I/O Pins: 14 (of which 6 provide PWM output)
• Analog Input Pins: 6
• DC Current per I/O Pin: 40 mA
• DC Current for 3.3V Pin: 50 mA
• Flash Memory: 32 KB, of which the bootloader uses 2KB
• SRAM: 2 KB (ATmega328)
• EEPROM: 1 KB (ATmega328)
• Clock Speed: 16 MHz
• USB Connector: USB-B
• Size: 75 x54 x15 mm (2.95 x2.13 x0.59")
Parts of the Arduino
Microcontroller
1. USB Port - When attached to a computer via USB
cable, it can upload programs and be an alternative
power source for the microcontroller.
2. DC Power Jack – It runs the microcontroller with 7
~ 12 volts of supply.
3. Power Indicator – It lights on/off, indicating power
in the microcontroller.
4. Reset – It resets the running program when
pressed.
5. Digital Pins – These can be used to connect all
digital I/O components to the microcontroller.
∙ Digital Pins: 0 -13
∙ PWM Pins: 3,5,6,9,10,11
∙ Ground Pins
∙ AREF: Reference voltage for the analog inputs.
Parts of the Arduino
Microcontroller 6. Analog Pins – These can be used to connect
all analog I/O components to the
microcontroller.
∙ Analog Pins: A0-A5
7. Power Pins – These can be used to power a
component attached to the microcontroller.
∙ Output Power: 3.3V ~ 5V
∙ Ground Pins
∙ Vin Pins: voltage input to the
microcontroller board when using an
external power source.
8. Signal Indicator TX- It blinks when
transmitting data.
9. Signal Indicator RX- It blinks when receiving
data.
10. Signal Indicator L – It blinks when pin 13 is
alternately turned HIGH and LOW or On and Off
which means everything is working correctly.
Lesson 3: XOD Arduino
Programming
Objectives:

• At the end of this lesson, you should be able to:

1. describe XOD;

2. explain the functions of XOD; and

3. enumerate the advantages of using XOD.


XOD Arduino Programming
• XOD is a visual programming
software language for
microcontrollers. It is a software
compatible with Arduino and
Raspberry Pi boards. It is an
open-source platform that started
in 2016 which can be used by
hobbyists and professionals in
building and creating electronic
projects.
Installing XOD

Step 1: Select Only for me and


click install.
Installing XOD

Step 2: Wait until it finishes


installing on your computer.
Installing XOD

Step 3: Tick the checkbox and click


Finish to run the XOD program.
XOD IDE

Now once you start the


XOD IDE, you are ready
to program.
Running XOD
When running the XOD for the first time,
you will see a large grey color
background with boxes in your program,
which is called a patch. A patch is a
working area for an XOD program. It is
almost similar to a sketch in the Arduino
IDE; but uses text-based code. It is built
with nodes, and is an essential element
in the XOD program.
Running XOD

The pins on a node can have different


data types represented by colors.
Green pins represent numbers.
Blue pins represent pulses.
Violet pins represent Boolean values.
Orange pins represent strings.
Running XOD
Input pins are at the top side of each
node, and the Output pins are
located at the bottom. The pins on
each node are like variables and
contain parameter values. The
values can be replaced or use their
default values or selected and set
using the inspector.
Running XOD
Each node has one or more inputs
that accept values to be processed
and outputs that return a result.
Creating a link to the node builds
input and output data, allowing one
node to read values from another.
Link are lines that are used to
connect nodes. Linking nodes are
like a wiring element in an
electronic circuit.
Lesson 4: The Digital Pins

Objectives:

• At the end of this lesson, you should be able to:

1. describe Digital Pins;

2. describe the functions of Digital Pins; and

3. understand the processes of digitalRead and digitalWrite in programming.


Digital Pins

• Digital Pins in the


Arduino Microcontroller
can be customized as an
input or output,
depending on the
component functionality.
Digital Pins

A digital pin can


have two states:
Like in the Binary
system, LOW or
HIGH, 0 for OFF and
1 for ON.
Digital Pins
pinMode(): This function configures the specific pin behavior either
as an input or output.

digitalRead(): These are functions used to read the value from a


specified digital pin, either HIGH or LOW.

digitalWrite(): This is a function that the set pin states either HIGH or
LOW. Here, 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for
LOW.
Lesson 5: The Analog Input

Objectives:

• At the end of this lesson, you should be able to:

1. describe Analog Inputs; and

2. explain the functions of Analog Inputs.


Analog Pins

• Analog Input Pin in the


Arduino Microcontroller
is located near the power
pins. It has six available
analog inputs labeled as
A0 – A5.
Lesson 6: The Pulse Width
Modulation
Objectives:

• At the end of this lesson, you should be able to:

1. describe PWM;

2. explain the functions of PWM; and

3. identify the applications that use PWM.


Pulse Width Modulation (PWD)

• Pulse Width Modulation


(PWM) is a digital
technology technique for
getting analog results
with a digital source.
Pulse Width Modulation (PWD)
Here are a few exercises where you can use a PWM in Arduino.
∙ Fading an LED
∙ Dimming Light Effect on an LED
∙ Changing the variable speed of a motor
∙ Generating modulated signal on a buzzer
∙ Control angle direction of a servo motor
• Applying an analog output voltage between 0 and 255
Lesson 7: The Debugging Tools

Objectives:

• At the end of this lesson, you should be able to:

1. Identify the different debugging tools;

2. describe remote debuggers; and

3. discover the different hardware tools for debugging.


Debugging Tools
• Debugging Tools are computer programs
used for testing and debugging a specific
program.
• The primary function of each debugger
tool is to run the target program using a
control condition that tracks and
monitors operations in progress in a
computer that may prompt users for
errors or malfunctions in a code.
Debugging Tools
Debugging Tools
In the XOD programming, common errors
can only happen as wrong input on the pin;
hardware module can't respond so quickly,
incorrect data value on a node, or no
network connection. If an error occurs on
the program, a so-called catcher node
activates that propagates to all downstream
pins and prevents evaluation of their nodes
through their outgoing links.
Debugging Tools
Remote Debuggers are another common approach used to debug an embedded
program in a system. It works by connecting a particular embedded system to a
computer host and using a software to interact with the embedded system
hardware. Remote debuggers usually have two essential parts: a front-end
debugger and a back-end debugger.
∙ The front-end debugger contains the user interface (e.g. Arduino IDE or XOD
IDE) and offers the programmer choices about the execution of the code in
the embedded system hardware.
• The back-end debugger or "debug monitor" is specific for a particular
processor architecture or family and usually works with an external hardware
tool, like an in-circuit emulator or an in-circuit debugger (e.g., ThinkerCad)
Debugging Tools
There are few hardware tools that are useful for system developers
to debug hardware errors. These tools are multimeters,
oscilloscopes, logic analyzers, and Software-Define Radios (SDR) that
closely inspect hardwares like LEDs, resistors, potentiometers,
motors, etc.
Debugging Tools
A digital multimeter (DMM)
is a tool that measures two
or more electrical values,
such as voltage (volts),
current (amps), and
resistance (ohms).
Debugging Tools
An oscilloscope is a tool that
graphically displays
electrical signals and shows
how those signals change
over time when detecting a
signal from a sensor, analog,
and digital device.
Debugging Tools
A logic analyzer is a tool
designed specifically for
capturing, displaying, and
measuring electrical signals
in a digital circuit.
Debugging Tools
A software-defined radio
(SDR) is a radio
communication system that
uses a software for the
modulation and
demodulation of radio
signals.
Lesson 8: The Multimeter

Objectives:

• At the end of this lesson, you should be able to:

1. describe a multimeter; and

2. explain the functions and parts of a multimeter.


The Multimeter

• A multimeter is an instrument that can


measure multiple electrical properties
such as voltage, current, and resistance in
a circuit.
The Multimeter (Parts)
The Multimeter (Parts)
Using The Multimeter

Voltage Reading Current Reading


Resistance Reading
Using The Multimeter
Using The Multimeter
Using The Multimeter
Using The Multimeter
Common Electronic Symbols
Lesson 9: The Resistors

Objectives:

• At the end of this lesson, you should be able to:

1. describe a resistor; and

2. explain the functions of a resistor; and

3. read a resistor value.


The Resistor

• A resistor is an electronic device designed


to cause resistance to an electric current
and cause a drop in voltage across its
terminals.
The Resistor
The Resistor

1st band = Brown (1)


2nd band = Black (0)
3rd band = Black (0)
4th band = Brown (*10)
5th Band = Gold (5%)
Total Value = 1 Kilohms
The Resistor

1st band = Brown (1)


2nd band = Black (0)
3rd band = Black (*1)
4th band = Gold (5%)
Total Value = 10 Ohms
The Resistor

Through-hole resistors have a long wire on


both ends with different color values, which
can be attached to a breadboard or soldered on
a circuit board. This type of resistor can be used
for prototyping.
The Resistor

Surface-mount resistors are tiny black


rectangles with shiny silver conductive edges.
These resistors are soldered to a circuit board
commonly used in small devices such as remote
control, mobile phone, and home appliances.
The Resistor
The Resistor
Lesson 10: The Breadboard

Objectives:

• At the end of this lesson, you should be able to:

1. describe a Breadboard;

2. demonstrate how to use a breadboard its and parts; and

3. describe the different kinds of jumper wires used in a breadboard.


The Breadboard
• A breadboard, also
known as a solderless
board, is an electronic
component used to
make temporary
circuits for prototyping
an idea. A breadboard
does not need soldering
for easy-to-change
connections and replaces
electronic parts.
The Breadboard
The Breadboard
The Breadboard
A Printed Circuit Board
or PC board or PCB is a
non-conductive material
that can also be used for
prototyping.
The Breadboard
Lesson 11: Solder and Soldering

Objectives:

• At the end of this lesson, you should be able to:

1. describe a solder;

2. explain soldering; and

3. Demonstrate how to use a soldering iron and its equipment properly.


Solder and Soldering

Soldering is a process that


connects two metallic parts,
commonly used in electrical
components.
Solder and Soldering

Soldering iron is a handheld


electronic equipment used
in soldering.
Soldering Equipment
Soldering Equipment
A soldering station is a control station for
different equipment when soldering. It can hold
electrical components using an adjustable
gripper attached to the soldering station called
third hand, an LED light to view spots when
soldering, a magnifier to enlarge the view, and
a soldering stand that holds the soldering iron
in place.
Soldering Equipment
Desoldering pump is a mechanical
device also known as a soldering
sucker. It is a tool that removes the
melted lead in a printed circuit board
(PCB) or any mechanical component.
Soldering Equipment
Soldering lead is a metal alloy with
lead. It is used to bond electrical
components together when heated.
Inside the soldering core is a
material known as a flux that helps
to improve the electrical contact and
strength.
Soldering Equipment
Soldering Paste is commonly used to
create electrical connections and
mechanical bonds between electrical
components such as resistors, LED,
and printed circuit boards.
Soldering Equipment
Soldering Iron Tips are interchangeable
and replaceable tips known as bits.
There are a variety of soldering tips
that are used for different purposes.
The most common tip used for
soldering is the conical tip and chisel
tip.
Soldering Equipment
Soldering Iron Tips

The conical tip (Left) is a fine pencil-like


tip that can deliver heat to a smaller
area without affecting other surrounding
areas.
The chisel tip (Right) is a broad and flat
tip suitable for soldering wires,
surface-mounted components, and
desoldering.
Soldering Equipment
The brass sponge is used to help clean
the soldering iron tip. It is used to
remove residue from the end of the
soldering iron before using it.
Soldering Equipment
A wire cutter is a handheld tool for
cutting or trimming excess cable or wires
in the printed circuit board. It is also
sometimes used for removing the outer
jacket of a wire or cable.
How to Solder a Wire
How to Solder a Wire
How to Desolder
Lesson 12: The Circuits

Objectives:

• At the end of this lesson, you should be able to:

1. describe an electronic circuit;

2. demonstrate how to read circuit wiring and diagram; and

3. understand the safety warning and symbols when working with a circuit.
Circuits

A Circuit is a complete path


through which electricity flows
repeatedly. It is usually composed
of current sources such as a
battery, solar panel, or any power
source and conductors like wires.
Circuit Diagram
Circuit Connections
Circuit Connections
Circuit Connections
Circuit Connections
Safety Guidelines
1. Avoid contact with an energized electrical circuit
2. Treat all electrical devices as if they are alive or switch ON.
3. Disconnect the power source before connecting to a device
4. Use tools and equipment with non-conducting handles when working on electrical
devices.
5. Never wear any conductive materials when working with electrical equipment.
6. Wear protective gloves, shoes, and an anti-shock risk band when working with
electrical devices.
7. Don't place any liquid material or food while working with electrical devices.
Safety Symbols

Lightning Bolt is a standard signal for


electricity, a sign that indicates danger.

Bolt through Hand voltage or shock is a hazard


symbol that indicates that injury or death may
occur via high-voltage electrical equipment.

Magnet is a sign that can influence electric


currents and magnetic materials.
Safety Symbols

Flame is a sign of the possibility of the presence


of self-heating or flammable gases.

Poison is a major warning of acute toxicity,


which could be fatal.

Caution indicates the possibility of skin and eye


irritants, harmful toxicity, respiratory issues,
and a hazard.
Lesson 13: Running Simulations

Objectives:

• At the end of this lesson, you should be able to:

1. learn how to run simulations in XOD;

2. set up XOD; and

3. identify the parts of the XOD User Interface.


Running Simulations (XOD IDE)

The XOD IDE program


consists of nodes connected
to one or more patches. It is
an ecosystem where all
patches and nodes work in
one specific action.
Running Simulations (XOD IDE)
Running Simulations (XOD IDE)
XOD Keyboard Shortcuts
Shortcut Action
CTRL + N New Patch
CTRL + SHIFT + N New Project
CTRL + S Save Project
CTRL + O Open Project
CTRL + C Copy
CTRL + V Paste
CTRL + X Cut
CTRL + Z Undo
CTRL + A Select All
Delete or Backspace Delete the selected node
Escape Key Deselect
I Insert a Node
H Toggle Help bar
CRTL + - Zoom Out
CTRL + Shift + Zoom In
CTRL + 0 Default Zoom
Setup XOD
Setup XOD
Setup XOD
Saving, Debugging, and Compiling
Saving, Debugging, and Compiling
Saving, Debugging, and Compiling
Lesson 14: Light Emitting Diode

Objectives:

• At the end of this lesson, you should be able to:

1. describe a diode;

2. explain the function of an LED; and

3. create a program with an LED in XOD.


Light Emitting Diode
A diode is a semiconductor device
that acts as a switch for current. It
allows the current to flow in one
specific direction. It has a
two-terminal electronic component,
the anode or positive that can
handle a high resistance and the
cathode or negative that can handle
a low resistance.
Light Emitting Diode

The common application of a diode


is that it can be used as a rectifier
that converts alternating current
(AC) to direct current (DC) that
redirects the flow of electricity.
Light Emitting Diode

Light Emitting Diode (LED) is a


semiconductor device that emits
lights when an electric current
passes through its electrodes (anode
and cathode pins).
Light Emitting Diode

The LED node in XOD can be located


at the xod/common-hardware or
when pressing the I – key on the
keyboard and typing LED.
Sample Code
Sample Code
Sample Code
Sample Code
Sample Code
Sample Code
Sample Code
Sample Code
Lesson 15: The Switch

Objectives:

• At the end of this lesson, you should be able to:

1. describe a switch;

2. explain the functions of different switches; and

3. create a program with a switch in XOD.


The Switch

A switch is an electrical component that


controls the opening and closing of an
electrical circuit. Switches require
manual interaction to be controlled or
operated by a user.
The Switch

Figure 1 Figure 2
A Push-button switch is a

The Switch type of switch consisting


of four leads (legs). It
allows the electricity to
A Toggle switch is an flow by manually pressing
electrical switch that is the button, which
actuated by moving supplies the input signal Single Pole
the lever back and to activate a device. Double Throw
forth to open and (SPDT) is a
close the electrical switch that has
circuit. three terminals:
A Limit switch is an
electromechanical one single input
A Rotary DIP switch is an terminal and
device that
electrical switch packed two output
operates when it
in a small housing. It is terminals.
applies physical
operated by rotating with
force to the device.
a screwdriver through a
circular range of motion.
The Switch

The Button node in XOD can


be located at the
xod/common-hardware or
when pressing the I – key on
the keyboard and typing the
keyword button.
The Switch
The Switch
The Switch
The Switch

The Flip-flop node in XOD can


be located at the xod/core or
when pressing the I – key on
the keyboard and typing the
keyword flip-flop.
The Switch
The Switch
Lesson 16: Potentiometer and Servo

Objectives:

• At the end of this lesson, you should be able to:

1. describe a potentiometer;

2. explain the functions of different potentiometers; and

3. create a program with a potentiometer in XOD.


Potentiometer and Servo

A potentiometer or pot is an electronic


component that functions as a variable resistor
easily adjusted by a user, like a resistor whose
function is to resist the flow of electricity.
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo

9G Micro Servo is a lightweight


motor with high output power. A
servo motor produces torque
and velocity based on the
supplied current and voltage that
can lift small or light objects by
approximately 9 grams.
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
Potentiometer and Servo
• End of Slide

You might also like